[pypy-svn] r61784 - in pypy/branch/pyjitpl5/pypy/jit: backend/llgraph metainterp metainterp/test

fijal at codespeak.net fijal at codespeak.net
Thu Feb 12 15:18:37 CET 2009


Author: fijal
Date: Thu Feb 12 15:18:36 2009
New Revision: 61784

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py
   pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py
Log:
(arigo, fijal)
Remove setfield_gc_* and friends, now we encode the type of set/get field
in an offset, which became fielddesc, maintained by CPU


Modified: pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py	Thu Feb 12 15:18:36 2009
@@ -64,14 +64,10 @@
     'ooisnull'        : (('ptr',), 'bool'),
     'oois'            : (('ptr', 'ptr'), 'bool'),
     'ooisnot'         : (('ptr', 'ptr'), 'bool'),
-    'setfield_gc__4'  : (('ptr', 'fieldname', 'int'), None),
-    'getfield_gc__4'  : (('ptr', 'fieldname'), 'int'),
-    'setfield_raw__4' : (('ptr', 'fieldname', 'int'), None),
-    'getfield_raw__4' : (('ptr', 'fieldname'), 'int'),
-    'setfield_gc_ptr' : (('ptr', 'fieldname', 'ptr'), None),
-    'getfield_gc_ptr' : (('ptr', 'fieldname'), 'ptr'),
-    'setfield_raw_ptr': (('ptr', 'fieldname', 'ptr'), None),
-    'getfield_raw_ptr': (('ptr', 'fieldname'), 'ptr'),
+    'setfield_gc'     : (('ptr', 'fieldname', 'intorptr'), None),
+    'getfield_gc'     : (('ptr', 'fieldname'), 'intorptr'),
+    'setfield_raw'    : (('ptr', 'fieldname', 'intorptr'), None),
+    'getfield_raw'    : (('ptr', 'fieldname'), 'intotptr'),
     'call_ptr'        : (('ptr', 'varargs'), 'ptr'),
     'call__4'         : (('ptr', 'varargs'), 'int'),
     'call_void'       : (('ptr', 'varargs'), None),
@@ -139,13 +135,22 @@
         types = types[:-1] + ('int',) * (len(lst) - len(types) + 1)
     assert len(types) == len(lst)
     for elem, tp in zip(lst, types):
+        if len(lst) >= 2:
+            extraarg = lst[1]
+        else:
+            extraarg = None
         if isinstance(elem, Constant):
-            res_l.append('(%s)' % repr1(elem, tp, cpu))
+            res_l.append('(%s)' % repr1(elem, tp, cpu, extraarg))
         else:
-            res_l.append(repr1(elem, tp, cpu))
+            res_l.append(repr1(elem, tp, cpu, extraarg))
     return '[%s]' % (', '.join(res_l))
 
-def repr1(x, tp, cpu):
+def repr1(x, tp, cpu, extraarg):
+    if tp == "intorptr":
+        if extraarg % 2:
+            tp = "ptr"
+        else:
+            tp = "int"
     if tp == 'int':
         return str(x)
     elif tp == 'ptr':
@@ -171,7 +176,7 @@
         assert x == 0 or x == 1
         return str(bool(x))
     elif tp == 'fieldname':
-        return str(symbolic.TokenToField[x][1])
+        return str(symbolic.TokenToField[x/2][1])
     else:
         raise NotImplementedError("tp = %s" % tp)
 
@@ -376,7 +381,11 @@
             if res is None:
                 resdata = ''
             else:
-                resdata = '-> ' + repr1(res, restype, self.cpu)
+                if len(values) >= 2:
+                    extraarg = values[1]
+                else:
+                    extraarg = None
+                resdata = '-> ' + repr1(res, restype, self.cpu, extraarg)
             # fish the types
             log.cpu('\t%s %s %s' % (opname, repr_list(values, argtypes,
                                                       self.cpu), resdata))
@@ -630,76 +639,42 @@
         TYPE = symbolic.Size2Type[typesize]
         ptr = lltype.malloc(TYPE)
         ptr = lltype.cast_opaque_ptr(llmemory.GCREF, ptr)
-        self.op_setfield_gc__4(ptr, 1, vtable)
+        self.op_setfield_gc(ptr, 2, vtable)
         return ptr
 
-    def op_getfield_gc__4(self, ptr, offset):
-        STRUCT, fieldname = symbolic.TokenToField[offset]
+    def op_getfield_gc(self, ptr, fielddesc):
+        STRUCT, fieldname = symbolic.TokenToField[fielddesc/2]
         ptr = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), ptr)
         return getattr(ptr, fieldname)
 
-    def op_getfield_raw__4(self, intval, offset):
-        STRUCT, fieldname = symbolic.TokenToField[offset]
-        ptr = llmemory.cast_adr_to_ptr(self.cpu.cast_int_to_adr(intval),
-                                       lltype.Ptr(STRUCT))
-        return getattr(ptr, fieldname)
-
-    def op_getfield_raw_ptr(self, intval, offset):
-        STRUCT, fieldname = symbolic.TokenToField[offset]
+    def op_getfield_raw(self, intval, fielddesc):
+        STRUCT, fieldname = symbolic.TokenToField[fielddesc/2]
         ptr = llmemory.cast_adr_to_ptr(self.cpu.cast_int_to_adr(intval),
                                        lltype.Ptr(STRUCT))
         return getattr(ptr, fieldname)
 
-    def op_getfield_gc_ptr(self, ptr, offset):
-        STRUCT, fieldname = symbolic.TokenToField[offset]
-        ptr = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), ptr)
-        return getattr(ptr, fieldname)
-
-    def op_setfield_gc__4(self, ptr, offset, newintvalue):
-        STRUCT, fieldname = symbolic.TokenToField[offset] 
-        ptr = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), ptr)
-        FIELDTYPE = getattr(STRUCT, fieldname)
-        if isinstance(FIELDTYPE, lltype.Ptr):
-            assert FIELDTYPE.TO._gckind == 'raw'
-            newvalue = llmemory.cast_adr_to_ptr(
-                self.cpu.cast_int_to_adr(newintvalue),
-                FIELDTYPE)
-        elif FIELDTYPE == llmemory.Address:
-            newvalue = self.cpu.cast_int_to_adr(newintvalue)
-        else:
-            newvalue = newintvalue
-        setattr(ptr, fieldname, newvalue)
-
-    def op_setfield_raw__4(self, intval, offset, newintvalue):
+    def op_setfield_gc(self, ptr, fielddesc, newvalue):
+        offset = fielddesc/2
         STRUCT, fieldname = symbolic.TokenToField[offset]
-        ptr = llmemory.cast_adr_to_ptr(self.cpu.cast_int_to_adr(intval),
-                                       lltype.Ptr(STRUCT))
+        if lltype.typeOf(ptr) == llmemory.GCREF:
+            ptr = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), ptr)
         FIELDTYPE = getattr(STRUCT, fieldname)
-        if isinstance(FIELDTYPE, lltype.Ptr):
-            assert FIELDTYPE.TO._gckind == 'raw'
-            newvalue = llmemory.cast_adr_to_ptr(
-                self.cpu.cast_int_to_adr(newintvalue),
-                FIELDTYPE)
-        elif FIELDTYPE == llmemory.Address:
-            newvalue = self.cpu.cast_int_to_adr(newintvalue)
+        if fielddesc % 2:
+            newvalue = lltype.cast_opaque_ptr(FIELDTYPE, newvalue)
         else:
-            newvalue = newintvalue
+            if isinstance(FIELDTYPE, lltype.Ptr):
+                assert FIELDTYPE.TO._gckind == 'raw'
+                newvalue = llmemory.cast_adr_to_ptr(
+                    self.cpu.cast_int_to_adr(newvalue),
+                    FIELDTYPE)
+            elif FIELDTYPE == llmemory.Address:
+                newvalue = self.cpu.cast_int_to_adr(newvalue)
         setattr(ptr, fieldname, newvalue)
 
-    def op_setfield_gc_ptr(self, ptr, offset, newvalue):
-        STRUCT, fieldname = symbolic.TokenToField[offset]
-        ptr = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), ptr)
-        FIELDTYPE = getattr(STRUCT, fieldname)
-        newvalue = lltype.cast_opaque_ptr(FIELDTYPE, newvalue)
-        setattr(ptr, fieldname, newvalue)
-
-    def op_setfield_raw_ptr(self, intval, offset, newvalue):
-        STRUCT, fieldname = symbolic.TokenToField[offset]
+    def op_setfield_raw(self, intval, fielddesc, newvalue):
         ptr = llmemory.cast_adr_to_ptr(self.cpu.cast_int_to_adr(intval),
                                        lltype.Ptr(STRUCT))
-        FIELDTYPE = getattr(STRUCT, fieldname)
-        newvalue = lltype.cast_opaque_ptr(FIELDTYPE, newvalue)
-        setattr(ptr, fieldname, newvalue)        
+        self.op_setfield_gc(ptr, fielddesc, newvalue)
 
     def op_ooisnull(self, ptr):
         if lltype.typeOf(ptr) != llmemory.GCREF:

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py	Thu Feb 12 15:18:36 2009
@@ -244,9 +244,20 @@
     addresssuffix = '4'
 
     @staticmethod
-    def offsetof(S, fieldname):
+    def fielddescrof(S, fieldname):
         ofs, size = symbolic.get_field_token(S, fieldname)
-        return ofs
+        token = history.getkind(getattr(S, fieldname))
+        if token == 'ptr':
+            bit = 1
+        else:
+            bit = 0
+        return ofs*2 + bit
+
+    @staticmethod
+    def typefor(fielddesc):
+        if fielddesc % 2:
+            return 'ptr'
+        return 'int'
 
     @staticmethod
     def itemoffsetof(A):

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py	Thu Feb 12 15:18:36 2009
@@ -444,9 +444,10 @@
         if RESULT is lltype.Void:
             return
         argname = v_inst.concretetype.TO._gckind
-        self.emit('%s_%s_%s' % (opname, argname, getkind_num(self.cpu, RESULT)))
+        self.emit('%s_%s' % (opname, argname))
         self.emit(self.var_position(v_inst))
-        offset = self.cpu.offsetof(v_inst.concretetype.TO, c_fieldname.value)
+        offset = self.cpu.fielddescrof(v_inst.concretetype.TO,
+                                       c_fieldname.value)
         self.emit(offset)
         self.register_var(op.result)
 
@@ -460,9 +461,10 @@
         if RESULT is lltype.Void:
             return
         argname = v_inst.concretetype.TO._gckind
-        self.emit('setfield_%s_%s' % (argname, getkind_num(self.cpu, RESULT)))
+        self.emit('setfield_%s' % (argname,))
         self.emit(self.var_position(v_inst))
-        offset = self.cpu.offsetof(v_inst.concretetype.TO, c_fieldname.value)
+        offset = self.cpu.fielddescrof(v_inst.concretetype.TO,
+                                       c_fieldname.value)
         self.emit(offset)
         self.emit(self.var_position(v_value))
 
@@ -629,9 +631,8 @@
                 metainterp._virtualizabledescs[TOPSTRUCT] = virtualizabledesc
                 metainterp._can_have_virtualizables = virtualizabledesc
                 #             ^^^ stays None if this code is never seen
-            guard_field = self.cpu.offsetof(STRUCTTYPE, argname)
-            self.emit('guard_nonvirtualized_%s' % getkind_num(self.cpu,
-                                                              FIELDTYPE))
+            guard_field = self.cpu.fielddescrof(STRUCTTYPE, argname)
+            self.emit('guard_nonvirtualized')
             self.emit(self.var_position(op.args[0]))
             self.emit(self.get_position(virtualizabledesc))
             self.emit(guard_field)

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py	Thu Feb 12 15:18:36 2009
@@ -94,7 +94,6 @@
 class TypeCache(object):
     pass
 type_cache = TypeCache()   # XXX remove me later
-type_cache.field_type = {}
 type_cache.class_size = {}
 
 def extract_runtime_data(cpu, specnode, valuebox, resultlist):
@@ -103,14 +102,10 @@
         return
     for ofs, subspecnode in specnode.fields:
         cls = specnode.known_class.getint()
-        typemarker = type_cache.field_type[cls, ofs]
-        if typemarker.startswith('_'):
-            simpletypemarker = 'int'
-        else:
-            simpletypemarker = typemarker
-        fieldbox = cpu.execute_operation('getfield_gc_' + typemarker,
+        tp = cpu.typefor(ofs)
+        fieldbox = cpu.execute_operation('getfield_gc',
                                          [valuebox, ConstInt(ofs)],
-                                         simpletypemarker)
+                                         tp)
         extract_runtime_data(cpu, subspecnode, fieldbox, resultlist)
 
 
@@ -240,17 +235,16 @@
                 instnode.cls = InstanceNode(op.args[1])
                 self.nodes[box] = instnode
                 continue
-            elif opname.startswith('setfield_gc_'):
+            elif opname == 'setfield_gc':
                 instnode = self.getnode(op.args[0])
                 fieldbox = op.args[1]
                 assert isinstance(fieldbox, ConstInt)
                 field = fieldbox.getint()
                 fieldnode = self.getnode(op.args[2])
                 instnode.curfields[field] = fieldnode
-                if opname == 'setfield_gc_ptr':
-                    self.dependency_graph.append((instnode, fieldnode))
+                self.dependency_graph.append((instnode, fieldnode))
                 continue
-            elif opname.startswith('getfield_gc_'):
+            elif opname == 'getfield_gc':
                 instnode = self.getnode(op.args[0])
                 fieldbox = op.args[1]
                 assert isinstance(fieldbox, ConstInt)
@@ -431,7 +425,7 @@
                 op = self.optimize_guard(op)
                 newoperations.append(op)
                 continue
-            elif opname.startswith('getfield_gc_'):
+            elif opname == 'getfield_gc':
                 instnode = self.nodes[op.args[0]]
                 if instnode.virtual or instnode.virtualized:
                     ofs = op.args[1].getint()
@@ -448,18 +442,12 @@
                     key = instnode.cls.source.getint()
                     type_cache.class_size[key] = size
                     continue
-            elif opname.startswith('setfield_gc_'):
+            elif opname == 'setfield_gc':
                 instnode = self.nodes[op.args[0]]
                 valuenode = self.nodes[op.args[2]]
                 if instnode.virtual or instnode.virtualized:
                     ofs = op.args[1].getint()
                     instnode.curfields[ofs] = valuenode
-                    # XXX hack
-                    assert instnode.cls is not None
-                    cls = instnode.cls.source.getint()
-                    typemarker = opname[len('setfield_gc_'):]
-                    type_cache.field_type[cls, ofs] = typemarker
-                    # XXX end of hack
                     continue
                 assert not valuenode.virtual
             elif opname == 'ooisnull' or opname == 'oononnull':
@@ -549,9 +537,9 @@
         else:
             fieldbox = boxes_from_frame[index_in_arglist]
         vtable = storage.allocations[index_in_alloc]
-        opname = 'setfield_gc_' + type_cache.field_type[vtable, ofs]
         box = allocated_boxes[index_in_alloc]
-        history.execute_and_record(opname, [box, ConstInt(ofs), fieldbox],
+        history.execute_and_record('setfield_gc',
+                                   [box, ConstInt(ofs), fieldbox],
                                    'void', False)
     newboxes = []
     for index in storage.indices:

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py	Thu Feb 12 15:18:36 2009
@@ -304,74 +304,30 @@
     def opimpl_ptr_ne(self, box1, box2):
         self.execute('ooisnot', [box1, box2], 'int', True)
 
-    @arguments("box", "int")
-    def opimpl_getfield__1(self, box, offset):
-        self.execute('getfield__1', [box, ConstInt(offset)], 'int')
-    @arguments("box", "int")
-    def opimpl_getfield_pure__1(self, box, offset):
-        self.execute('getfield__1', [box, ConstInt(offset)], 'int', True)
-    @arguments("box", "int", "box")
-    def opimpl_setfield__1(self, box, offset, valuebox):
-        self.execute('setfield__1', [box, ConstInt(offset), valuebox], 'void')
-
-    @arguments("box", "int")
-    def opimpl_getfield__2(self, box, offset):
-        self.execute('getfield__2', [box, ConstInt(offset)], 'int')
-    @arguments("box", "int")
-    def opimpl_getfield_pure__2(self, box, offset):
-        self.execute('getfield__2', [box, ConstInt(offset)], 'int', True)
-    @arguments("box", "int", "box")
-    def opimpl_setfield__2(self, box, offset, valuebox):
-        self.execute('setfield__2', [box, ConstInt(offset), valuebox], 'void')
 
     @arguments("box", "int")
-    def opimpl_getfield_gc__4(self, box, offset):
-        self.execute('getfield_gc__4', [box, ConstInt(offset)], 'int')
-    @arguments("box", "int")
-    def opimpl_getfield_pure_gc__4(self, box, offset):
-        self.execute('getfield_gc__4', [box, ConstInt(offset)], 'int', True)
+    def opimpl_getfield_gc(self, box, fielddesc):
+        tp = self.metainterp.cpu.typefor(fielddesc)
+        self.execute('getfield_gc', [box, ConstInt(fielddesc)], tp)
+    @arguments("box", "int")
+    def opimpl_getfield_pure_gc(self, box, fielddesc):
+        tp = self.metainterp.cpu.typefor(fielddesc)
+        self.execute('getfield_gc', [box, ConstInt(fielddesc)], tp, True)
     @arguments("box", "int", "box")
-    def opimpl_setfield_gc__4(self, box, offset, valuebox):
-        self.execute('setfield_gc__4', [box, ConstInt(offset), valuebox], 'void')
+    def opimpl_setfield_gc(self, box, offset, valuebox):
+        self.execute('setfield_gc', [box, ConstInt(offset), valuebox], 'void')
 
     @arguments("box", "int")
-    def opimpl_getfield_raw__4(self, box, offset):
-        self.execute('getfield_raw__4', [box, ConstInt(offset)], 'int')
-    @arguments("box", "int")
-    def opimpl_getfield_pure_raw__4(self, box, offset):
-        self.execute('getfield_raw__4', [box, ConstInt(offset)], 'int', True)
-    @arguments("box", "int", "box")
-    def opimpl_setfield_raw__4(self, box, offset, valuebox):
-        self.execute('setfield_raw__4', [box, ConstInt(offset), valuebox], 'void')    
-
-    @arguments("box", "int")
-    def opimpl_getfield__8(self, box, offset):
-        self.execute('getfield__8', [box, ConstInt(offset)], 'int')
-    @arguments("box", "int")
-    def opimpl_getfield_pure__8(self, box, offset):
-        self.execute('getfield__8', [box, ConstInt(offset)], 'int', True)
-    @arguments("box", "int", "box")
-    def opimpl_setfield__8(self, box, offset, valuebox):
-        self.execute('setfield__8', [box, ConstInt(offset), valuebox], 'void')
-
-    @arguments("box", "int")
-    def opimpl_getfield_gc_ptr(self, box, offset):
-        self.execute('getfield_gc_ptr', [box, ConstInt(offset)], 'ptr')
-    @arguments("box", "int")
-    def opimpl_getfield_pure_gc_ptr(self, box, offset):
-        self.execute('getfield_gc_ptr', [box, ConstInt(offset)], 'ptr', True)
-    @arguments("box", "int", "box")
-    def opimpl_setfield_gc_ptr(self, box, offset, valuebox):
-        self.execute('setfield_gc_ptr', [box, ConstInt(offset), valuebox], 'void')
-    @arguments("box", "int")
-    def opimpl_getfield_raw_ptr(self, box, offset):
-        self.execute('getfield_raw_ptr', [box, ConstInt(offset)], 'ptr')
+    def opimpl_getfield_raw(self, box, fielddesc):
+        tp = self.metainterp.cpu.typefor(fielddesc)
+        self.execute('getfield_raw', [box, ConstInt(fielddesc)], tp)
     @arguments("box", "int")
-    def opimpl_getfield_pure_raw_ptr(self, box, offset):
-        self.execute('getfield_raw_ptr', [box, ConstInt(offset)], 'ptr', True)
+    def opimpl_getfield_pure_raw(self, box, fielddesc):
+        tp = self.metainterp.cpu.typefor(fielddesc)
+        self.execute('getfield_raw', [box, ConstInt(offset)], tp, True)
     @arguments("box", "int", "box")
-    def opimpl_setfield_raw_ptr(self, box, offset, valuebox):
-        self.execute('setfield_raw_ptr', [box, ConstInt(offset), valuebox], 'void')
+    def opimpl_setfield_raw(self, box, offset, valuebox):
+        self.execute('setfield_raw', [box, ConstInt(offset), valuebox], 'void')
 
     @arguments("bytecode", "varargs")
     def opimpl_call(self, callee, varargs):

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py	Thu Feb 12 15:18:36 2009
@@ -66,8 +66,8 @@
 # ____________________________________________________________
 
 class A:
-    ofs_next = runner.CPU.offsetof(NODE, 'next')
-    ofs_value = runner.CPU.offsetof(NODE, 'value')
+    ofs_next = runner.CPU.fielddescrof(NODE, 'next')
+    ofs_value = runner.CPU.fielddescrof(NODE, 'value')
     size_of_node = runner.CPU.sizeof(NODE)
     #
     startnode = lltype.malloc(NODE)
@@ -84,12 +84,12 @@
     ops = [
         MergePoint('merge_point', [sum, n1], []),
         ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], []),
-        ResOperation('getfield_gc__4', [n1, ConstInt(ofs_value)], [v]),
+        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], [v]),
         ResOperation('int_sub', [v, ConstInt(1)], [v2]),
         ResOperation('int_add', [sum, v], [sum2]),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value), v2], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], []),
         Jump('jump', [sum2, n2], []),
         ]
 
@@ -134,12 +134,12 @@
     ops = [
         MergePoint('merge_point', [sum, n1], []),
         ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], []),
-        ResOperation('getfield_gc__4', [n1, ConstInt(ofs_value)], [v]),
+        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], [v]),
         ResOperation('int_sub', [v, ConstInt(1)], [v2]),
         ResOperation('int_add', [sum, v], [sum2]),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value), v2], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], []),
         ResOperation('some_escaping_operation', [n2], []),    # <== escaping
         Jump('jump', [sum2, n2], []),
         ]
@@ -171,12 +171,12 @@
     assert equaloplists(operations, [
         MergePoint('merge_point', [B.sum, B.n1], []),
         # guard_class is gone
-        ResOperation('getfield_gc__4', [B.n1, ConstInt(B.ofs_value)], [B.v]),
+        ResOperation('getfield_gc', [B.n1, ConstInt(B.ofs_value)], [B.v]),
         ResOperation('int_sub', [B.v, ConstInt(1)], [B.v2]),
         ResOperation('int_add', [B.sum, B.v], [B.sum2]),
         ResOperation('new_with_vtable', [ConstInt(B.size_of_node),
                                          ConstAddr(node_vtable, cpu)], [B.n2]),
-        ResOperation('setfield_gc__4', [B.n2, ConstInt(B.ofs_value), B.v2],
+        ResOperation('setfield_gc', [B.n2, ConstInt(B.ofs_value), B.v2],
                                        []),
         ResOperation('some_escaping_operation', [B.n2], []),    # <== escaping
         Jump('jump', [B.sum2, B.n2], []),
@@ -189,13 +189,13 @@
     ops = [
         MergePoint('merge_point', [sum, n1], []),
         ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], []),
-        ResOperation('getfield_gc__4', [n1, ConstInt(ofs_value)], [v]),
+        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], [v]),
         ResOperation('int_sub', [v, ConstInt(1)], [v2]),
         ResOperation('int_add', [sum, v], [sum2]),
         ResOperation('some_escaping_operation', [n1], []),    # <== escaping
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value), v2], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], []),
         Jump('jump', [sum2, n2], []),
         ]
 
@@ -226,13 +226,13 @@
     assert equaloplists(operations, [
         MergePoint('merge_point', [C.sum, C.n1], []),
         # guard_class is gone
-        ResOperation('getfield_gc__4', [C.n1, ConstInt(C.ofs_value)], [C.v]),
+        ResOperation('getfield_gc', [C.n1, ConstInt(C.ofs_value)], [C.v]),
         ResOperation('int_sub', [C.v, ConstInt(1)], [C.v2]),
         ResOperation('int_add', [C.sum, C.v], [C.sum2]),
         ResOperation('some_escaping_operation', [C.n1], []),    # <== escaping
         ResOperation('new_with_vtable', [ConstInt(C.size_of_node),
                                          ConstAddr(node_vtable, cpu)], [C.n2]),
-        ResOperation('setfield_gc__4', [C.n2, ConstInt(C.ofs_value), C.v2],
+        ResOperation('setfield_gc', [C.n2, ConstInt(C.ofs_value), C.v2],
                                        []),
         Jump('jump', [C.sum2, C.n2], []),
         ])
@@ -245,12 +245,12 @@
         MergePoint('merge_point', [sum, n1], []),
         ResOperation('guard_class', [n1, ConstAddr(node2_vtable, cpu)], []),
         # the only difference is different vtable  ^^^^^^^^^^^^
-        ResOperation('getfield_gc__4', [n1, ConstInt(ofs_value)], [v]),
+        ResOperation('getfield', [n1, ConstInt(ofs_value)], [v]),
         ResOperation('int_sub', [v, ConstInt(1)], [v2]),
         ResOperation('int_add', [sum, v], [sum2]),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value), v2], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], []),
         Jump('jump', [sum2, n2], []),
         ]
 
@@ -266,12 +266,12 @@
     ops = [
         MergePoint('merge_point', [sum, n1], []),
         ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], []),
-        ResOperation('getfield_gc__4', [n1, ConstInt(ofs_value)], [v]),
+        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], [v]),
         ResOperation('int_sub', [v, ConstInt(1)], [v2]),
         ResOperation('int_add', [sum, v], [sum2]),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value), v2], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], []),
         ResOperation('guard_true', [v2], []),
         Jump('jump', [sum2, n2], []),
         ]
@@ -324,7 +324,7 @@
     vt = cpu.cast_adr_to_int(node_vtable_adr)
     assert fake_history.ops == [
        ('new_with_vtable', [ConstInt(type_cache.class_size[vt]), ConstInt(vt)]),
-       ('setfield_gc__4', ['allocated', ConstInt(E.ofs_value), v_v_b])
+       ('setfield_gc', ['allocated', ConstInt(E.ofs_value), v_v_b])
        ]
     assert newboxes == [v_sum_b, 'allocated']
 
@@ -341,12 +341,12 @@
     ops = [
         MergePoint('merge_point', [sum, n1, n3], []),
         ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], []),
-        ResOperation('getfield_gc__4', [n1, ConstInt(ofs_value)], [v]),
+        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], [v]),
         ResOperation('int_sub', [v, ConstInt(1)], [v2]),
         ResOperation('int_add', [sum, v], [sum2]),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value), v2], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], []),
         ResOperation('ooisnot', [n2, n3], [vbool1]),
         GuardOp('guard_true', [vbool1], []),
         ResOperation('ooisnull', [n2], [vbool2]),
@@ -391,16 +391,16 @@
     ops = [
         MergePoint('merge_point', [sum, n1], []),
         ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], []),
-        ResOperation('getfield_gc__4', [n1, ConstInt(ofs_value)], [v]),
+        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], [v]),
         ResOperation('int_sub', [v, ConstInt(1)], [v2]),
         ResOperation('int_add', [sum, v], [sum2]),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value),
                                             ConstInt(123)], []),
-        ResOperation('getfield_gc__4', [n2, ConstInt(ofs_value)], [v3]),
+        ResOperation('getfield_gc', [n2, ConstInt(ofs_value)], [v3]),
         ResOperation('int_add', [v3, ConstInt(1)], [v4]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value), v4], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v4], []),
         ResOperation('guard_true', [v2], []),
         Jump('jump', [sum2, n2], []),
         ]
@@ -444,13 +444,13 @@
     v2 = BoxInt(nextnode.value)
     ops = [
         MergePoint('merge_point', [n0], []),
-        ResOperation('getfield_gc_ptr', [n0, ConstInt(ofs_next)], [n1]),
-        ResOperation('getfield_gc__4', [n1, ConstInt(ofs_value)], [v]),
+        ResOperation('getfield_gc', [n0, ConstInt(ofs_next)], [n1]),
+        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], [v]),
         ResOperation('int_sub', [v, ConstInt(1)], [v2]),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc__4', [n2, ConstInt(ofs_value), v2], []),
-        ResOperation('setfield_gc_ptr', [n0, ConstInt(ofs_next), n2], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], []),
+        ResOperation('setfield_gc', [n0, ConstInt(ofs_next), n2], []),
         Jump('jump', [n0], []),
         ]
 
@@ -478,7 +478,7 @@
         MergePoint('merge_point', [n0], []),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc_ptr', [n2, ConstInt(ofs_next), n0], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_next), n0], []),
         Jump('jump', [n2], []),
         ]
 
@@ -505,10 +505,10 @@
     n1 = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, nextnode))
     ops = [
         MergePoint('merge_point', [n0], []),
-        ResOperation('getfield_gc_ptr', [n0, ConstInt(ofs_next)], [n1]),
+        ResOperation('getfield_gc', [n0, ConstInt(ofs_next)], [n1]),
         ResOperation('new_with_vtable', [ConstInt(size_of_node),
                                          ConstAddr(node_vtable, cpu)], [n2]),
-        ResOperation('setfield_gc_ptr', [n2, ConstInt(ofs_next), n1], []),
+        ResOperation('setfield_gc', [n2, ConstInt(ofs_next), n1], []),
         Jump('jump', [n2], []),
         ]
 



More information about the Pypy-commit mailing list