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

arigo at codespeak.net arigo at codespeak.net
Fri Mar 6 18:47:03 CET 2009


Author: arigo
Date: Fri Mar  6 18:46:59 2009
New Revision: 62661

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py
   pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
   pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/test/test_llgraph.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/executor.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/resoperation.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/specnode.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_list_optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py
Log:
Rewrite the operations that take an always-constant int argument
(fielddescr, arraydescr, calldescr) to pass this as an integer on the
ResOperation class directly ('descr').  This changes many operations
that now take one argument less.  I hope I fixed everything about
them... but I may have forgotten something in optimize.py.



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	Fri Mar  6 18:46:59 2009
@@ -4,6 +4,7 @@
 when executing on top of the llinterpreter.
 """
 
+import sys
 from pypy.objspace.flow.model import Variable, Constant
 from pypy.annotation import model as annmodel
 from pypy.jit.metainterp.history import (ConstInt, ConstPtr, ConstAddr,
@@ -82,45 +83,44 @@
     'uint_ne'         : (('int', 'int'), 'bool'),
     'uint_gt'         : (('int', 'int'), 'bool'),
     'uint_ge'         : (('int', 'int'), 'bool'),
-    'new_with_vtable' : (('int', 'ptr'), 'ptr'),
-    'new'             : (('int',), 'ptr'),
-    'new_array'       : (('int', 'int'), 'ptr'),
+    'new_with_vtable' : (('ptr',), 'ptr'),
+    'new'             : ((), 'ptr'),
+    'new_array'       : (('int',), 'ptr'),
     'oononnull'       : (('ptr',), 'bool'),
     'ooisnull'        : (('ptr',), 'bool'),
     'oois'            : (('ptr', 'ptr'), 'bool'),
     'ooisnot'         : (('ptr', 'ptr'), 'bool'),
-    'setfield_gc'     : (('ptr', 'fieldname', 'intorptr'), None),
-    'getfield_gc'     : (('ptr', 'fieldname'), 'intorptr'),
-    'getfield_gc_pure': (('ptr', 'fieldname'), 'intorptr'),
-    'setfield_raw'    : (('ptr', 'fieldname', 'intorptr'), None),
-    'getfield_raw'    : (('ptr', 'fieldname'), 'intorptr'),
-    'getfield_raw_pure': (('ptr', 'fieldname'), 'intorptr'),
-    'setarrayitem_gc' : (('ptr', 'int', 'int', 'intorptr'), None),
-    'getarrayitem_gc' : (('ptr', 'int', 'int'), 'intorptr'),
-    'getarrayitem_gc_pure' : (('ptr', 'int', 'int'), 'intorptr'),
-    'arraylen_gc'     : (('ptr', 'int'), 'int'),
-    'call'            : (('ptr', 'int', 'varargs'), 'intorptr'),
-    'call_pure'       : (('ptr', 'int', 'varargs'), 'intorptr'),
+    'setfield_gc'     : (('ptr', 'intorptr'), None),
+    'getfield_gc'     : (('ptr',), 'intorptr'),
+    'getfield_gc_pure': (('ptr',), 'intorptr'),
+    'setfield_raw'    : (('ptr', 'intorptr'), None),
+    'getfield_raw'    : (('ptr',), 'intorptr'),
+    'getfield_raw_pure': (('ptr',), 'intorptr'),
+    'setarrayitem_gc' : (('ptr', 'int', 'intorptr'), None),
+    'getarrayitem_gc' : (('ptr', 'int'), 'intorptr'),
+    'getarrayitem_gc_pure' : (('ptr', 'int'), 'intorptr'),
+    'arraylen_gc'     : (('ptr',), 'int'),
+    'call'            : (('ptr', 'varargs'), 'intorptr'),
+    'call_pure'       : (('ptr', 'varargs'), 'intorptr'),
     'guard_true'      : (('bool',), None),
     'guard_false'     : (('bool',), None),
     'guard_value'     : (('int', 'int'), None),
     'guard_class'     : (('ptr', 'ptr'), None),
     'guard_no_exception'   : ((), None),
     'guard_exception'      : (('ptr',), 'ptr'),
-    'guard_nonvirtualized' : (('ptr', 'ptr', 'int'), None),
-    'guard_builtin'   : (('ptr',), None),
+    'guard_nonvirtualized' : (('ptr', 'ptr'), None),
     'newstr'          : (('int',), 'ptr'),
     'strlen'          : (('ptr',), 'int'),
     'strgetitem'      : (('ptr', 'int'), 'int'),
     'strsetitem'      : (('ptr', 'int', 'int'), None),
-    'getitem'         : (('void', 'ptr', 'int'), 'int'),
-    'setitem'         : (('void', 'ptr', 'int', 'int'), None),
-    'newlist'         : (('void', 'varargs'), 'ptr'),
-    'append'          : (('void', 'ptr', 'int'), None),
-    'insert'          : (('void', 'ptr', 'int', 'int'), None),
-    'pop'             : (('void', 'ptr',), 'int'),
-    'len'             : (('void', 'ptr',), 'int'),
-    'listnonzero'     : (('void', 'ptr',), 'int'),
+    #'getitem'         : (('void', 'ptr', 'int'), 'int'),
+    #'setitem'         : (('void', 'ptr', 'int', 'int'), None),
+    #'newlist'         : (('void', 'varargs'), 'ptr'),
+    #'append'          : (('void', 'ptr', 'int'), None),
+    #'insert'          : (('void', 'ptr', 'int', 'int'), None),
+    #'pop'             : (('void', 'ptr',), 'int'),
+    #'len'             : (('void', 'ptr',), 'int'),
+    #'listnonzero'     : (('void', 'ptr',), 'int'),
 }
 
 # ____________________________________________________________
@@ -135,10 +135,11 @@
         return '\n'.join(lines)
 
 class Operation(object):
-    def __init__(self, opnum):
+    def __init__(self, opnum, descr):
         self.opnum = opnum
         self.args = []
         self.result = None
+        self.descr = descr
         self.livevars = []   # for guards only
 
     def __repr__(self):
@@ -179,19 +180,16 @@
         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, memocast, extraarg))
+            res_l.append('(%s)' % repr1(elem, tp, memocast))
         else:
-            res_l.append(repr1(elem, tp, memocast, extraarg))
+            res_l.append(repr1(elem, tp, memocast))
     return '[%s]' % (', '.join(res_l))
 
-def repr1(x, tp, memocast, extraarg):
+def repr1(x, tp, memocast):
     if tp == "intorptr":
-        if extraarg % 2:
+        TYPE = lltype.typeOf(x)
+        if isinstance(TYPE, lltype.Ptr) and TYPE.TO._gckind == 'gc':
             tp = "ptr"
         else:
             tp = "int"
@@ -221,8 +219,8 @@
     elif tp == 'bool':
         assert x == 0 or x == 1
         return str(bool(x))
-    elif tp == 'fieldname':
-        return str(symbolic.TokenToField[x/2][1])
+    #elif tp == 'fieldname':
+    #    return str(symbolic.TokenToField[x/2][1])
     else:
         raise NotImplementedError("tp = %s" % tp)
 
@@ -250,9 +248,9 @@
     _variables.append(v)
     return r
 
-def compile_add(loop, opnum):
+def compile_add(loop, opnum, descr):
     loop = _from_opaque(loop)
-    loop.operations.append(Operation(opnum))
+    loop.operations.append(Operation(opnum, descr))
 
 def compile_add_var(loop, intvar):
     loop = _from_opaque(loop)
@@ -367,7 +365,8 @@
                 _stats.exec_jumps += 1
                 continue
             try:
-                result = self.execute_operation(op.opnum, args, verbose)
+                result = self.execute_operation(op.opnum, args, op.descr,
+                                                verbose)
                 #verbose = self.verbose
                 assert (result is None) == (op.result is None)
                 if op.result is not None:
@@ -405,7 +404,7 @@
                     self.failed_guard_op = op
                     return op.failnum
 
-    def execute_operation(self, opnum, values, verbose):
+    def execute_operation(self, opnum, values, descr, verbose):
         """Execute a single operation.
         """
         ophandler = self.OPHANDLERS[opnum]
@@ -419,17 +418,13 @@
         for i in range(len(values)):
             if isinstance(values[i], ComputedIntSymbolic):
                 values[i] = values[i].compute_fn()
-        res = ophandler(self, *values)
+        res = ophandler(self, descr, *values)
         if verbose:
             argtypes, restype = TYPES[opname]
             if res is None:
                 resdata = ''
             else:
-                if len(values) >= 2:
-                    extraarg = values[1]
-                else:
-                    extraarg = None
-                resdata = '-> ' + repr1(res, restype, self.memocast, extraarg)
+                resdata = '-> ' + repr1(res, restype, self.memocast)
             # fish the types
             log.cpu('\t%s %s %s' % (opname, repr_list(values, argtypes,
                                                       self.memocast), resdata))
@@ -456,13 +451,13 @@
             name = 'do_' + opname.lower()
             try:
                 impl = globals()[name]                    # do_arraylen_gc etc.
-                def op(self, *args):
-                    return impl(*args)
+                def op(self, descr, *args):
+                    return impl(descr, *args)
                 #
             except KeyError:
                 from pypy.jit.backend.llgraph import llimpl
                 impl = getattr(executor, name)            # do_int_add etc.
-                def _op_default_implementation(self, *args):
+                def _op_default_implementation(self, descr, *args):
                     # for all operations implemented in execute.py
                     boxedargs = []
                     for x in args:
@@ -477,57 +472,15 @@
                 #
         Frame.OPHANDLERS[opnum] = op
 
-    def op_guard_true(self, value):
+    def op_guard_true(self, _, value):
         if not value:
             raise GuardFailed
 
-    def op_guard_false(self, value):
+    def op_guard_false(self, _, value):
         if value:
             raise GuardFailed
 
-    op_guard_nonzero = op_guard_true
-    op_guard_iszero  = op_guard_false
-
-    def op_guard_nonnull(self, ptr):
-        if lltype.typeOf(ptr) != llmemory.GCREF:
-            ptr = cast_int_to_adr(self.memocast, ptr)
-        if not ptr:
-            raise GuardFailed
-
-    def op_guard_isnull(self, ptr):
-        if lltype.typeOf(ptr) != llmemory.GCREF:
-            ptr = cast_int_to_adr(self.memocast, ptr)
-        if ptr:
-            raise GuardFailed
-
-    def op_guard_lt(self, value1, value2):
-        if value1 >= value2:
-            raise GuardFailed
-
-    def op_guard_le(self, value1, value2):
-        if value1 > value2:
-            raise GuardFailed
-
-    def op_guard_eq(self, value1, value2):
-        if value1 != value2:
-            raise GuardFailed
-
-    def op_guard_ne(self, value1, value2):
-        if value1 == value2:
-            raise GuardFailed
-
-    def op_guard_gt(self, value1, value2):
-        if value1 <= value2:
-            raise GuardFailed
-
-    def op_guard_ge(self, value1, value2):
-        if value1 < value2:
-            raise GuardFailed
-
-    op_guard_is    = op_guard_eq
-    op_guard_isnot = op_guard_ne
-
-    def op_guard_class(self, value, expected_class):
+    def op_guard_class(self, _, value, expected_class):
         value = lltype.cast_opaque_ptr(rclass.OBJECTPTR, value)
         expected_class = llmemory.cast_adr_to_ptr(
             cast_int_to_adr(self.memocast, expected_class),
@@ -535,23 +488,23 @@
         if value.typeptr != expected_class:
             raise GuardFailed
 
-    def op_guard_value(self, value, expected_value):
+    def op_guard_value(self, _, value, expected_value):
         if value != expected_value:
             raise GuardFailed
 
-    def op_guard_nonvirtualized(self, value, expected_class,
-                                for_accessing_field):
-        self.op_guard_class(value, expected_class)
+    def op_guard_nonvirtualized(self, for_accessing_field,
+                                value, expected_class):
+        self.op_guard_class(-1, value, expected_class)
         if heaptracker.cast_vable(value).vable_rti:
             raise GuardFailed    # some other code is already in control
 
-    def op_guard_no_exception(self):
+    def op_guard_no_exception(self, _):
         global _last_exception_handled
         _last_exception_handled = True
         if _last_exception:
             raise GuardFailed
 
-    def op_guard_exception(self, expected_exception):
+    def op_guard_exception(self, _, expected_exception):
         global _last_exception_handled
         _last_exception_handled = True
         expected_exception = llmemory.cast_adr_to_ptr(
@@ -569,19 +522,19 @@
     # ----------
     # delegating to the builtins do_xxx() (done automatically for simple cases)
 
-    def op_getarrayitem_gc(self, array, arraydescr, index):
+    def op_getarrayitem_gc(self, arraydescr, array, index):
         if arraydescr & 1:
             return do_getarrayitem_gc_ptr(array, index)
         else:
             return do_getarrayitem_gc_int(array, index, self.memocast)
 
-    def op_getfield_gc(self, struct, fielddescr):
+    def op_getfield_gc(self, fielddescr, struct):
         if fielddescr & 1:
             return do_getfield_gc_ptr(struct, fielddescr)
         else:
             return do_getfield_gc_int(struct, fielddescr, self.memocast)
 
-    def op_getfield_raw(self, struct, fielddescr):
+    def op_getfield_raw(self, fielddescr, struct):
         if fielddescr & 1:
             return do_getfield_raw_ptr(struct, fielddescr)
         else:
@@ -593,25 +546,25 @@
         value.typeptr = cast_from_int(rclass.CLASSTYPE, vtable, self.memocast)
         return result
 
-    def op_setarrayitem_gc(self, array, arraydescr, index, newvalue):
+    def op_setarrayitem_gc(self, arraydescr, array, index, newvalue):
         if arraydescr & 1:
             do_setarrayitem_gc_ptr(array, index, newvalue)
         else:
             do_setarrayitem_gc_int(array, index, newvalue, self.memocast)
 
-    def op_setfield_gc(self, struct, fielddescr, newvalue):
+    def op_setfield_gc(self, fielddescr, struct, newvalue):
         if fielddescr & 1:
             do_setfield_gc_ptr(struct, fielddescr, newvalue)
         else:
             do_setfield_gc_int(struct, fielddescr, newvalue, self.memocast)
 
-    def op_setfield_raw(self, struct, fielddescr, newvalue):
+    def op_setfield_raw(self, fielddescr, struct, newvalue):
         if fielddescr & 1:
             do_setfield_raw_ptr(struct, fielddescr, newvalue)
         else:
             do_setfield_raw_int(struct, fielddescr, newvalue, self.memocast)
 
-    def op_call(self, func, calldescr, *args):
+    def op_call(self, calldescr, func, *args):
         global _last_exception, _last_exception_handled
         _call_args[:] = args
         try:
@@ -621,7 +574,7 @@
         except LLException, e:
             _last_exception = e
             _last_exception_handled = False
-            if calldescr == -1:
+            if calldescr == sys.maxint:
                 return None
             elif calldescr & 1:
                 return lltype.nullptr(llmemory.GCREF)
@@ -779,15 +732,15 @@
 # ____________________________________________________________
 
 
-def do_arraylen_gc(array, ignored):
+def do_arraylen_gc(arraydescr, array):
     array = array._obj.container
     return array.getlength()
 
-def do_strlen(string):
+def do_strlen(_, string):
     str = lltype.cast_opaque_ptr(lltype.Ptr(rstr.STR), string)
     return len(str.chars)
 
-def do_strgetitem(string, index):
+def do_strgetitem(_, string, index):
     str = lltype.cast_opaque_ptr(lltype.Ptr(rstr.STR), string)
     return ord(str.chars[index])
 
@@ -873,11 +826,11 @@
     newvalue = cast_from_ptr(FIELDTYPE, newvalue)
     setattr(ptr, fieldname, newvalue)
 
-def do_newstr(length):
+def do_newstr(_, length):
     x = rstr.mallocstr(length)
     return cast_to_ptr(x)
 
-def do_strsetitem(string, index, newvalue):
+def do_strsetitem(_, string, index, newvalue):
     str = lltype.cast_opaque_ptr(lltype.Ptr(rstr.STR), string)
     str.chars[index] = chr(newvalue)
 

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	Fri Mar  6 18:46:59 2009
@@ -2,6 +2,7 @@
 Minimal-API wrapper around the llinterpreter to run operations.
 """
 
+import sys
 from pypy.rpython.lltypesystem import lltype, llmemory, rclass
 from pypy.rpython.llinterp import LLInterpreter
 from pypy.jit.metainterp import history
@@ -63,7 +64,7 @@
             op._compiled = c
             op._opindex = j
             j += 1
-            llimpl.compile_add(c, op.opnum)
+            llimpl.compile_add(c, op.opnum, op.descr)
             for x in op.args:
                 if isinstance(x, history.Box):
                     llimpl.compile_add_var(c, var2index[x])
@@ -214,7 +215,7 @@
     @staticmethod
     def calldescrof(ARGS, RESULT):
         if RESULT is lltype.Void:
-            return -1
+            return sys.maxint
         token = history.getkind(RESULT)
         if token == 'ptr':
             return 1
@@ -223,7 +224,7 @@
 
     @staticmethod
     def typefor(fielddesc):
-        if fielddesc == -1:
+        if fielddesc == sys.maxint:
             return 'void'
         if fielddesc % 2:
             return 'ptr'
@@ -247,32 +248,30 @@
 
     # ---------- the backend-dependent operations ----------
 
-    def do_arraylen_gc(self, args):
+    def do_arraylen_gc(self, args, arraydescr):
         array = args[0].getptr_base()
-        return history.BoxInt(llimpl.do_arraylen_gc(array, 0))
+        return history.BoxInt(llimpl.do_arraylen_gc(arraydescr, array))
 
-    def do_strlen(self, args):
+    def do_strlen(self, args, descr=0):
         string = args[0].getptr_base()
-        return history.BoxInt(llimpl.do_strlen(string))
+        return history.BoxInt(llimpl.do_strlen(0, string))
 
-    def do_strgetitem(self, args):
+    def do_strgetitem(self, args, descr=0):
         string = args[0].getptr_base()
         index = args[1].getint()
-        return history.BoxInt(llimpl.do_strgetitem(string, index))
+        return history.BoxInt(llimpl.do_strgetitem(0, string, index))
 
-    def do_getarrayitem_gc(self, args):
+    def do_getarrayitem_gc(self, args, arraydescr):
         array = args[0].getptr_base()
-        arraydescr = args[1].getint()
-        index = args[2].getint()
+        index = args[1].getint()
         if self.typefor(arraydescr) == 'ptr':
             return history.BoxPtr(llimpl.do_getarrayitem_gc_ptr(array, index))
         else:
             return history.BoxInt(llimpl.do_getarrayitem_gc_int(array, index,
                                                                self.memo_cast))
 
-    def do_getfield_gc(self, args):
+    def do_getfield_gc(self, args, fielddescr):
         struct = args[0].getptr_base()
-        fielddescr = args[1].getint()
         if self.typefor(fielddescr) == 'ptr':
             return history.BoxPtr(llimpl.do_getfield_gc_ptr(struct,
                                                             fielddescr))
@@ -281,9 +280,8 @@
                                                             fielddescr,
                                                             self.memo_cast))
 
-    def do_getfield_raw(self, args):
+    def do_getfield_raw(self, args, fielddescr):
         struct = self.cast_int_to_adr(args[0].getint())
-        fielddescr = args[1].getint()
         if self.typefor(fielddescr) == 'ptr':
             return history.BoxPtr(llimpl.do_getfield_raw_ptr(struct,
                                                              fielddescr))
@@ -292,71 +290,64 @@
                                                              fielddescr,
                                                              self.memo_cast))
 
-    def do_new(self, args):
-        size = args[0].getint()
+    def do_new(self, args, size):
         return history.BoxPtr(llimpl.do_new(size))
 
-    def do_new_with_vtable(self, args):
-        size = args[0].getint()
-        vtable = args[1].getint()
+    def do_new_with_vtable(self, args, size):
+        vtable = args[0].getint()
         result = llimpl.do_new(size)
         llimpl.do_setfield_gc_int(result, self.fielddescrof_vtable, vtable,
                                   self.memo_cast)
         return history.BoxPtr(result)
 
-    def do_new_array(self, args):
-        size = args[0].getint()
-        count = args[1].getint()
+    def do_new_array(self, args, size):
+        count = args[0].getint()
         return history.BoxPtr(llimpl.do_new_array(size, count))
 
-    def do_setarrayitem_gc(self, args):
+    def do_setarrayitem_gc(self, args, arraydescr):
         array = args[0].getptr_base()
-        arraydescr = args[1].getint()
-        index = args[2].getint()
+        index = args[1].getint()
         if self.typefor(arraydescr) == 'ptr':
-            newvalue = args[3].getptr_base()
+            newvalue = args[2].getptr_base()
             llimpl.do_setarrayitem_gc_ptr(array, index, newvalue)
         else:
-            newvalue = args[3].getint()
+            newvalue = args[2].getint()
             llimpl.do_setarrayitem_gc_int(array, index, newvalue,
                                           self.memo_cast)
 
-    def do_setfield_gc(self, args):
+    def do_setfield_gc(self, args, fielddescr):
         struct = args[0].getptr_base()
-        fielddescr = args[1].getint()
         if self.typefor(fielddescr) == 'ptr':
-            newvalue = args[2].getptr_base()
+            newvalue = args[1].getptr_base()
             llimpl.do_setfield_gc_ptr(struct, fielddescr, newvalue)
         else:
-            newvalue = args[2].getint()
+            newvalue = args[1].getint()
             llimpl.do_setfield_gc_int(struct, fielddescr, newvalue,
                                       self.memo_cast)
 
-    def do_setfield_raw(self, args):
+    def do_setfield_raw(self, args, fielddescr):
         struct = self.cast_int_to_adr(args[0].getint())
-        fielddescr = args[1].getint()
         if self.typefor(fielddescr) == 'ptr':
-            newvalue = args[2].getptr_base()
+            newvalue = args[1].getptr_base()
             llimpl.do_setfield_raw_ptr(struct, fielddescr, newvalue)
         else:
-            newvalue = args[2].getint()
+            newvalue = args[1].getint()
             llimpl.do_setfield_raw_int(struct, fielddescr, newvalue,
                                        self.memo_cast)
 
-    def do_newstr(self, args):
+    def do_newstr(self, args, descr=0):
         length = args[0].getint()
-        return history.BoxPtr(llimpl.do_newstr(length))
+        return history.BoxPtr(llimpl.do_newstr(0, length))
 
-    def do_strsetitem(self, args):
+    def do_strsetitem(self, args, descr=0):
         string = args[0].getptr_base()
         index = args[1].getint()
         newvalue = args[2].getint()
-        llimpl.do_strsetitem(string, index, newvalue)
+        llimpl.do_strsetitem(0, string, index, newvalue)
 
-    def do_call(self, args):
+    def do_call(self, args, calldescr):
         func = args[0].getint()
-        calldescr = args[1].getint()
-        for arg in args[2:]:
+        for arg in args[1:]:
             if (isinstance(arg, history.BoxPtr) or
                 isinstance(arg, history.ConstPtr)):
                 llimpl.do_call_pushptr(arg.getptr_base())

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/test/test_llgraph.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/test/test_llgraph.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/test/test_llgraph.py	Fri Mar  6 18:46:59 2009
@@ -133,25 +133,26 @@
         cpu = CPU(None)
         #
         A = lltype.GcArray(lltype.Char)
-        descrbox_A = ConstInt(cpu.arraydescrof(A))
+        descr_A = cpu.arraydescrof(A)
         a = lltype.malloc(A, 5)
         x = cpu.do_arraylen_gc(
-            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, a)), descrbox_A])
+            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, a))],
+            descr_A)
         assert x.value == 5
         #
         a[2] = 'Y'
         x = cpu.do_getarrayitem_gc(
-            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, a)), descrbox_A,
-             BoxInt(2)])
+            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, a)), BoxInt(2)],
+            descr_A)
         assert x.value == ord('Y')
         #
         B = lltype.GcArray(lltype.Ptr(A))
-        descrbox_B = ConstInt(cpu.arraydescrof(B))
+        descr_B = cpu.arraydescrof(B)
         b = lltype.malloc(B, 4)
         b[3] = a
         x = cpu.do_getarrayitem_gc(
-            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, b)), descrbox_B,
-             BoxInt(3)])
+            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, b)), BoxInt(3)],
+            descr_B)
         assert isinstance(x, BoxPtr)
         assert x.getptr(lltype.Ptr(A)) == a
         #
@@ -170,29 +171,28 @@
         s = lltype.malloc(S)
         s.x = 'Z'
         x = cpu.do_getfield_gc(
-            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, s)),
-             BoxInt(descrfld_x)])
+            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, s))],
+            descrfld_x)
         assert x.value == ord('Z')
         #
         cpu.do_setfield_gc(
             [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, s)),
-             BoxInt(descrfld_x),
-             BoxInt(ord('4'))])
+             BoxInt(ord('4'))],
+            descrfld_x)
         assert s.x == '4'
         #
         descrfld_y = cpu.fielddescrof(S, 'y')
         s.y = a
         x = cpu.do_getfield_gc(
-            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, s)),
-             BoxInt(descrfld_y)])
+            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, s))],
+            descrfld_y)
         assert isinstance(x, BoxPtr)
         assert x.getptr(lltype.Ptr(A)) == a
         #
         s.y = lltype.nullptr(A)
         cpu.do_setfield_gc(
-            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, s)),
-             BoxInt(descrfld_y),
-             x])
+            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, s)), x],
+            descrfld_y)
         assert s.y == a
         #
         RS = lltype.Struct('S', ('x', lltype.Char), ('y', lltype.Ptr(A)))
@@ -200,58 +200,56 @@
         rs = lltype.malloc(RS, immortal=True)
         rs.x = '?'
         x = cpu.do_getfield_raw(
-            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(rs))),
-             BoxInt(descrfld_rx)])
+            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(rs)))],
+            descrfld_rx)
         assert x.value == ord('?')
         #
         cpu.do_setfield_raw(
             [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(rs))),
-             BoxInt(descrfld_rx),
-             BoxInt(ord('!'))])
+             BoxInt(ord('!'))],
+            descrfld_rx)
         assert rs.x == '!'
         #
         descrfld_ry = cpu.fielddescrof(RS, 'y')
         rs.y = a
         x = cpu.do_getfield_raw(
-            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(rs))),
-             BoxInt(descrfld_ry)])
+            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(rs)))],
+            descrfld_ry)
         assert isinstance(x, BoxPtr)
         assert x.getptr(lltype.Ptr(A)) == a
         #
         rs.y = lltype.nullptr(A)
         cpu.do_setfield_raw(
-            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(rs))),
-             BoxInt(descrfld_ry),
-             x])
+            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(rs))), x],
+            descrfld_ry)
         assert rs.y == a
         #
         descrsize = cpu.sizeof(S)
-        x = cpu.do_new(
-            [BoxInt(descrsize)])
+        x = cpu.do_new([], descrsize)
         assert isinstance(x, BoxPtr)
         x.getptr(lltype.Ptr(S))
         #
         descrsize2 = cpu.sizeof(rclass.OBJECT)
         vtable2 = lltype.malloc(rclass.OBJECT_VTABLE, immortal=True)
         x = cpu.do_new_with_vtable(
-            [BoxInt(descrsize2),
-             BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(vtable2)))])
+            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(vtable2)))],
+            descrsize2)
         assert isinstance(x, BoxPtr)
         assert x.getptr(rclass.OBJECTPTR).typeptr == vtable2
         #
         arraydescr = cpu.arraydescrof(A)
-        x = cpu.do_new_array(
-            [BoxInt(arraydescr), BoxInt(7)])
+        x = cpu.do_new_array([BoxInt(7)], arraydescr)
         assert isinstance(x, BoxPtr)
         assert len(x.getptr(lltype.Ptr(A))) == 7
         #
         cpu.do_setarrayitem_gc(
-            [x, descrbox_A, BoxInt(5), BoxInt(ord('*'))])
+            [x, BoxInt(5), BoxInt(ord('*'))], descr_A)
         assert x.getptr(lltype.Ptr(A))[5] == '*'
         #
         cpu.do_setarrayitem_gc(
-            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, b)), descrbox_B,
-             BoxInt(1), x])
+            [BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, b)),
+             BoxInt(1), x],
+            descr_B)
         assert b[1] == x.getptr(lltype.Ptr(A))
         #
         x = cpu.do_newstr([BoxInt(5)])
@@ -272,8 +270,8 @@
         calldescr = cpu.calldescrof([lltype.Char], lltype.Char)
         x = cpu.do_call(
             [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(func_ptr))),
-             ConstInt(calldescr),
-             BoxInt(ord('A'))])
+             BoxInt(ord('A'))],
+            calldescr)
         assert x.value == ord('B')
 
     def test_executor(self):

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	Fri Mar  6 18:46:59 2009
@@ -498,10 +498,10 @@
             # store the vtable as an address -- that's fine, because the
             # GC doesn't need to follow them
             self.emit('new_with_vtable',
-                      self.const_position(self.cpu.sizeof(STRUCT)),
+                      self.cpu.sizeof(STRUCT),
                       self.const_position(vtable))
         else:
-            self.emit('new', self.const_position(self.cpu.sizeof(STRUCT)))
+            self.emit('new', self.cpu.sizeof(STRUCT))
         self.register_var(op.result)
 
     def serialize_op_malloc_varsize(self, op):
@@ -513,7 +513,7 @@
             ARRAY = op.args[0].value
             arraydescr = self.cpu.arraydescrof(ARRAY)
             self.emit('new_array')
-            self.emit(self.const_position(arraydescr))
+            self.emit(arraydescr)
             self.emit(self.var_position(op.args[2]))
         self.register_var(op.result)
 
@@ -540,7 +540,7 @@
         self.emit(self.var_position(v_inst))
         offset = self.cpu.fielddescrof(v_inst.concretetype.TO,
                                        c_fieldname.value)
-        self.emit(self.const_position(offset))
+        self.emit(offset)
         self.register_var(op.result)
         #self._eventualy_builtin(op.result)
 
@@ -558,7 +558,7 @@
         self.emit(self.var_position(v_inst))
         offset = self.cpu.fielddescrof(v_inst.concretetype.TO,
                                        c_fieldname.value)
-        self.emit(self.const_position(offset))
+        self.emit(offset)
         self.emit(self.var_position(v_value))
 
     def is_typeptr_getset(self, op):
@@ -577,7 +577,7 @@
         arraydescr = self.cpu.arraydescrof(ARRAY)
         self.emit('getarrayitem_gc')
         self.emit(self.var_position(op.args[0]))
-        self.emit(self.const_position(arraydescr))
+        self.emit(arraydescr)
         self.emit(self.var_position(op.args[1]))
         self.register_var(op.result)
 
@@ -587,7 +587,7 @@
         arraydescr = self.cpu.arraydescrof(ARRAY)
         self.emit('setarrayitem_gc')
         self.emit(self.var_position(op.args[0]))
-        self.emit(self.const_position(arraydescr))
+        self.emit(arraydescr)
         self.emit(self.var_position(op.args[1]))
         self.emit(self.var_position(op.args[2]))
 
@@ -668,13 +668,12 @@
 
     def handle_residual_call(self, op):
         self.minimize_variables()
-        args = [x for x in op.args[1:] if x.concretetype is not lltype.Void]
+        args = [x for x in op.args if x.concretetype is not lltype.Void]
         argtypes = [v.concretetype for v in args]
         resulttype = op.result.concretetype
         calldescr = self.cpu.calldescrof(argtypes, resulttype)
         self.emit('residual_call_%s' % getkind(resulttype))
-        self.emit(self.var_position(op.args[0]))
-        self.emit(self.const_position(calldescr))
+        self.emit(calldescr)
         self.emit_varargs(args)
         self.register_var(op.result)
 
@@ -720,9 +719,8 @@
             opname = 'residual_call_%s' % getkind(resulttype)
         calldescr = self.cpu.calldescrof(argtypes, resulttype)
         self.emit(opname)
-        self.emit(self.var_position(c_func))
-        self.emit(self.const_position(calldescr))
-        self.emit_varargs(args)
+        self.emit(calldescr)
+        self.emit_varargs([c_func] + args)
         self.register_var(op.result)
 
     def handle_list_call(self, op, oopspec_name, args, TP):
@@ -745,7 +743,7 @@
                     v_default.value != TP.TO.OF._defl()):
                     return False     # variable or non-null initial value
             self.emit('new_array')
-            self.emit(self.const_position(arraydescr))
+            self.emit(arraydescr)
             self.emit(self.var_position(args[0]))
             self.register_var(op.result)
             return True
@@ -764,7 +762,7 @@
                 return False
             self.emit('setarrayitem_gc')
             self.emit(self.var_position(args[0]))
-            self.emit(self.const_position(arraydescr))
+            self.emit(arraydescr)
             self.emit(self.var_position(index))
             self.emit(self.var_position(args[2]))
             self.register_var(op.result)
@@ -774,7 +772,7 @@
             oopspec_name == 'list.len_foldable'):
             self.emit('arraylen_gc')
             self.emit(self.var_position(args[0]))
-            self.emit(self.const_position(arraydescr))
+            self.emit(arraydescr)
             self.register_var(op.result)
             return True
         #
@@ -786,7 +784,7 @@
             return False
         self.emit(opname)
         self.emit(self.var_position(args[0]))
-        self.emit(self.const_position(arraydescr))
+        self.emit(arraydescr)
         self.emit(self.var_position(index))
         self.register_var(op.result)
         return True
@@ -811,7 +809,7 @@
         else:
             self.emit('check_neg_index')
             self.emit(self.var_position(args[0]))
-            self.emit(self.const_position(arraydescr))
+            self.emit(arraydescr)
             self.emit(self.var_position(args[1]))
             v_posindex = Variable('posindex')
             v_posindex.concretetype = lltype.Signed
@@ -853,7 +851,7 @@
             self.emit('guard_nonvirtualized')
             self.emit(self.var_position(op.args[0]))
             self.emit(self.get_position(virtualizabledesc))
-            self.emit(self.const_position(guard_field))
+            self.emit(guard_field)
 
     # ----------
 

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/executor.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/executor.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/executor.py	Fri Mar  6 18:46:59 2009
@@ -13,34 +13,34 @@
 
 # ____________________________________________________________
 
-def do_int_add(cpu, args):
+def do_int_add(cpu, args, descr=0):
     return ConstInt(args[0].getint() + args[1].getint())
 
-def do_int_sub(cpu, args):
+def do_int_sub(cpu, args, descr=0):
     return ConstInt(args[0].getint() - args[1].getint())
 
-def do_int_mul(cpu, args):
+def do_int_mul(cpu, args, descr=0):
     return ConstInt(args[0].getint() * args[1].getint())
 
-def do_int_floordiv(cpu, args):
+def do_int_floordiv(cpu, args, descr=0):
     return ConstInt(args[0].getint() // args[1].getint())
 
-def do_int_mod(cpu, args):
+def do_int_mod(cpu, args, descr=0):
     return ConstInt(args[0].getint() % args[1].getint())
 
-def do_int_and(cpu, args):
+def do_int_and(cpu, args, descr=0):
     return ConstInt(args[0].getint() & args[1].getint())
 
-def do_int_or(cpu, args):
+def do_int_or(cpu, args, descr=0):
     return ConstInt(args[0].getint() | args[1].getint())
 
-def do_int_xor(cpu, args):
+def do_int_xor(cpu, args, descr=0):
     return ConstInt(args[0].getint() ^ args[1].getint())
 
-def do_int_rshift(cpu, args):
+def do_int_rshift(cpu, args, descr=0):
     return ConstInt(args[0].getint() >> args[1].getint())
 
-def do_int_lshift(cpu, args):
+def do_int_lshift(cpu, args, descr=0):
     return ConstInt(args[0].getint() << args[1].getint())
 
 do_uint_add = do_int_add
@@ -49,63 +49,63 @@
 
 # ----------
 
-def do_int_lt(cpu, args):
+def do_int_lt(cpu, args, descr=0):
     return ConstInt(args[0].getint() < args[1].getint())
 
-def do_int_le(cpu, args):
+def do_int_le(cpu, args, descr=0):
     return ConstInt(args[0].getint() <= args[1].getint())
 
-def do_int_eq(cpu, args):
+def do_int_eq(cpu, args, descr=0):
     return ConstInt(args[0].getint() == args[1].getint())
 
-def do_int_ne(cpu, args):
+def do_int_ne(cpu, args, descr=0):
     return ConstInt(args[0].getint() != args[1].getint())
 
-def do_int_gt(cpu, args):
+def do_int_gt(cpu, args, descr=0):
     return ConstInt(args[0].getint() > args[1].getint())
 
-def do_int_ge(cpu, args):
+def do_int_ge(cpu, args, descr=0):
     return ConstInt(args[0].getint() >= args[1].getint())
 
-def do_uint_lt(cpu, args):
+def do_uint_lt(cpu, args, descr=0):
     return ConstInt(r_uint(args[0].getint()) < r_uint(args[1].getint()))
 
-def do_uint_le(cpu, args):
+def do_uint_le(cpu, args, descr=0):
     return ConstInt(r_uint(args[0].getint()) <= r_uint(args[1].getint()))
 
 do_uint_eq = do_int_eq
 do_uint_ne = do_int_ne
 
-def do_uint_gt(cpu, args):
+def do_uint_gt(cpu, args, descr=0):
     return ConstInt(r_uint(args[0].getint()) > r_uint(args[1].getint()))
 
-def do_uint_ge(cpu, args):
+def do_uint_ge(cpu, args, descr=0):
     return ConstInt(r_uint(args[0].getint()) >= r_uint(args[1].getint()))
 
 # ----------
 
-def do_int_is_true(cpu, args):
+def do_int_is_true(cpu, args, descr=0):
     return ConstInt(bool(args[0].getint()))
 
-def do_int_neg(cpu, args):
+def do_int_neg(cpu, args, descr=0):
     return ConstInt(-args[0].getint())
 
-def do_int_invert(cpu, args):
+def do_int_invert(cpu, args, descr=0):
     return ConstInt(~args[0].getint())
 
-def do_bool_not(cpu, args):
+def do_bool_not(cpu, args, descr=0):
     return ConstInt(not args[0].getint())
 
-def do_oononnull(cpu, args):
+def do_oononnull(cpu, args, descr=0):
     return ConstInt(bool(args[0].getptr_base()))
 
-def do_ooisnull(cpu, args):
+def do_ooisnull(cpu, args, descr=0):
     return ConstInt(not args[0].getptr_base())
 
-def do_oois(cpu, args):
+def do_oois(cpu, args, descr=0):
     return ConstInt(args[0].getptr_base() == args[1].getptr_base())
 
-def do_ooisnot(cpu, args):
+def do_ooisnot(cpu, args, descr=0):
     return ConstInt(args[0].getptr_base() != args[1].getptr_base())
 
 # ----------
@@ -129,7 +129,7 @@
 
 # ----------
 
-def do_int_add_ovf(cpu, args):
+def do_int_add_ovf(cpu, args, descr=0):
     x = args[0].getint()
     y = args[1].getint()
     try:
@@ -139,7 +139,7 @@
         z = 0
     return BoxInt(z)
 
-def do_int_sub_ovf(cpu, args):
+def do_int_sub_ovf(cpu, args, descr=0):
     x = args[0].getint()
     y = args[1].getint()
     try:
@@ -149,7 +149,7 @@
         z = 0
     return BoxInt(z)
 
-def do_int_mul_ovf(cpu, args):
+def do_int_mul_ovf(cpu, args, descr=0):
     x = args[0].getint()
     y = args[1].getint()
     try:
@@ -159,7 +159,7 @@
         z = 0
     return BoxInt(z)
 
-def do_int_neg_ovf(cpu, args):
+def do_int_neg_ovf(cpu, args, descr=0):
     x = args[0].getint()
     try:
         z = ovfcheck(-x)
@@ -168,7 +168,7 @@
         z = 0
     return BoxInt(z)
 
-def do_int_mod_ovf(cpu, args):
+def do_int_mod_ovf(cpu, args, descr=0):
     x = args[0].getint()
     y = args[1].getint()
     try:
@@ -206,7 +206,7 @@
     return cpu._execute_list[opnum]
 get_execute_function._annspecialcase_ = 'specialize:memo'
 
-def execute(cpu, opnum, argboxes):
+def execute(cpu, opnum, argboxes, descr=0):
     func = get_execute_function(cpu, opnum)
-    return func(cpu, argboxes)
+    return func(cpu, argboxes, descr)
 execute._annspecialcase_ = 'specialize:arg(1)'

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py	Fri Mar  6 18:46:59 2009
@@ -366,13 +366,13 @@
         self.operations = []
 
 class History(RunningMatcher):
-    def record(self, opnum, argboxes, resbox):
-        op = ResOperation(opnum, argboxes, resbox)
+    def record(self, opnum, argboxes, resbox, descr=0):
+        op = ResOperation(opnum, argboxes, resbox, descr)
         self.operations.append(op)
         return op
 
 class BlackHole(RunningMatcher):
-    def record(self, opnum, argboxes, resbox):
+    def record(self, opnum, argboxes, resbox, descr=0):
         return None
 
 def mp_eq(greenkey1, greenkey2):

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	Fri Mar  6 18:46:59 2009
@@ -67,7 +67,7 @@
                 ld = instnode.cls.source
                 assert isinstance(ld, FixedList)
                 alloc_offset = len(self.list_allocations)
-                ad = ConstInt(ld.arraydescr)
+                ad = ld.arraydescr
                 if instnode.cursize == -1:
                     # fish fish fish
                     instnode.cursize = executor.execute(cpu, rop.ARRAYLEN_GC,
@@ -87,7 +87,7 @@
                     ld = instnode.cls.source
                     x = (alloc_offset + 1) << 16
                     assert isinstance(ld, FixedList)
-                    self.setitems.append((x, ConstInt(ld.arraydescr), ofs, num))
+                    self.setitems.append((x, ld.arraydescr, ofs, num))
                 else:
                     self.setfields.append((alloc_offset, ofs, num))
         elif virtualized:
@@ -313,8 +313,8 @@
     def find_nodes_getarrayitem(self, op):
         instnode = self.getnode(op.args[0])
         if instnode.cls is None:
-            instnode.cls = InstanceNode(FixedList(op.args[1].getint()))
-        fieldbox = op.args[2]
+            instnode.cls = InstanceNode(FixedList(op.descr))
+        fieldbox = op.args[1]
         if self.getnode(fieldbox).const:
             item = self.getsource(fieldbox).getint()
             assert item >= 0 # XXX
@@ -348,17 +348,17 @@
             elif opnum == rop.NEW_WITH_VTABLE:
                 box = op.result
                 instnode = InstanceNode(box, escaped=False)
-                instnode.cls = InstanceNode(op.args[1], const=True)
+                instnode.cls = InstanceNode(op.args[0], const=True)
                 self.nodes[box] = instnode
                 self.first_escaping_op = False
                 continue
             elif opnum == rop.NEW_ARRAY:
                 box = op.result
                 instnode = InstanceNode(box, escaped=False)
-                instnode.cls = InstanceNode(FixedList(op.args[0].getint()))
+                instnode.cls = InstanceNode(FixedList(op.descr))
                 self.nodes[box] = instnode
-                if self.getnode(op.args[1]).const:
-                    instnode.cursize = op.args[1].getint()
+                if self.getnode(op.args[0]).const:
+                    instnode.cursize = op.args[0].getint()
                 else:
                     instnode.escaped = True
                 continue
@@ -393,45 +393,39 @@
                 continue
             elif opnum == rop.GETARRAYITEM_GC_PURE:
                 instnode = self.getnode(op.args[0])
-                if not instnode.const or not self.getnode(op.args[2]).const:
+                if not instnode.const or not self.getnode(op.args[1]).const:
                     self.find_nodes_getarrayitem(op)
                     continue
             elif opnum == rop.SETARRAYITEM_GC:
                 instnode = self.getnode(op.args[0])
                 if instnode.cls is None:
-                    instnode.cls = InstanceNode(FixedList(op.args[1].getint()))
-                fieldbox = op.args[2]
+                    instnode.cls = InstanceNode(FixedList(op.descr))
+                fieldbox = op.args[1]
                 if self.getnode(fieldbox).const:
                     item = self.getsource(fieldbox).getint()
                     assert item >= 0 # XXX
                     self.find_nodes_setfield(instnode, item,
-                                             self.getnode(op.args[3]))
+                                             self.getnode(op.args[2]))
                 else:
                     instnode.escaped = True
                     self.dependency_graph.append((instnode,
-                                                 self.getnode(op.args[3])))
+                                                 self.getnode(op.args[2])))
                 continue
             elif opnum == rop.SETFIELD_GC:
                 instnode = self.getnode(op.args[0])
-                fieldbox = op.args[1]
-                assert isinstance(fieldbox, ConstInt)
-                field = fieldbox.getint()
+                field = op.descr
                 self.find_nodes_setfield(instnode, field,
-                                         self.getnode(op.args[2]))
+                                         self.getnode(op.args[1]))
                 continue
             elif opnum == rop.GETFIELD_GC:
                 instnode = self.getnode(op.args[0])
-                fieldbox = op.args[1]
-                assert isinstance(fieldbox, ConstInt)
-                field = fieldbox.getint()
+                field = op.descr
                 box = op.result
                 self.find_nodes_getfield(instnode, field, box)
                 continue
             elif opnum == rop.GETFIELD_GC_PURE:
                 instnode = self.getnode(op.args[0])
-                fieldbox = op.args[1]
-                assert isinstance(fieldbox, ConstInt)
-                field = fieldbox.getint()
+                field = op.descr
                 if not instnode.const:
                     box = op.result
                     self.find_nodes_getfield(instnode, field, box)
@@ -631,7 +625,7 @@
                     isinstance(node.cls.source, FixedList)):
                     ld = node.cls.source
                     assert isinstance(ld, FixedList)
-                    ad = ConstInt(ld.arraydescr)
+                    ad = ld.arraydescr
                     storage.setitems.append((index, ad, ofs, fieldindex))
                 else:
                     storage.setfields.append((index, ofs, fieldindex))
@@ -788,27 +782,25 @@
                 continue
             elif opnum == rop.GETFIELD_GC:
                 instnode = self.nodes[op.args[0]]
-                ofs = op.args[1].getint()
-                if self.optimize_getfield(instnode, ofs, op.result):
+                if self.optimize_getfield(instnode, op.descr, op.result):
                     continue
                 # otherwise we need this getfield, but it does not
                 # invalidate caches
             elif opnum == rop.GETFIELD_GC_PURE:
                 instnode = self.nodes[op.args[0]]
                 if not instnode.const:
-                    ofs = op.args[1].getint()
-                    if self.optimize_getfield(instnode, ofs, op.result):
+                    if self.optimize_getfield(instnode, op.descr, op.result):
                         continue
             elif opnum == rop.GETARRAYITEM_GC:
                 instnode = self.nodes[op.args[0]]
-                ofsbox = self.getsource(op.args[2])
+                ofsbox = self.getsource(op.args[1])
                 if isinstance(ofsbox, ConstInt):
                     ofs = ofsbox.getint()
                     if self.optimize_getfield(instnode, ofs, op.result):
                         continue
             elif opnum == rop.GETARRAYITEM_GC_PURE:
                 instnode = self.nodes[op.args[0]]
-                ofsbox = self.getsource(op.args[2])
+                ofsbox = self.getsource(op.args[1])
                 if not instnode.const:
                     if isinstance(ofsbox, ConstInt):
                         ofs = ofsbox.getint()
@@ -833,7 +825,7 @@
                 instnode = self.nodes[op.result]
                 if not instnode.escaped:
                     instnode.virtual = True
-                    instnode.cursize = op.args[1].getint()
+                    instnode.cursize = op.args[0].getint()
                     continue
 ##            elif opname == 'newlist':
 ##                instnode = self.nodes[op.results[0]]
@@ -877,19 +869,19 @@
 ##                    continue
             elif opnum == rop.SETFIELD_GC:
                 instnode = self.nodes[op.args[0]]
-                valuenode = self.nodes[op.args[2]]
-                ofs = op.args[1].getint()
-                self.optimize_setfield(instnode, ofs, valuenode, op.args[2])
+                valuenode = self.nodes[op.args[1]]
+                ofs = op.descr
+                self.optimize_setfield(instnode, ofs, valuenode, op.args[1])
                 continue
             elif opnum == rop.SETARRAYITEM_GC:
                 instnode = self.nodes[op.args[0]]
                 if instnode.cls is None:
-                    instnode.cls = InstanceNode(FixedList(op.args[1].getint()))
-                ofsbox = self.getsource(op.args[2])
+                    instnode.cls = InstanceNode(FixedList(op.descr))
+                ofsbox = self.getsource(op.args[1])
                 if isinstance(ofsbox, ConstInt):
                     ofs = ofsbox.getint()
-                    valuenode = self.getnode(op.args[3])
-                    self.optimize_setfield(instnode, ofs, valuenode, op.args[3])
+                    valuenode = self.getnode(op.args[2])
+                    self.optimize_setfield(instnode, ofs, valuenode, op.args[2])
                     continue
 ##            elif opname == 'setitem':
 ##                instnode = self.nodes[op.args[1]]
@@ -966,13 +958,12 @@
                     isinstance(node.cls.source, FixedList)):
                     ld = node.cls.source
                     assert isinstance(ld, FixedList)
-                    ad = ConstInt(ld.arraydescr)
                     newoperations.append(ResOperation(rop.SETARRAYITEM_GC,
-                         [node.source, ad, ConstInt(ofs), valuenode.source],
-                                                      None))
+                         [node.source, ConstInt(ofs), valuenode.source],
+                                                      None, ld.arraydescr))
                 else:
                     newoperations.append(ResOperation(rop.SETFIELD_GC,
-                       [node.source, ConstInt(ofs), valuenode.source], None))
+                       [node.source, valuenode.source], None, ofs))
             node.dirtyfields = {}
             node.cleanfields = {}
 
@@ -1023,17 +1014,17 @@
     for vtable in storage.allocations:
         if metainterp.cpu.translate_support_code:
             vtable_addr = metainterp.cpu.cast_int_to_adr(vtable)
-            sizebox = ConstInt(metainterp.class_sizes[vtable_addr])
+            size = metainterp.class_sizes[vtable_addr]
         else:
-            sizebox = ConstInt(metainterp.class_sizes[vtable])
+            size = metainterp.class_sizes[vtable]
         vtablebox = ConstInt(vtable)
         instbox = metainterp.execute_and_record(rop.NEW_WITH_VTABLE,
-                                                [sizebox, vtablebox])
+                                                [vtablebox], size)
         allocated_boxes.append(instbox)
     for ad, lgt in storage.list_allocations:
         sizebox = ConstInt(lgt)
         listbox = metainterp.execute_and_record(rop.NEW_ARRAY,
-                                                [ad, sizebox])
+                                                [sizebox], ad)
         allocated_lists.append(listbox)
     for index_in_alloc, ofs, index_in_arglist in storage.setfields:
         fieldbox = box_from_index(allocated_boxes, allocated_lists,
@@ -1042,14 +1033,14 @@
                              boxes_from_frame,
                              index_in_alloc)
         metainterp.execute_and_record(rop.SETFIELD_GC,
-                                      [box, ConstInt(ofs), fieldbox])
+                                      [box, fieldbox], ofs)
     for index_in_alloc, ad, ofs, index_in_arglist in storage.setitems:
         itembox = box_from_index(allocated_boxes, allocated_lists,
                                  boxes_from_frame, index_in_arglist)
         box = box_from_index(allocated_boxes, allocated_lists,
                              boxes_from_frame, index_in_alloc)
         metainterp.execute_and_record(rop.SETARRAYITEM_GC,
-                                      [box, ad, ConstInt(ofs), itembox])
+                                      [box, ConstInt(ofs), itembox], ad)
 ##    if storage.setitems:
 ##        #history.execute_and_record('guard_no_exception', [], 'void', False)
 ##        # XXX this needs to check for exceptions somehow

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	Fri Mar  6 18:46:59 2009
@@ -310,37 +310,38 @@
         except KeyError:
             pass
 
-    @arguments("constbox")
-    def opimpl_new(self, sizebox):
-        self.execute(rop.NEW, [sizebox])
-
-    @arguments("constbox", "constbox")
-    def opimpl_new_with_vtable(self, sizebox, vtablebox):
-        self.execute(rop.NEW_WITH_VTABLE, [sizebox, vtablebox])
-
-    @arguments("constbox", "box")
-    def opimpl_new_array(self, itemsizebox, countbox):
-        self.execute(rop.NEW_ARRAY, [itemsizebox, countbox])
+    @arguments("int")
+    def opimpl_new(self, size):
+        self.execute(rop.NEW, [], descr=size)
+
+    @arguments("int", "constbox")
+    def opimpl_new_with_vtable(self, size, vtablebox):
+        self.execute(rop.NEW_WITH_VTABLE, [vtablebox], descr=size)
+
+    @arguments("int", "box")
+    def opimpl_new_array(self, itemsize, countbox):
+        self.execute(rop.NEW_ARRAY, [countbox], descr=itemsize)
 
-    @arguments("box", "constbox", "box")
+    @arguments("box", "int", "box")
     def opimpl_getarrayitem_gc(self, arraybox, arraydesc, indexbox):
-        self.execute(rop.GETARRAYITEM_GC, [arraybox, arraydesc, indexbox])
+        self.execute(rop.GETARRAYITEM_GC, [arraybox, indexbox],
+                     descr=arraydesc)
 
-    @arguments("box", "constbox", "box")
+    @arguments("box", "int", "box")
     def opimpl_getarrayitem_gc_pure(self, arraybox, arraydesc, indexbox):
-        self.execute(rop.GETARRAYITEM_GC_PURE,
-                     [arraybox, arraydesc, indexbox])
+        self.execute(rop.GETARRAYITEM_GC_PURE, [arraybox, indexbox],
+                     descr=arraydesc)
 
-    @arguments("box", "constbox", "box", "box")
+    @arguments("box", "int", "box", "box")
     def opimpl_setarrayitem_gc(self, arraybox, arraydesc, indexbox, itembox):
-        self.execute(rop.SETARRAYITEM_GC, [arraybox, arraydesc,
-                                           indexbox, itembox])
+        self.execute(rop.SETARRAYITEM_GC, [arraybox, indexbox, itembox],
+                     descr=arraydesc)
 
-    @arguments("box", "constbox")
+    @arguments("box", "int")
     def opimpl_arraylen_gc(self, arraybox, arraydesc):
-        self.execute(rop.ARRAYLEN_GC, [arraybox, arraydesc])
+        self.execute(rop.ARRAYLEN_GC, [arraybox], descr=arraydesc)
 
-    @arguments("orgpc", "box", "constbox", "box")
+    @arguments("orgpc", "box", "int", "box")
     def opimpl_check_neg_index(self, pc, arraybox, arraydesc, indexbox):
         negbox = self.metainterp.execute_and_record(
             rop.INT_LT, [indexbox, ConstInt(0)])
@@ -348,7 +349,7 @@
         if negbox.getint():
             # the index is < 0; add the array length to it
             lenbox = self.metainterp.execute_and_record(
-                rop.ARRAYLEN_GC, [arraybox, arraydesc])
+                rop.ARRAYLEN_GC, [arraybox], descr=arraydesc)
             indexbox = self.metainterp.execute_and_record(
                 rop.INT_ADD, [indexbox, lenbox])
         self.make_result_box(indexbox)
@@ -370,25 +371,25 @@
         self.execute(rop.OOISNOT, [box1, box2])
 
 
-    @arguments("box", "constbox")
+    @arguments("box", "int")
     def opimpl_getfield_gc(self, box, fielddesc):
-        self.execute(rop.GETFIELD_GC, [box, fielddesc])
-    @arguments("box", "constbox")
+        self.execute(rop.GETFIELD_GC, [box], descr=fielddesc)
+    @arguments("box", "int")
     def opimpl_getfield_gc_pure(self, box, fielddesc):
-        self.execute(rop.GETFIELD_GC_PURE, [box, fielddesc])
-    @arguments("box", "constbox", "box")
+        self.execute(rop.GETFIELD_GC_PURE, [box], descr=fielddesc)
+    @arguments("box", "int", "box")
     def opimpl_setfield_gc(self, box, fielddesc, valuebox):
-        self.execute(rop.SETFIELD_GC, [box, fielddesc, valuebox])
+        self.execute(rop.SETFIELD_GC, [box, valuebox], descr=fielddesc)
 
-    @arguments("box", "constbox")
+    @arguments("box", "int")
     def opimpl_getfield_raw(self, box, fielddesc):
-        self.execute(rop.GETFIELD_RAW, [box, fielddesc])
-    @arguments("box", "constbox")
+        self.execute(rop.GETFIELD_RAW, [box], descr=fielddesc)
+    @arguments("box", "int")
     def opimpl_getfield_raw_pure(self, box, fielddesc):
-        self.execute(rop.GETFIELD_RAW_PURE, [box, fielddesc])
-    @arguments("box", "constbox", "box")
+        self.execute(rop.GETFIELD_RAW_PURE, [box], descr=fielddesc)
+    @arguments("box", "int", "box")
     def opimpl_setfield_raw(self, box, fielddesc, valuebox):
-        self.execute(rop.SETFIELD_RAW, [box, fielddesc, valuebox])
+        self.execute(rop.SETFIELD_RAW, [box, valuebox], descr=fielddesc)
 
     @arguments("bytecode", "varargs")
     def opimpl_call(self, callee, varargs):
@@ -396,25 +397,24 @@
         f.setup_call(varargs)
         return True
 
-    @arguments("box", "constbox", "varargs")
-    def opimpl_residual_call_int(self, funcbox, calldescr, varargs):
-        args = [funcbox, calldescr] + varargs
-        return self.execute_with_exc(rop.CALL, args, returnsBoxInt)
-
-    @arguments("box", "constbox", "varargs")
-    def opimpl_residual_call_ptr(self, funcbox, calldescr, varargs):
-        args = [funcbox, calldescr] + varargs
-        return self.execute_with_exc(rop.CALL, args, returnsBoxPtr)
-
-    @arguments("box", "constbox", "varargs")
-    def opimpl_residual_call_void(self, funcbox, calldescr, varargs):
-        args = [funcbox, calldescr] + varargs
-        return self.execute_with_exc(rop.CALL, args, returnsNone)
-
-    @arguments("box", "constbox", "varargs")
-    def opimpl_residual_call_pure(self, funcbox, calldescr, varargs):
-        args = [funcbox, calldescr] + varargs
-        self.execute(rop.CALL_PURE, args)
+    @arguments("int", "varargs")
+    def opimpl_residual_call_int(self, calldescr, varargs):
+        return self.execute_with_exc(rop.CALL, varargs, returnsBoxInt,
+                                     descr=calldescr)
+
+    @arguments("int", "varargs")
+    def opimpl_residual_call_ptr(self, calldescr, varargs):
+        return self.execute_with_exc(rop.CALL, varargs, returnsBoxPtr,
+                                     descr=calldescr)
+
+    @arguments("int", "varargs")
+    def opimpl_residual_call_void(self, calldescr, varargs):
+        return self.execute_with_exc(rop.CALL, varargs, returnsNone,
+                                     descr=calldescr)
+
+    @arguments("int", "varargs")
+    def opimpl_residual_call_pure(self, calldescr, varargs):
+        self.execute(rop.CALL_PURE, varargs, descr=calldescr)
 
 ##    @arguments("fixedlist", "box", "box")
 ##    def opimpl_list_getitem(self, descr, listbox, indexbox):
@@ -513,13 +513,14 @@
 ##            'len', [builtin.len_func, box], 'int')
 ##        self.generate_guard(pc, "guard_len", box, [intbox])
 
-    @arguments("orgpc", "box", "virtualizabledesc", "constbox")
+    @arguments("orgpc", "box", "virtualizabledesc", "int")
     def opimpl_guard_nonvirtualized(self, pc, box, vdesc, guard_field):
         clsbox = self.cls_of_box(box)
         op = self.generate_guard(pc, rop.GUARD_NONVIRTUALIZED, box,
-                                 [clsbox, guard_field])
+                                 [clsbox])
         if op:
             op.vdesc = vdesc
+            op.descr = guard_field
         
     @arguments("box")
     def opimpl_keepalive(self, box):
@@ -653,15 +654,16 @@
         cls = llmemory.cast_ptr_to_adr(obj.typeptr)
         return ConstInt(self.metainterp.cpu.cast_adr_to_int(cls))
 
-    def execute(self, opnum, argboxes):
-        resbox = self.metainterp.execute_and_record(opnum, argboxes)
+    def execute(self, opnum, argboxes, descr=0):
+        resbox = self.metainterp.execute_and_record(opnum, argboxes, descr)
         if resbox is not None:
             self.make_result_box(resbox)
     execute._annspecialcase_ = 'specialize:arg(1)'
 
-    def execute_with_exc(self, opnum, argboxes, makeresbox):
+    def execute_with_exc(self, opnum, argboxes, makeresbox, descr=0):
         try:
-            resbox = executor.execute(self.metainterp.cpu, opnum, argboxes)
+            resbox = executor.execute(self.metainterp.cpu, opnum, argboxes,
+                                      descr)
         except Exception, e:
             if not we_are_translated():
                 if not isinstance(e, LLException):
@@ -678,7 +680,7 @@
             etype = lltype.nullptr(rclass.OBJECT_VTABLE)
             evalue = lltype.nullptr(rclass.OBJECT)
         # record the operation in the history
-        self.metainterp.history.record(opnum, argboxes, resbox)
+        self.metainterp.history.record(opnum, argboxes, resbox, descr)
         if resbox is not None:
             self.make_result_box(resbox)
         type_as_int = self.metainterp.cpu.cast_adr_to_int(
@@ -765,9 +767,9 @@
                 return False
         return True
 
-    def execute_and_record(self, opnum, argboxes):
+    def execute_and_record(self, opnum, argboxes, descr=0):
         # execute the operation first
-        resbox = executor.execute(self.cpu, opnum, argboxes)
+        resbox = executor.execute(self.cpu, opnum, argboxes, descr)
         # check if the operation can be constant-folded away
         canfold = False
         if rop._ALWAYS_PURE_FIRST <= opnum <= rop._ALWAYS_PURE_LAST:
@@ -782,7 +784,7 @@
             assert resbox is None or isinstance(resbox, Box)
         # record the operation if not constant-folded away
         if not canfold:
-            self.history.record(opnum, argboxes, resbox)
+            self.history.record(opnum, argboxes, resbox, descr)
         return resbox
     execute_and_record._annspecialcase_ = 'specialize:arg(1)'
 

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/resoperation.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/resoperation.py	Fri Mar  6 18:46:59 2009
@@ -17,12 +17,16 @@
     # for 'guard_nonvirtualizable'
     vdesc = None
 
-    def __init__(self, opnum, args, result):
+    def __init__(self, opnum, args, result, descr=0):
         assert isinstance(opnum, int)
         self.opnum = opnum
         self.args = list(args)
         assert not isinstance(result, list)
         self.result = result
+        # for 'call', 'new', 'getfield_gc'...: the descr is a number provided
+        # by the backend holding details about the type of the operation
+        assert isinstance(descr, int)
+        self.descr = descr
 
     def __repr__(self):
         if self.result is not None:
@@ -36,7 +40,7 @@
         return result
 
     def clone(self):
-        op = ResOperation(self.opnum, self.args, self.result)
+        op = ResOperation(self.opnum, self.args, self.result, self.descr)
         op.specnodes = self.specnodes
         op.key = self.key
         return op

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/specnode.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/specnode.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/specnode.py	Fri Mar  6 18:46:59 2009
@@ -127,7 +127,7 @@
     def extract_runtime_data(self, cpu, valuebox, resultlist):
         for ofs, subspecnode in self.fields:
             fieldbox = executor.execute(cpu, rop.GETFIELD_GC,
-                                        [valuebox, ConstInt(ofs)])
+                                        [valuebox], ofs)
             subspecnode.extract_runtime_data(cpu, fieldbox, resultlist)
 
     def adapt_to(self, instnode):
@@ -163,7 +163,7 @@
                 else:
                     box = subspecnode.box.clonebox()
                     oplist.append(ResOperation(rop.GETFIELD_GC,
-                       [instnode.source, ConstInt(ofs)], box))
+                       [instnode.source], box, ofs))
                     newboxlist.append(box)
 
 class DelayedFixedListSpecNode(DelayedSpecNode):
@@ -176,7 +176,7 @@
        newboxlist.append(instnode.source)
        cls = self.known_class
        assert isinstance(cls, FixedList)
-       ad = ConstInt(cls.arraydescr)
+       arraydescr = cls.arraydescr
        for ofs, subspecnode in self.fields:
            assert isinstance(subspecnode, SpecNodeWithBox)
            if oplist is None:
@@ -188,7 +188,7 @@
                else:
                    box = subspecnode.box.clonebox()
                    oplist.append(ResOperation(rop.GETARRAYITEM_GC,
-                      [instnode.source, ad, ConstInt(ofs)], box))
+                      [instnode.source, ConstInt(ofs)], box, arraydescr))
                    newboxlist.append(box)
 
    def extract_runtime_data(self, cpu, valuebox, resultlist):
@@ -199,10 +199,9 @@
        cls = self.known_class
        assert isinstance(cls, FixedList)
        arraydescr = cls.arraydescr
-       ad = ConstInt(arraydescr)
        for ofs, subspecnode in self.fields:
            fieldbox = executor.execute(cpu, rop.GETARRAYITEM_GC,
-                                       [valuebox, ad, ConstInt(ofs)])
+                                       [valuebox, ConstInt(ofs)], arraydescr)
            subspecnode.extract_runtime_data(cpu, fieldbox, resultlist)
 
 class VirtualizableSpecNode(VirtualizedSpecNode):
@@ -248,7 +247,7 @@
        for ofs, subspecnode in self.fields:
            cls = self.known_class
            assert isinstance(cls, FixedList)
-           ad = ConstInt(cls.arraydescr)
+           arraydescr = cls.arraydescr
            fieldbox = executor.execute(cpu, rop.GETARRAYITEM_GC,
-                                       [valuebox, ad, ConstInt(ofs)])
+                                       [valuebox, ConstInt(ofs)], arraydescr)
            subspecnode.extract_runtime_data(cpu, fieldbox, resultlist)

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_list_optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_list_optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_list_optimize.py	Fri Mar  6 18:46:59 2009
@@ -18,13 +18,13 @@
     l = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, lst))
     e0 = BoxInt(0)
     e1 = BoxInt(0)
-    ad = ConstInt(cpu.arraydescrof(TP))
+    ad = cpu.arraydescrof(TP)
     ops = [
         ResOperation(rop.MERGE_POINT, [l], None),
-        ResOperation(rop.GETARRAYITEM_GC, [l, ad, ConstInt(0)], e0),
-        ResOperation(rop.SETARRAYITEM_GC, [l, ad, ConstInt(0), e0], None),
-        ResOperation(rop.GETARRAYITEM_GC, [l, ad, ConstInt(0)], e1),
-        ResOperation(rop.SETARRAYITEM_GC, [l, ad, ConstInt(0), e1], None),
+        ResOperation(rop.GETARRAYITEM_GC, [l, ConstInt(0)], e0, ad),
+        ResOperation(rop.SETARRAYITEM_GC, [l, ConstInt(0), e0], None, ad),
+        ResOperation(rop.GETARRAYITEM_GC, [l, ConstInt(0)], e1, ad),
+        ResOperation(rop.SETARRAYITEM_GC, [l, ConstInt(0), e1], None, ad),
         ResOperation(rop.JUMP, [l], None),
         ]
 
@@ -48,7 +48,7 @@
     spec.optimize_loop(None)
     equaloplists(spec.loop.operations, [
         ResOperation(rop.MERGE_POINT, [A.l, A.e0], None),
-        ResOperation(rop.SETARRAYITEM_GC, [A.l, A.ad, ConstInt(0), A.e0], None),
+        ResOperation(rop.SETARRAYITEM_GC, [A.l, ConstInt(0), A.e0], None, A.ad),
         ResOperation(rop.JUMP, [A.l, A.e0], None)
     ])
 
@@ -60,13 +60,13 @@
     e3 = BoxInt(0)
     ops = [
         ResOperation(rop.MERGE_POINT, [l], None),
-        ResOperation(rop.GETARRAYITEM_GC, [l, ad, ConstInt(0)], e0),
+        ResOperation(rop.GETARRAYITEM_GC, [l, ConstInt(0)], e0, ad),
         ResOperation(rop.INT_ADD, [e0, ConstInt(1)], e1),
-        ResOperation(rop.SETARRAYITEM_GC, [l, ad, ConstInt(0), e1], None),
+        ResOperation(rop.SETARRAYITEM_GC, [l, ConstInt(0), e1], None, ad),
         ResOperation(-123, [e1], None),
-        ResOperation(rop.GETARRAYITEM_GC, [l, ad, ConstInt(0)], e2),
+        ResOperation(rop.GETARRAYITEM_GC, [l, ConstInt(0)], e2, ad),
         ResOperation(rop.INT_ADD, [e2, ConstInt(1)], e3),
-        ResOperation(rop.SETARRAYITEM_GC, [l, ad, ConstInt(0), e3], None),
+        ResOperation(rop.SETARRAYITEM_GC, [l, ConstInt(0), e3], None, ad),
         ResOperation(rop.JUMP, [l], None),
     ]
 
@@ -78,11 +78,11 @@
     equaloplists(spec.loop.operations, [
         ResOperation(rop.MERGE_POINT, [B.l, B.e0], None),
         ResOperation(rop.INT_ADD, [B.e0, ConstInt(1)], B.e1),
-        ResOperation(rop.SETARRAYITEM_GC, [B.l, B.ad, ConstInt(0), B.e1], None),
+        ResOperation(rop.SETARRAYITEM_GC, [B.l, ConstInt(0), B.e1], None, B.ad),
         ResOperation(-123, [B.e1], None),
-        ResOperation(rop.GETARRAYITEM_GC, [B.l, B.ad, ConstInt(0)], B.e2),
+        ResOperation(rop.GETARRAYITEM_GC, [B.l, ConstInt(0)], B.e2, B.ad),
         ResOperation(rop.INT_ADD, [B.e2, ConstInt(1)], B.e3),
-        ResOperation(rop.SETARRAYITEM_GC, [B.l, B.ad, ConstInt(0), B.e3], None),
+        ResOperation(rop.SETARRAYITEM_GC, [B.l, ConstInt(0), B.e3], None, B.ad),
         ResOperation(rop.JUMP, [B.l, B.e3], None),
     ])
 
@@ -94,13 +94,13 @@
     e2 = BoxInt(0)
     ops = [
         ResOperation(rop.MERGE_POINT, [l], None),
-        ResOperation(rop.GETARRAYITEM_GC, [l, ad, ConstInt(0)], e0),
+        ResOperation(rop.GETARRAYITEM_GC, [l, ConstInt(0)], e0, ad),
         ResOperation(rop.INT_ADD, [e0, ConstInt(1)], e1),
-        ResOperation(rop.SETARRAYITEM_GC, [l, ad, ConstInt(0), e1], None),
+        ResOperation(rop.SETARRAYITEM_GC, [l, ConstInt(0), e1], None, ad),
         ResOperation(-123, [e1], None),
-        ResOperation(rop.GETARRAYITEM_GC, [l, ad, ConstInt(0)], e2),
+        ResOperation(rop.GETARRAYITEM_GC, [l, ConstInt(0)], e2, ad),
         ResOperation(rop.INT_ADD, [e2, ConstInt(1)], e3),
-        ResOperation(rop.SETARRAYITEM_GC, [l, ad, ConstInt(0), e3], None),
+        ResOperation(rop.SETARRAYITEM_GC, [l, ConstInt(0), e3], None, ad),
         ResOperation(rop.JUMP, [l], None),
     ]
     

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	Fri Mar  6 18:46:59 2009
@@ -63,18 +63,19 @@
         for x, y in zip(op1.args, op2.args):
             assert x == y or y == x     # for ANY object :-(
         assert op1.result == op2.result
+        assert op1.descr == op2.descr
     assert len(oplist1) == len(oplist2)
     print '-'*57
     #finally:
     #    Box._extended_display = saved
     return True
 
-def ResOperation(opname, args, result):
+def ResOperation(opname, args, result, descr=0):
     if opname == 'escape':
         opnum = -123       # random number not in the list
     else:
         opnum = getattr(rop, opname.upper())
-    return resoperation.ResOperation(opnum, args, result)
+    return resoperation.ResOperation(opnum, args, result, descr)
 
 # ____________________________________________________________
 
@@ -82,7 +83,6 @@
     ofs_next = runner.CPU.fielddescrof(NODE, 'next')
     ofs_value = runner.CPU.fielddescrof(NODE, 'value')
     size_of_node = runner.CPU.sizeof(NODE)
-    sizebox = ConstInt(size_of_node)
     #
     startnode = lltype.malloc(NODE)
     startnode.value = 20
@@ -97,14 +97,13 @@
     sum2 = BoxInt(0 + startnode.value)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
         ResOperation('int_add', [sum, v], sum2),
-        ResOperation('new_with_vtable', [sizebox,
-                                         ConstAddr(node_vtable, cpu)], n2),
-        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, v2], None, ofs_value),
         ResOperation('jump', [sum2, n2], None),
         ]
 
@@ -148,15 +147,14 @@
     locals().update(A.__dict__)    # :-)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
         ResOperation('escape', [n1], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         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', [n2, ConstInt(ofs_value), v2], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, v2], None, ofs_value),
         ResOperation('escape', [n2], None),    # <== escaping
         ResOperation('jump', [sum2, n2], None),
         ]
@@ -188,13 +186,12 @@
         ResOperation('merge_point', [B.sum, B.n1], None),
         # guard_class is gone
         ResOperation('escape', [B.n1], None),
-        ResOperation('getfield_gc', [B.n1, ConstInt(B.ofs_value)], B.v),
+        ResOperation('getfield_gc', [B.n1], B.v, B.ofs_value),
         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', [B.n2, ConstInt(B.ofs_value), B.v2],
-                                       None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], B.n2,
+                     B.size_of_node),
+        ResOperation('setfield_gc', [B.n2, B.v2], None, B.ofs_value),
         ResOperation('escape', [B.n2], None),   # <== escaping
         ResOperation('jump', [B.sum2, B.n2], None),
         ])
@@ -205,16 +202,15 @@
     locals().update(A.__dict__)    # :-)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
         ResOperation('escape', [n1], None),    # <== escaping
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
         ResOperation('int_add', [sum, v], sum2),
         ResOperation('escape', [n1], None),    # <== escaping
-        ResOperation('new_with_vtable', [ConstInt(size_of_node),
-                                         ConstAddr(node_vtable, cpu)], n2),
-        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, v2], None, ofs_value),
         ResOperation('jump', [sum2, n2], None),
         ]
 
@@ -245,14 +241,13 @@
         ResOperation('merge_point', [C.sum, C.n1], None),
         # guard_class is gone
         ResOperation('escape', [C.n1], None),   # <== escaping
-        ResOperation('getfield_gc', [C.n1, ConstInt(C.ofs_value)], C.v),
+        ResOperation('getfield_gc', [C.n1], C.v, C.ofs_value),
         ResOperation('int_sub', [C.v, ConstInt(1)], C.v2),
         ResOperation('int_add', [C.sum, C.v], C.sum2),
         ResOperation('escape', [C.n1], None),   # <== escaping
-        ResOperation('new_with_vtable', [ConstInt(C.size_of_node),
-                                         ConstAddr(node_vtable, cpu)], C.n2),
-        ResOperation('setfield_gc', [C.n2, ConstInt(C.ofs_value), C.v2],
-                                       None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], C.n2,
+                     C.size_of_node),
+        ResOperation('setfield_gc', [C.n2, C.v2], None, C.ofs_value),
         ResOperation('jump', [C.sum2, C.n2], None),
         ])
 
@@ -262,15 +257,14 @@
     locals().update(A.__dict__)    # :-)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node2_vtable, cpu),
-                                     sizebox], None),
+        ResOperation('guard_class', [n1, ConstAddr(node2_vtable, cpu)], None),
         # the only difference is different vtable  ^^^^^^^^^^^^
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         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', [n2, ConstInt(ofs_value), v2], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, v2], None, ofs_value),
         ResOperation('jump', [sum2, n2], None),
         ]
 
@@ -285,14 +279,13 @@
     locals().update(A.__dict__)    # :-)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         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', [n2, ConstInt(ofs_value), v2], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, v2], None, ofs_value),
         ResOperation('guard_true', [v2], None),
         ResOperation('jump', [sum2, n2], None),
         ]
@@ -327,8 +320,8 @@
             self.cpu.translate_support_code = False
             self.ops = []
         
-        def execute_and_record(self, opnum, args):
-            self.ops.append((opnum, args))
+        def execute_and_record(self, opnum, args, descr):
+            self.ops.append((opnum, args, descr))
             return 'stuff'
     
     spec = PerfectSpecializer(Loop(E.ops))
@@ -343,8 +336,8 @@
     newboxes = rebuild_boxes_from_guard_failure(guard_op, fake_metainterp,
                                                 [v_sum_b, v_v_b])
     expected = [
-       (rop.NEW_WITH_VTABLE, [E.sizebox, ConstInt(vt)]),
-       (rop.SETFIELD_GC, ['stuff', ConstInt(E.ofs_value), v_v_b])
+       (rop.NEW_WITH_VTABLE, [ConstInt(vt)], E.size_of_node),
+       (rop.SETFIELD_GC, ['stuff', v_v_b], E.ofs_value)
        ]
     assert expected == fake_metainterp.ops
     assert newboxes == [v_sum_b, 'stuff']
@@ -361,14 +354,13 @@
     vbool3 = BoxInt(1)
     ops = [
         ResOperation('merge_point', [sum, n1, n3], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         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', [n2, ConstInt(ofs_value), v2], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, v2], None, ofs_value),
         ResOperation('ooisnot', [n2, n3], vbool1),
         ResOperation('guard_true', [vbool1], None),
         ResOperation('ooisnull', [n2], vbool2),
@@ -436,18 +428,16 @@
     v4 = BoxInt(124)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         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', [n2, ConstInt(ofs_value),
-                                            ConstInt(123)], None),
-        ResOperation('getfield_gc', [n2, ConstInt(ofs_value)], v3),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, ConstInt(123)], None, ofs_value),
+        ResOperation('getfield_gc', [n2], v3, ofs_value),
         ResOperation('int_add', [v3, ConstInt(1)], v4),
-        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v4], None),
+        ResOperation('setfield_gc', [n2, v4], None, ofs_value),
         ResOperation('guard_true', [v2], None),
         ResOperation('jump', [sum2, n2], None),
         ]
@@ -490,13 +480,13 @@
     v2 = BoxInt(nextnode.value)
     ops = [
         ResOperation('merge_point', [n0], None),
-        ResOperation('getfield_gc', [n0, ConstInt(ofs_next)], n1),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('getfield_gc', [n0], n1, ofs_next),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
-        ResOperation('new_with_vtable', [ConstInt(size_of_node),
-                                         ConstAddr(node_vtable, cpu)], n2),
-        ResOperation('setfield_gc', [n2, ConstInt(ofs_value), v2], None),
-        ResOperation('setfield_gc', [n0, ConstInt(ofs_next), n2], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, v2], None, ofs_value),
+        ResOperation('setfield_gc', [n0, n2], None, ofs_next),
         ResOperation('jump', [n0], None),
         ]
 
@@ -522,9 +512,9 @@
     n2 = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, nextnode))
     ops = [
         ResOperation('merge_point', [n0], None),
-        ResOperation('new_with_vtable', [ConstInt(size_of_node),
-                                         ConstAddr(node_vtable, cpu)], n2),
-        ResOperation('setfield_gc', [n2, ConstInt(ofs_next), n0], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, n0], None, ofs_next),
         ResOperation('jump', [n2], None),
         ]
 
@@ -550,10 +540,10 @@
     n1 = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, nextnode))
     ops = [
         ResOperation('merge_point', [n0], None),
-        ResOperation('getfield_gc', [n0, ConstInt(ofs_next)], n1),
-        ResOperation('new_with_vtable', [ConstInt(size_of_node),
-                                         ConstAddr(node_vtable, cpu)], n2),
-        ResOperation('setfield_gc', [n2, ConstInt(ofs_next), n1], None),
+        ResOperation('getfield_gc', [n0], n1, ofs_next),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, n1], None, ofs_next),
         ResOperation('jump', [n2], None),
         ]
 
@@ -573,12 +563,11 @@
     v3 = BoxInt(4)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
         ResOperation('int_add', [sum, v], sum2),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v3),
+        ResOperation('getfield_gc', [n1], v3, ofs_value),
         ResOperation('int_add', [sum2, v3], sum3),
         ResOperation('escape', [n1], None),
         ResOperation('jump', [sum3, n1], None),
@@ -596,7 +585,7 @@
         ResOperation('int_add', [K0.sum, K0.v], K0.sum2),
         ResOperation('int_add', [K0.sum2, K0.v], K0.sum3),
         ResOperation('escape', [K0.n1], None),
-        ResOperation('getfield_gc', [K0.n1, ConstInt(K0.ofs_value)], v4),
+        ResOperation('getfield_gc', [K0.n1], v4, K0.ofs_value),
         ResOperation('jump', [K0.sum3, K0.n1, v4], None),
     ])
 
@@ -607,13 +596,12 @@
     v3 = BoxInt(4)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
         ResOperation('int_add', [sum, v], sum2),
-        ResOperation('setfield_gc', [n1, ConstInt(ofs_value), sum], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v3),
+        ResOperation('setfield_gc', [n1, sum], None, ofs_value),
+        ResOperation('getfield_gc', [n1], v3, ofs_value),
         ResOperation('int_add', [sum2, v3], sum3),
         ResOperation('escape', [n1], None),
         ResOperation('jump', [sum3, n1], None),
@@ -630,10 +618,9 @@
         ResOperation('int_sub', [K1.v, ConstInt(1)], K1.v2),
         ResOperation('int_add', [K1.sum, K1.v], K1.sum2),
         ResOperation('int_add', [K1.sum2, K1.sum], K1.sum3),
-        ResOperation('setfield_gc', [K1.n1, ConstInt(K1.ofs_value), K1.sum],
-                     None),
+        ResOperation('setfield_gc', [K1.n1, K1.sum], None, K1.ofs_value),
         ResOperation('escape', [K1.n1], None),
-        ResOperation('getfield_gc', [K1.n1, ConstInt(K1.ofs_value)], v4),
+        ResOperation('getfield_gc', [K1.n1], v4, K1.ofs_value),
         ResOperation('jump', [K1.sum3, K1.n1, v4], None),
     ])
 
@@ -644,12 +631,11 @@
     v3 = BoxInt(4)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
         ResOperation('int_add', [sum, v], sum2),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v3),
+        ResOperation('getfield_gc', [n1], v3, ofs_value),
         ResOperation('int_add', [sum2, v3], sum3),
         ResOperation('jump', [sum3, n1], None),
         ]
@@ -675,13 +661,12 @@
     v3 = BoxInt(4)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
         ResOperation('int_add', [sum, v], sum2),
         ResOperation('escape', [n1], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v3),
+        ResOperation('getfield_gc', [n1], v3, ofs_value),
         ResOperation('int_add', [sum2, v3], sum3),
         ResOperation('jump', [sum3, n1], None),
         ]
@@ -696,7 +681,7 @@
         ResOperation('int_sub', [L.v, ConstInt(1)], L.v2),
         ResOperation('int_add', [L.sum, L.v], L.sum2),
         ResOperation('escape', [L.n1], None),
-        ResOperation('getfield_gc', [L.n1, ConstInt(L.ofs_value)], L.v3),
+        ResOperation('getfield_gc', [L.n1], L.v3, L.ofs_value),
         ResOperation('int_add', [L.sum2, L.v3], L.sum3),
         ResOperation('jump', [L.sum3, L.n1, L.v3], None),
     ])
@@ -709,9 +694,8 @@
     v3 = BoxInt(4)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
         ResOperation('int_add', [sum, v], sum2),
         ResOperation('escape', [n1], None),
@@ -729,7 +713,7 @@
         ResOperation('int_sub', [M.v, ConstInt(1)], M.v2),
         ResOperation('int_add', [M.sum, M.v], M.sum2),
         ResOperation('escape', [M.n1], None),
-        ResOperation('getfield_gc', [M.n1, ConstInt(M.ofs_value)], v4),
+        ResOperation('getfield_gc', [M.n1], v4, M.ofs_value),
         ResOperation('jump', [M.sum2, M.n1, v4], None),
     ])
 
@@ -741,9 +725,8 @@
     v3 = BoxInt(4)
     ops = [
         ResOperation('merge_point', [sum, n1], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('int_sub', [v, ConstInt(1)], v2),
         ResOperation('int_add', [sum, v], sum2),
         ResOperation('escape', [n1], None),
@@ -761,7 +744,7 @@
         ResOperation('int_sub', [N.v, ConstInt(1)], N.v2),
         ResOperation('int_add', [N.sum, N.v], N.sum2),
         ResOperation('escape', [N.n1], None),
-        ResOperation('getfield_gc', [N.n1, ConstInt(N.ofs_value)], v4),
+        ResOperation('getfield_gc', [N.n1], v4, N.ofs_value),
         ResOperation('jump', [N.sum2, N.n1, v4], None),
     ])
 
@@ -772,10 +755,8 @@
     ops = [
         ResOperation('merge_point', [], None),
         ResOperation('escape', [], n1),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
         ResOperation('jump', [], None),
         ]
     ops[-3].liveboxes = []
@@ -790,8 +771,8 @@
         ResOperation('merge_point', [], None),
         ResOperation('escape', [], O1.n1),
         # only the first guard_class is left
-        ResOperation('guard_class', [O1.n1, ConstAddr(node_vtable, cpu),
-                                     O1.sizebox], None),
+        ResOperation('guard_class', [O1.n1, ConstAddr(node_vtable, cpu)],
+                     None),
         ResOperation('jump', [], None),
     ])
 
@@ -803,8 +784,7 @@
     ops = [
         ResOperation('merge_point', [], None),
         ResOperation('escape', [], n1),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
         ResOperation('oononnull', [n1], v1),
         ResOperation('guard_true', [v1], None),
         ResOperation('jump', [], None),
@@ -820,8 +800,8 @@
     equaloplists(spec.loop.operations, [
         ResOperation('merge_point', [], None),
         ResOperation('escape', [], O2.n1),
-        ResOperation('guard_class', [O2.n1, ConstAddr(node_vtable, cpu),
-                                     O2.sizebox], None),
+        ResOperation('guard_class', [O2.n1, ConstAddr(node_vtable, cpu)],
+                     None),
         # the oononnull and guard_true are gone, because we know they
         # return True -- as there was already a guard_class done on n1
         ResOperation('jump', [], None),
@@ -835,8 +815,7 @@
     ops = [
         ResOperation('merge_point', [], None),
         ResOperation('escape', [], n1),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
         ResOperation('oois', [n1, ConstPtr(lltype.nullptr(llmemory.GCREF.TO))],
                              v1),
         ResOperation('guard_false', [v1], None),
@@ -853,8 +832,8 @@
     equaloplists(spec.loop.operations, [
         ResOperation('merge_point', [], None),
         ResOperation('escape', [], O3.n1),
-        ResOperation('guard_class', [O3.n1, ConstAddr(node_vtable, cpu),
-                                     O3.sizebox], None),
+        ResOperation('guard_class', [O3.n1, ConstAddr(node_vtable, cpu)],
+                     None),
         # the oois and guard_false are gone, because we know they
         # return False -- as there was already a guard_class done on n1
         ResOperation('jump', [], None),

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py	Fri Mar  6 18:46:59 2009
@@ -85,16 +85,16 @@
     sum2 = BoxInt(0 + frame.node.value)
     ops = [
         ResOperation('merge_point', [sum, fr], None),
-        ResOperation('guard_nonvirtualized', [fr, ConstAddr(xy_vtable, cpu),
-                                              ConstInt(ofs_node)], None),
-        ResOperation('getfield_gc', [fr, ConstInt(ofs_node)], n1),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_nonvirtualized', [fr, ConstAddr(xy_vtable, cpu)],
+                     None, ofs_node),
+        ResOperation('getfield_gc', [fr], n1, ofs_node),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         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', [n2, ConstInt(ofs_value), v2], None),
-        ResOperation('setfield_gc', [fr, ConstInt(ofs_node), n2], None),
+        ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n2,
+                     size_of_node),
+        ResOperation('setfield_gc', [n2, v2], None, ofs_value),
+        ResOperation('setfield_gc', [fr, n2], None, ofs_node),
         ResOperation('jump', [sum2, fr], None),
         ]
     ops[1].vdesc = xy_desc
@@ -142,10 +142,10 @@
     v = BoxInt(13)
     ops = [
         ResOperation('merge_point', [fr], None),
-        ResOperation('guard_nonvirtualized', [fr, ConstAddr(xy_vtable, cpu),
-                                              ConstInt(ofs_node)], None),
-        ResOperation('getfield_gc', [fr, ConstInt(ofs_node)], n1),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('guard_nonvirtualized', [fr, ConstAddr(xy_vtable, cpu)],
+                     None, ofs_node),
+        ResOperation('getfield_gc', [fr], n1, ofs_node),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         ResOperation('jump', [fr], None),
         ]
     ops[1].vdesc = xy_desc
@@ -171,17 +171,16 @@
     sizebox = ConstInt(cpu.sizeof(NODE))
     ops = [
         ResOperation('merge_point', [fr], None),
-        ResOperation('guard_nonvirtualized', [fr, ConstAddr(xy_vtable, cpu),
-                                              ConstInt(ofs_node)], None),
+        ResOperation('guard_nonvirtualized', [fr, ConstAddr(xy_vtable, cpu)],
+                     None, ofs_node),
         #
-        ResOperation('getfield_gc', [fr, ConstInt(ofs_node)], n1),
-        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu),
-                                     sizebox], None),
-        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], v),
+        ResOperation('getfield_gc', [fr], n1, ofs_node),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], None),
+        ResOperation('getfield_gc', [n1], v, ofs_value),
         #
-        ResOperation('getfield_gc', [fr, ConstInt(ofs_node)], n2),
+        ResOperation('getfield_gc', [fr], n2, ofs_node),
         ResOperation('guard_class', [n2, ConstAddr(node_vtable, cpu)], None),
-        ResOperation('getfield_gc', [n2, ConstInt(ofs_value)], v2),
+        ResOperation('getfield_gc', [n2], v2, ofs_value),
         #
         ResOperation('jump', [fr], None),
         ]



More information about the Pypy-commit mailing list