Commits

Armin Rigo committed 9e09a1f

Big no-op change: try to standardize the order of the arguments when there
is a "descr". The descr is now last, after the ptr-or-boxes arguments.

Comments (0)

Files changed (24)

pypy/jit/backend/llgraph/runner.py

     def bh_unicodegetitem(self, string, index):
         return llimpl.do_unicodegetitem(string, index)
 
-    def bh_getarrayitem_gc_i(self, arraydescr, array, index):
+    def bh_getarrayitem_gc_i(self, array, index, arraydescr):
         assert isinstance(arraydescr, Descr)
         return llimpl.do_getarrayitem_gc_int(array, index)
-    def bh_getarrayitem_raw_i(self, arraydescr, array, index):
+    def bh_getarrayitem_raw_i(self, array, index, arraydescr):
         assert isinstance(arraydescr, Descr)
         return llimpl.do_getarrayitem_raw_int(array, index, arraydescr.ofs)
-    def bh_getarrayitem_gc_r(self, arraydescr, array, index):
+    def bh_getarrayitem_gc_r(self, array, index, arraydescr):
         assert isinstance(arraydescr, Descr)
         return llimpl.do_getarrayitem_gc_ptr(array, index)
-    def bh_getarrayitem_gc_f(self, arraydescr, array, index):
+    def bh_getarrayitem_gc_f(self, array, index, arraydescr):
         assert isinstance(arraydescr, Descr)
         return llimpl.do_getarrayitem_gc_float(array, index)
-    def bh_getarrayitem_raw_f(self, arraydescr, array, index):
+    def bh_getarrayitem_raw_f(self, array, index, arraydescr):
         assert isinstance(arraydescr, Descr)
         return llimpl.do_getarrayitem_raw_float(array, index)
 
         assert isinstance(descr, Descr)
         return llimpl.do_getinteriorfield_gc_float(array, index, descr.ofs)
 
-    def bh_setinteriorfield_gc_i(self, array, index, descr, value):
+    def bh_setinteriorfield_gc_i(self, array, index, value, descr):
         assert isinstance(descr, Descr)
         return llimpl.do_setinteriorfield_gc_int(array, index, descr.ofs,
                                                  value)
-    def bh_setinteriorfield_gc_r(self, array, index, descr, value):
+    def bh_setinteriorfield_gc_r(self, array, index, value, descr):
         assert isinstance(descr, Descr)
         return llimpl.do_setinteriorfield_gc_ptr(array, index, descr.ofs,
                                                  value)
-    def bh_setinteriorfield_gc_f(self, array, index, descr, value):
+    def bh_setinteriorfield_gc_f(self, array, index, value, descr):
         assert isinstance(descr, Descr)
         return llimpl.do_setinteriorfield_gc_float(array, index, descr.ofs,
                                                    value)
 
-    def bh_raw_store_i(self, struct, offset, descr, newvalue):
+    def bh_raw_store_i(self, struct, offset, newvalue, descr):
         assert isinstance(descr, Descr)
         return llimpl.do_raw_store_int(struct, offset, descr.ofs, newvalue)
-    def bh_raw_store_f(self, struct, offset, descr, newvalue):
+    def bh_raw_store_f(self, struct, offset, newvalue, descr):
         assert isinstance(descr, Descr)
         return llimpl.do_raw_store_float(struct, offset, newvalue)
     def bh_raw_load_i(self, struct, offset, descr):
         assert isinstance(sizedescr, Descr)
         return llimpl.do_new(sizedescr.ofs)
 
-    def bh_new_with_vtable(self, sizedescr, vtable):
+    def bh_new_with_vtable(self, vtable, sizedescr):
         assert isinstance(sizedescr, Descr)
         result = llimpl.do_new(sizedescr.ofs)
         llimpl.do_setfield_gc_int(result, self.fielddescrof_vtable.ofs, vtable)
         result_adr = llmemory.cast_ptr_to_adr(struct.typeptr)
         return heaptracker.adr2int(result_adr)
 
-    def bh_new_array(self, arraydescr, length):
+    def bh_new_array(self, length, arraydescr):
         assert isinstance(arraydescr, Descr)
         return llimpl.do_new_array(arraydescr.ofs, length)
 
-    def bh_arraylen_gc(self, arraydescr, array):
+    def bh_arraylen_gc(self, array, arraydescr):
         assert isinstance(arraydescr, Descr)
         return llimpl.do_arraylen_gc(arraydescr, array)
 
-    def bh_setarrayitem_gc_i(self, arraydescr, array, index, newvalue):
+    def bh_setarrayitem_gc_i(self, array, index, newvalue, arraydescr):
         assert isinstance(arraydescr, Descr)
         llimpl.do_setarrayitem_gc_int(array, index, newvalue)
 
-    def bh_setarrayitem_raw_i(self, arraydescr, array, index, newvalue):
+    def bh_setarrayitem_raw_i(self, array, index, newvalue, arraydescr):
         assert isinstance(arraydescr, Descr)
         llimpl.do_setarrayitem_raw_int(array, index, newvalue, arraydescr.ofs)
 
-    def bh_setarrayitem_gc_r(self, arraydescr, array, index, newvalue):
+    def bh_setarrayitem_gc_r(self, array, index, newvalue, arraydescr):
         assert isinstance(arraydescr, Descr)
         llimpl.do_setarrayitem_gc_ptr(array, index, newvalue)
 
-    def bh_setarrayitem_gc_f(self, arraydescr, array, index, newvalue):
+    def bh_setarrayitem_gc_f(self, array, index, newvalue, arraydescr):
         assert isinstance(arraydescr, Descr)
         llimpl.do_setarrayitem_gc_float(array, index, newvalue)
 
-    def bh_setarrayitem_raw_f(self, arraydescr, array, index, newvalue):
+    def bh_setarrayitem_raw_f(self, array, index, newvalue, arraydescr):
         assert isinstance(arraydescr, Descr)
         llimpl.do_setarrayitem_raw_float(array, index, newvalue)
 
-    def bh_setfield_gc_i(self, struct, fielddescr, newvalue):
+    def bh_setfield_gc_i(self, struct, newvalue, fielddescr):
         assert isinstance(fielddescr, Descr)
         llimpl.do_setfield_gc_int(struct, fielddescr.ofs, newvalue)
-    def bh_setfield_gc_r(self, struct, fielddescr, newvalue):
+    def bh_setfield_gc_r(self, struct, newvalue, fielddescr):
         assert isinstance(fielddescr, Descr)
         llimpl.do_setfield_gc_ptr(struct, fielddescr.ofs, newvalue)
-    def bh_setfield_gc_f(self, struct, fielddescr, newvalue):
+    def bh_setfield_gc_f(self, struct, newvalue, fielddescr):
         assert isinstance(fielddescr, Descr)
         llimpl.do_setfield_gc_float(struct, fielddescr.ofs, newvalue)
 
-    def bh_setfield_raw_i(self, struct, fielddescr, newvalue):
+    def bh_setfield_raw_i(self, struct, newvalue, fielddescr):
         assert isinstance(fielddescr, Descr)
         llimpl.do_setfield_raw_int(struct, fielddescr.ofs, newvalue)
-    def bh_setfield_raw_r(self, struct, fielddescr, newvalue):
+    def bh_setfield_raw_r(self, struct, newvalue, fielddescr):
         assert isinstance(fielddescr, Descr)
         llimpl.do_setfield_raw_ptr(struct, fielddescr.ofs, newvalue)
-    def bh_setfield_raw_f(self, struct, fielddescr, newvalue):
+    def bh_setfield_raw_f(self, struct, newvalue, fielddescr):
         assert isinstance(fielddescr, Descr)
         llimpl.do_setfield_raw_float(struct, fielddescr.ofs, newvalue)
 
     def bh_unicodesetitem(self, string, index, newvalue):
         llimpl.do_unicodesetitem(string, index, newvalue)
 
-    def bh_call_i(self, func, calldescr, args_i, args_r, args_f):
-        self._prepare_call(INT, calldescr, args_i, args_r, args_f)
+    def bh_call_i(self, func, args_i, args_r, args_f, calldescr):
+        self._prepare_call(INT, args_i, args_r, args_f, calldescr)
         return llimpl.do_call_int(func)
-    def bh_call_r(self, func, calldescr, args_i, args_r, args_f):
-        self._prepare_call(REF, calldescr, args_i, args_r, args_f)
+    def bh_call_r(self, func, args_i, args_r, args_f, calldescr):
+        self._prepare_call(REF, args_i, args_r, args_f, calldescr)
         return llimpl.do_call_ptr(func)
-    def bh_call_f(self, func, calldescr, args_i, args_r, args_f):
-        self._prepare_call(FLOAT + 'L', calldescr, args_i, args_r, args_f)
+    def bh_call_f(self, func, args_i, args_r, args_f, calldescr):
+        self._prepare_call(FLOAT + 'L', args_i, args_r, args_f, calldescr)
         return llimpl.do_call_float(func)
-    def bh_call_v(self, func, calldescr, args_i, args_r, args_f):
-        self._prepare_call('v', calldescr, args_i, args_r, args_f)
+    def bh_call_v(self, func, args_i, args_r, args_f, calldescr):
+        self._prepare_call('v', args_i, args_r, args_f, calldescr)
         llimpl.do_call_void(func)
 
-    def _prepare_call(self, resulttypeinfo, calldescr, args_i, args_r, args_f):
+    def _prepare_call(self, resulttypeinfo, args_i, args_r, args_f, calldescr):
         assert isinstance(calldescr, Descr)
         assert calldescr.typeinfo in resulttypeinfo
         if args_i is not None:

pypy/jit/backend/llsupport/gc.py

         assert isinstance(sizedescr, SizeDescr)
         return self._bh_malloc(sizedescr)
 
-    def gc_malloc_array(self, arraydescr, num_elem):
+    def gc_malloc_array(self, num_elem, arraydescr):
         assert isinstance(arraydescr, ArrayDescr)
-        return self._bh_malloc_array(arraydescr, num_elem)
+        return self._bh_malloc_array(num_elem, arraydescr)
 
     def gc_malloc_str(self, num_elem):
-        return self._bh_malloc_array(self.str_descr, num_elem)
+        return self._bh_malloc_array(num_elem, self.str_descr)
 
     def gc_malloc_unicode(self, num_elem):
-        return self._bh_malloc_array(self.unicode_descr, num_elem)
+        return self._bh_malloc_array(num_elem, self.unicode_descr)
 
     def _record_constptrs(self, op, gcrefs_output_list):
         for i in range(op.numargs()):
     def _bh_malloc(self, sizedescr):
         return self.malloc_fixedsize(sizedescr.size)
 
-    def _bh_malloc_array(self, arraydescr, num_elem):
+    def _bh_malloc_array(self, num_elem, arraydescr):
         return self.malloc_array(arraydescr.basesize, num_elem,
                                  arraydescr.itemsize,
                                  arraydescr.lendescr.offset)
                                                type_id, sizedescr.size,
                                                False, False, False)
 
-    def _bh_malloc_array(self, arraydescr, num_elem):
+    def _bh_malloc_array(self, num_elem, arraydescr):
         from pypy.rpython.memory.gctypelayout import check_typeid
         llop1 = self.llop1
         type_id = llop.extract_ushort(llgroup.HALFWORD, arraydescr.tid)

pypy/jit/backend/llsupport/llmodel.py

 
     # ____________________________________________________________
 
-    def bh_arraylen_gc(self, arraydescr, array):
+    def bh_arraylen_gc(self, array, arraydescr):
         assert isinstance(arraydescr, ArrayDescr)
         ofs = arraydescr.lendescr.offset
         return rffi.cast(rffi.CArrayPtr(lltype.Signed), array)[ofs/WORD]
 
     @specialize.argtype(2)
-    def bh_getarrayitem_gc_i(self, arraydescr, gcref, itemindex):
+    def bh_getarrayitem_gc_i(self, gcref, itemindex, arraydescr):
         ofs, size, sign = self.unpack_arraydescr_size(arraydescr)
         # --- start of GC unsafe code (no GC operation!) ---
         items = rffi.ptradd(rffi.cast(rffi.CCHARP, gcref), ofs)
         else:
             raise NotImplementedError("size = %d" % size)
 
-    def bh_getarrayitem_gc_r(self, arraydescr, gcref, itemindex):
+    def bh_getarrayitem_gc_r(self, gcref, itemindex, arraydescr):
         ofs = self.unpack_arraydescr(arraydescr)
         # --- start of GC unsafe code (no GC operation!) ---
         items = rffi.ptradd(rffi.cast(rffi.CCHARP, gcref), ofs)
         return pval
 
     @specialize.argtype(2)
-    def bh_getarrayitem_gc_f(self, arraydescr, gcref, itemindex):
+    def bh_getarrayitem_gc_f(self, gcref, itemindex, arraydescr):
         ofs = self.unpack_arraydescr(arraydescr)
         # --- start of GC unsafe code (no GC operation!) ---
         items = rffi.ptradd(rffi.cast(rffi.CCHARP, gcref), ofs)
         return fval
 
     @specialize.argtype(2)
-    def bh_setarrayitem_gc_i(self, arraydescr, gcref, itemindex, newvalue):
+    def bh_setarrayitem_gc_i(self, gcref, itemindex, newvalue, arraydescr):
         ofs, size, sign = self.unpack_arraydescr_size(arraydescr)
         # --- start of GC unsafe code (no GC operation!) ---
         items = rffi.ptradd(rffi.cast(rffi.CCHARP, gcref), ofs)
         else:
             raise NotImplementedError("size = %d" % size)
 
-    def bh_setarrayitem_gc_r(self, arraydescr, gcref, itemindex, newvalue):
+    def bh_setarrayitem_gc_r(self, gcref, itemindex, newvalue, arraydescr):
         ofs = self.unpack_arraydescr(arraydescr)
         self.gc_ll_descr.do_write_barrier(gcref, newvalue)
         # --- start of GC unsafe code (no GC operation!) ---
         # --- end of GC unsafe code ---
 
     @specialize.argtype(2)
-    def bh_setarrayitem_gc_f(self, arraydescr, gcref, itemindex, newvalue):
+    def bh_setarrayitem_gc_f(self, gcref, itemindex, newvalue, arraydescr):
         ofs = self.unpack_arraydescr(arraydescr)
         # --- start of GC unsafe code (no GC operation!) ---
         items = rffi.ptradd(rffi.cast(rffi.CCHARP, gcref), ofs)
         # --- end of GC unsafe code ---
         return fval
 
-    def bh_setinteriorfield_gc_i(self, gcref, itemindex, descr, value):
+    def bh_setinteriorfield_gc_i(self, gcref, itemindex, value, descr):
         assert isinstance(descr, InteriorFieldDescr)
         arraydescr = descr.arraydescr
         ofs, size, _ = self.unpack_arraydescr_size(arraydescr)
         else:
             raise NotImplementedError("size = %d" % fieldsize)
 
-    def bh_setinteriorfield_gc_r(self, gcref, itemindex, descr, newvalue):
+    def bh_setinteriorfield_gc_r(self, gcref, itemindex, newvalue, descr):
         assert isinstance(descr, InteriorFieldDescr)
         arraydescr = descr.arraydescr
         ofs, size, _ = self.unpack_arraydescr_size(arraydescr)
         items[0] = self.cast_gcref_to_int(newvalue)
         # --- end of GC unsafe code ---
 
-    def bh_setinteriorfield_gc_f(self, gcref, itemindex, descr, newvalue):
+    def bh_setinteriorfield_gc_f(self, gcref, itemindex, newvalue, descr):
         assert isinstance(descr, InteriorFieldDescr)
         arraydescr = descr.arraydescr
         ofs, size, _ = self.unpack_arraydescr_size(arraydescr)
     bh_getfield_raw_f = _base_do_getfield_f
 
     @specialize.argtype(1)
-    def _base_do_setfield_i(self, struct, fielddescr, newvalue):
+    def _base_do_setfield_i(self, struct, newvalue, fielddescr):
         ofs, size, sign = self.unpack_fielddescr_size(fielddescr)
         # --- start of GC unsafe code (no GC operation!) ---
         fieldptr = rffi.ptradd(rffi.cast(rffi.CCHARP, struct), ofs)
             raise NotImplementedError("size = %d" % size)
 
     @specialize.argtype(1)
-    def _base_do_setfield_r(self, struct, fielddescr, newvalue):
+    def _base_do_setfield_r(self, struct, newvalue, fielddescr):
         ofs = self.unpack_fielddescr(fielddescr)
         assert lltype.typeOf(struct) is not lltype.Signed, (
             "can't handle write barriers for setfield_raw")
         # --- end of GC unsafe code ---
 
     @specialize.argtype(1)
-    def _base_do_setfield_f(self, struct, fielddescr, newvalue):
+    def _base_do_setfield_f(self, struct, newvalue, fielddescr):
         ofs = self.unpack_fielddescr(fielddescr)
         # --- start of GC unsafe code (no GC operation!) ---
         fieldptr = rffi.ptradd(rffi.cast(rffi.CCHARP, struct), ofs)
     bh_setfield_raw_r = _base_do_setfield_r
     bh_setfield_raw_f = _base_do_setfield_f
 
-    def bh_raw_store_i(self, addr, offset, descr, newvalue):
+    def bh_raw_store_i(self, addr, offset, newvalue, descr):
         ofs, size, sign = self.unpack_arraydescr_size(descr)
         items = addr + offset
         for TYPE, _, itemsize in unroll_basic_sizes:
                 items[0] = rffi.cast(TYPE, newvalue)
                 break
 
-    def bh_raw_store_f(self, addr, offset, descr, newvalue):
+    def bh_raw_store_f(self, addr, offset, newvalue, descr):
         items = rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), addr + offset)
         items[0] = newvalue
 
     def bh_new(self, sizedescr):
         return self.gc_ll_descr.gc_malloc(sizedescr)
 
-    def bh_new_with_vtable(self, sizedescr, vtable):
+    def bh_new_with_vtable(self, vtable, sizedescr):
         res = self.gc_ll_descr.gc_malloc(sizedescr)
         if self.vtable_offset is not None:
             as_array = rffi.cast(rffi.CArrayPtr(lltype.Signed), res)
         result_adr = llmemory.cast_ptr_to_adr(struct.typeptr)
         return heaptracker.adr2int(result_adr)
 
-    def bh_new_array(self, arraydescr, length):
-        return self.gc_ll_descr.gc_malloc_array(arraydescr, length)
+    def bh_new_array(self, length, arraydescr):
+        return self.gc_ll_descr.gc_malloc_array(length, arraydescr)
 
     def bh_newstr(self, length):
         return self.gc_ll_descr.gc_malloc_str(length)
         dst = lltype.cast_opaque_ptr(lltype.Ptr(rstr.UNICODE), dst)
         rstr.copy_unicode_contents(src, dst, srcstart, dststart, length)
 
-    def bh_call_i(self, func, calldescr, args_i, args_r, args_f):
+    def bh_call_i(self, func, args_i, args_r, args_f, calldescr):
         assert isinstance(calldescr, CallDescr)
         if not we_are_translated():
             calldescr.verify_types(args_i, args_r, args_f, history.INT + 'S')
         return calldescr.call_stub_i(func, args_i, args_r, args_f)
 
-    def bh_call_r(self, func, calldescr, args_i, args_r, args_f):
+    def bh_call_r(self, func, args_i, args_r, args_f, calldescr):
         assert isinstance(calldescr, CallDescr)
         if not we_are_translated():
             calldescr.verify_types(args_i, args_r, args_f, history.REF)
         return calldescr.call_stub_r(func, args_i, args_r, args_f)
 
-    def bh_call_f(self, func, calldescr, args_i, args_r, args_f):
+    def bh_call_f(self, func, args_i, args_r, args_f, calldescr):
         assert isinstance(calldescr, CallDescr)
         if not we_are_translated():
             calldescr.verify_types(args_i, args_r, args_f, history.FLOAT + 'L')
         return calldescr.call_stub_f(func, args_i, args_r, args_f)
 
-    def bh_call_v(self, func, calldescr, args_i, args_r, args_f):
+    def bh_call_v(self, func, args_i, args_r, args_f, calldescr):
         assert isinstance(calldescr, CallDescr)
         if not we_are_translated():
             calldescr.verify_types(args_i, args_r, args_f, history.VOID)

pypy/jit/backend/llsupport/test/test_gc.py

     # ---------- gc_malloc_array ----------
     A = lltype.GcArray(lltype.Signed)
     arraydescr = get_array_descr(gc_ll_descr, A)
-    p = gc_ll_descr.gc_malloc_array(arraydescr, 10)
+    p = gc_ll_descr.gc_malloc_array(10, arraydescr)
     assert record == [(arraydescr.basesize +
                        10 * arraydescr.itemsize, p)]
     del record[:]
     def test_gc_malloc_array(self):
         A = lltype.GcArray(lltype.Signed)
         arraydescr = get_array_descr(self.gc_ll_descr, A)
-        p = self.gc_ll_descr.gc_malloc_array(arraydescr, 10)
+        p = self.gc_ll_descr.gc_malloc_array(10, arraydescr)
         assert self.llop1.record == [("varsize", arraydescr.tid, 10,
                                       repr(arraydescr.basesize),
                                       repr(arraydescr.itemsize),

pypy/jit/backend/model.py

     # lltype specific operations
     # --------------------------
 
-    def bh_getarrayitem_gc_i(self, arraydescr, array, index):
+    def bh_getarrayitem_gc_i(self, array, index, arraydescr):
         raise NotImplementedError
-    def bh_getarrayitem_gc_r(self, arraydescr, array, index):
+    def bh_getarrayitem_gc_r(self, array, index, arraydescr):
         raise NotImplementedError
-    def bh_getarrayitem_gc_f(self, arraydescr, array, index):
+    def bh_getarrayitem_gc_f(self, array, index, arraydescr):
         raise NotImplementedError
 
     def bh_getfield_gc_i(self, struct, fielddescr):
 
     def bh_new(self, sizedescr):
         raise NotImplementedError
-    def bh_new_with_vtable(self, sizedescr, vtable):
+    def bh_new_with_vtable(self, vtable, sizedescr):
         raise NotImplementedError
-    def bh_new_array(self, arraydescr, length):
+    def bh_new_array(self, length, arraydescr):
         raise NotImplementedError
     def bh_newstr(self, length):
         raise NotImplementedError
     def bh_newunicode(self, length):
         raise NotImplementedError
 
-    def bh_arraylen_gc(self, arraydescr, array):
+    def bh_arraylen_gc(self, array, arraydescr):
         raise NotImplementedError
 
     def bh_classof(self, struct):
         raise NotImplementedError
 
-    def bh_setarrayitem_gc_i(self, arraydescr, array, index, newvalue):
+    def bh_setarrayitem_gc_i(self, array, index, newvalue, arraydescr):
         raise NotImplementedError
-    def bh_setarrayitem_gc_r(self, arraydescr, array, index, newvalue):
+    def bh_setarrayitem_gc_r(self, array, index, newvalue, arraydescr):
         raise NotImplementedError
-    def bh_setarrayitem_gc_f(self, arraydescr, array, index, newvalue):
+    def bh_setarrayitem_gc_f(self, array, index, newvalue, arraydescr):
         raise NotImplementedError
 
-    def bh_setfield_gc_i(self, struct, fielddescr, newvalue):
+    def bh_setfield_gc_i(self, struct, newvalue, fielddescr):
         raise NotImplementedError
-    def bh_setfield_gc_r(self, struct, fielddescr, newvalue):
+    def bh_setfield_gc_r(self, struct, newvalue, fielddescr):
         raise NotImplementedError
-    def bh_setfield_gc_f(self, struct, fielddescr, newvalue):
+    def bh_setfield_gc_f(self, struct, newvalue, fielddescr):
         raise NotImplementedError
 
-    def bh_setfield_raw_i(self, struct, fielddescr, newvalue):
+    def bh_setfield_raw_i(self, struct, newvalue, fielddescr):
         raise NotImplementedError
-    def bh_setfield_raw_r(self, struct, fielddescr, newvalue):
+    def bh_setfield_raw_r(self, struct, newvalue, fielddescr):
         raise NotImplementedError
-    def bh_setfield_raw_f(self, struct, fielddescr, newvalue):
+    def bh_setfield_raw_f(self, struct, newvalue, fielddescr):
         raise NotImplementedError
 
-    def bh_call_i(self, func, calldescr, args_i, args_r, args_f):
+    def bh_call_i(self, func, args_i, args_r, args_f, calldescr):
         raise NotImplementedError
-    def bh_call_r(self, func, calldescr, args_i, args_r, args_f):
+    def bh_call_r(self, func, args_i, args_r, args_f, calldescr):
         raise NotImplementedError
-    def bh_call_f(self, func, calldescr, args_i, args_r, args_f):
+    def bh_call_f(self, func, args_i, args_r, args_f, calldescr):
         raise NotImplementedError
-    def bh_call_v(self, func, calldescr, args_i, args_r, args_f):
+    def bh_call_v(self, func, args_i, args_r, args_f, calldescr):
         raise NotImplementedError
 
     def bh_strlen(self, string):

pypy/jit/backend/test/runner_test.py

         calldescr = cpu.calldescrof(deref(FPTR), (lltype.Char,), lltype.Char,
                                     EffectInfo.MOST_GENERAL)
         x = cpu.bh_call_i(self.get_funcbox(cpu, func_ptr).value,
-                          calldescr, [ord('A')], None, None)
+                          [ord('A')], None, None, calldescr)
         assert x == ord('B')
         if cpu.supports_floats:
             def func(f, i):
             calldescr = cpu.calldescrof(FTP, FTP.ARGS, FTP.RESULT,
                                         EffectInfo.MOST_GENERAL)
             x = cpu.bh_call_f(self.get_funcbox(cpu, func_ptr).value,
-                              calldescr,
-                              [42], None, [longlong.getfloatstorage(3.5)])
+                              [42], None, [longlong.getfloatstorage(3.5)],
+                              calldescr)
             assert longlong.getrealfloat(x) == 3.5 - 42
 
     def test_call(self):
                                'void', descr=kdescr)
         f = self.cpu.bh_getinteriorfield_gc_f(a_box.getref_base(), 3, kdescr)
         assert longlong.getrealfloat(f) == 1.5
-        self.cpu.bh_setinteriorfield_gc_f(a_box.getref_base(), 3, kdescr, longlong.getfloatstorage(2.5))
+        self.cpu.bh_setinteriorfield_gc_f(a_box.getref_base(), 3, longlong.getfloatstorage(2.5), kdescr)
         r = self.execute_operation(rop.GETINTERIORFIELD_GC, [a_box, BoxInt(3)],
                                    'float', descr=kdescr)
         assert r.getfloat() == 2.5
         for name, TYPE in NUMBER_FIELDS[::-1]:
             vdescr = self.cpu.interiorfielddescrof(A, name)
             self.cpu.bh_setinteriorfield_gc_i(a_box.getref_base(), 3,
-                                              vdescr, -25)
+                                              -25, vdescr)
         for name, TYPE in NUMBER_FIELDS:
             vdescr = self.cpu.interiorfielddescrof(A, name)
             r = self.execute_operation(rop.GETINTERIORFIELD_GC,
                                'void', descr=pdescr)
         r = self.cpu.bh_getinteriorfield_gc_r(a_box.getref_base(), 4, pdescr)
         assert r == s_box.getref_base()
-        self.cpu.bh_setinteriorfield_gc_r(a_box.getref_base(), 3, pdescr,
-                                          s_box.getref_base())
+        self.cpu.bh_setinteriorfield_gc_r(a_box.getref_base(), 3,
+                                          s_box.getref_base(), pdescr)
         r = self.execute_operation(rop.GETINTERIORFIELD_GC, [a_box, BoxInt(3)],
                                    'ref', descr=pdescr)
         assert r.getref_base() == s_box.getref_base()
         assert s.parent.chr2 == chr(150)
         r = self.cpu.bh_getfield_gc_i(r1.value, descrshort)
         assert r == 1313
-        self.cpu.bh_setfield_gc_i(r1.value, descrshort, 1333)
+        self.cpu.bh_setfield_gc_i(r1.value, 1333, descrshort)
         r = self.cpu.bh_getfield_gc_i(r1.value, descrshort)
         assert r == 1333
         r = self.execute_operation(rop.GETFIELD_GC, [r1], 'int',
         A = lltype.GcArray(lltype.Char)
         descr_A = cpu.arraydescrof(A)
         a = lltype.malloc(A, 5)
-        x = cpu.bh_arraylen_gc(descr_A,
-                               lltype.cast_opaque_ptr(llmemory.GCREF, a))
+        x = cpu.bh_arraylen_gc(lltype.cast_opaque_ptr(llmemory.GCREF, a),
+                               descr_A)
         assert x == 5
         #
         a[2] = 'Y'
         x = cpu.bh_getarrayitem_gc_i(
-            descr_A, lltype.cast_opaque_ptr(llmemory.GCREF, a), 2)
+            lltype.cast_opaque_ptr(llmemory.GCREF, a), 2, descr_A)
         assert x == ord('Y')
         #
         B = lltype.GcArray(lltype.Ptr(A))
         b = lltype.malloc(B, 4)
         b[3] = a
         x = cpu.bh_getarrayitem_gc_r(
-            descr_B, lltype.cast_opaque_ptr(llmemory.GCREF, b), 3)
+            lltype.cast_opaque_ptr(llmemory.GCREF, b), 3, descr_B)
         assert lltype.cast_opaque_ptr(lltype.Ptr(A), x) == a
         if self.cpu.supports_floats:
             C = lltype.GcArray(lltype.Float)
             c[3] = 3.5
             descr_C = cpu.arraydescrof(C)
             x = cpu.bh_getarrayitem_gc_f(
-                descr_C, lltype.cast_opaque_ptr(llmemory.GCREF, c), 3)
+                lltype.cast_opaque_ptr(llmemory.GCREF, c), 3, descr_C)
             assert longlong.getrealfloat(x) == 3.5
             cpu.bh_setarrayitem_gc_f(
-                descr_C, lltype.cast_opaque_ptr(llmemory.GCREF, c), 4,
-                longlong.getfloatstorage(4.5))
+                lltype.cast_opaque_ptr(llmemory.GCREF, c), 4,
+                longlong.getfloatstorage(4.5), descr_C)
             assert c[4] == 4.5
         s = rstr.mallocstr(6)
         x = cpu.bh_strlen(lltype.cast_opaque_ptr(llmemory.GCREF, s))
         assert x == ord('Z')
         #
         cpu.bh_setfield_gc_i(lltype.cast_opaque_ptr(llmemory.GCREF, s),
-                             descrfld_x,
-                             ord('4'))
+                             ord('4'), descrfld_x)
         assert s.x == '4'
         #
         descrfld_y = cpu.fielddescrof(S, 'y')
         #
         s.y = lltype.nullptr(A)
         cpu.bh_setfield_gc_r(lltype.cast_opaque_ptr(llmemory.GCREF, s),
-                             descrfld_y, x)
+                             x, descrfld_y)
         assert s.y == a
         #
         RS = lltype.Struct('S', ('x', lltype.Char))  #, ('y', lltype.Ptr(A)))
         #
         cpu.bh_setfield_raw_i(
             heaptracker.adr2int(llmemory.cast_ptr_to_adr(rs)),
-            descrfld_rx, ord('!'))
+            ord('!'), descrfld_rx)
         assert rs.x == '!'
         #
 
             descrfld_z = cpu.fielddescrof(S, 'z')
             cpu.bh_setfield_gc_f(
                 lltype.cast_opaque_ptr(llmemory.GCREF, s),
-                descrfld_z, longlong.getfloatstorage(3.5))
+                longlong.getfloatstorage(3.5), descrfld_z)
             assert s.z == 3.5
             s.z = 3.2
             x = cpu.bh_getfield_gc_f(
         vtable2 = lltype.malloc(rclass.OBJECT_VTABLE, immortal=True)
         vtable2_int = heaptracker.adr2int(llmemory.cast_ptr_to_adr(vtable2))
         heaptracker.register_known_gctype(cpu, vtable2, rclass.OBJECT)
-        x = cpu.bh_new_with_vtable(descrsize2, vtable2_int)
+        x = cpu.bh_new_with_vtable(vtable2_int, descrsize2)
         lltype.cast_opaque_ptr(lltype.Ptr(rclass.OBJECT), x)    # type check
         # well...
         #assert x.getref(rclass.OBJECTPTR).typeptr == vtable2
         #
         arraydescr = cpu.arraydescrof(A)
-        x = cpu.bh_new_array(arraydescr, 7)
+        x = cpu.bh_new_array(7, arraydescr)
         array = lltype.cast_opaque_ptr(lltype.Ptr(A), x)
         assert len(array) == 7
         #
-        cpu.bh_setarrayitem_gc_i(descr_A, x, 5, ord('*'))
+        cpu.bh_setarrayitem_gc_i(x, 5, ord('*'), descr_A)
         assert array[5] == '*'
         #
         cpu.bh_setarrayitem_gc_r(
-            descr_B, lltype.cast_opaque_ptr(llmemory.GCREF, b), 1, x)
+            lltype.cast_opaque_ptr(llmemory.GCREF, b), 1, x, descr_B)
         assert b[1] == array
         #
         x = cpu.bh_newstr(5)
             expected = rffi.cast(lltype.Signed, rffi.cast(RESTYPE, value))
             a[3] = rffi.cast(RESTYPE, value)
             x = cpu.bh_getarrayitem_gc_i(
-                descrarray, lltype.cast_opaque_ptr(llmemory.GCREF, a), 3)
+                lltype.cast_opaque_ptr(llmemory.GCREF, a), 3, descrarray)
             assert x == expected, (
                 "%r: got %r, expected %r" % (RESTYPE, x, expected))
 
             expected = rffi.cast(lltype.Signed, rffi.cast(RESTYPE, value))
             a[3] = rffi.cast(RESTYPE, value)
             a_rawint = heaptracker.adr2int(llmemory.cast_ptr_to_adr(a))
-            x = cpu.bh_getarrayitem_raw_i(descrarray, a_rawint, 3)
+            x = cpu.bh_getarrayitem_raw_i(a_rawint, 3, descrarray)
             assert x == expected, (
                 "%r: got %r, expected %r" % (RESTYPE, x, expected))
             lltype.free(a, flavor='raw')
             calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
                                              EffectInfo.MOST_GENERAL)
             x = self.cpu.bh_call_i(self.get_funcbox(self.cpu, f).value,
-                                   calldescr, [value], None, None)
+                                   [value], None, None, calldescr)
             assert x == expected, (
                 "%r: got %r, expected %r" % (RESTYPE, x, expected))
 
         calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
                                          EffectInfo.MOST_GENERAL)
         x = self.cpu.bh_call_f(self.get_funcbox(self.cpu, f).value,
-                               calldescr, None, None, [value])
+                               None, None, [value], calldescr)
         assert x == expected
 
     def test_longlong_result_of_call_compiled(self):
         ivalue = longlong.singlefloat2int(value)
         iexpected = longlong.singlefloat2int(expected)
         x = self.cpu.bh_call_i(self.get_funcbox(self.cpu, f).value,
-                               calldescr, [ivalue], None, None)
+                               [ivalue], None, None, calldescr)
         assert x == iexpected
 
     def test_singlefloat_result_of_call_compiled(self):

pypy/jit/codewriter/jtransform.py

         kind = self.callcontrol.guess_call_kind(op)
         return getattr(self, 'handle_%s_indirect_call' % kind)(op)
 
-    def rewrite_call(self, op, namebase, initialargs, args=None):
+    def rewrite_call(self, op, namebase, initialargs, args=None,
+                     calldescr=None):
         """Turn 'i0 = direct_call(fn, i1, i2, ref1, ref2)'
            into 'i0 = xxx_call_ir_i(fn, descr, [i1,i2], [ref1,ref2])'.
            The name is one of '{residual,direct}_call_{r,ir,irf}_{i,r,f,v}'."""
         if 'i' in kinds: sublists.append(lst_i)
         if 'r' in kinds: sublists.append(lst_r)
         if 'f' in kinds: sublists.append(lst_f)
+        if calldescr is not None:
+            sublists.append(calldescr)
         return SpaceOperation('%s_%s_%s' % (namebase, kinds, reskind),
                               initialargs + sublists, op.result)
 
         of 'residual_call_xxx' are the function to call, and its calldescr."""
         calldescr = self.callcontrol.getcalldescr(op)
         op1 = self.rewrite_call(op, 'residual_call',
-                                [op.args[0], calldescr] + extraargs)
+                                [op.args[0]] + extraargs, calldescr=calldescr)
         if may_call_jitcodes or self.callcontrol.calldescr_canraise(calldescr):
             op1 = [op1, SpaceOperation('-live-', [], None)]
         return op1
             # XXX only strings or simple arrays for now
             ARRAY = op.args[0].value
             arraydescr = self.cpu.arraydescrof(ARRAY)
-            return SpaceOperation('new_array', [arraydescr, op.args[2]],
+            return SpaceOperation('new_array', [op.args[2], arraydescr],
                                   op.result)
 
     def rewrite_op_free(self, op):
             kind = getkind(op.result.concretetype)
             return [SpaceOperation('-live-', [], None),
                     SpaceOperation('getarrayitem_vable_%s' % kind[0],
-                                   [v_base, arrayfielddescr, arraydescr,
-                                    op.args[1]], op.result)]
+                                   [v_base, op.args[1], arrayfielddescr,
+                                    arraydescr], op.result)]
         # normal case follows
         pure = ''
         immut = ARRAY._immutable_field(None)
         kind = getkind(op.result.concretetype)
         return SpaceOperation('getarrayitem_%s_%s%s' % (ARRAY._gckind,
                                                         kind[0], pure),
-                              [op.args[0], arraydescr, op.args[1]],
+                              [op.args[0], op.args[1], arraydescr],
                               op.result)
 
     def rewrite_op_setarrayitem(self, op):
             kind = getkind(op.args[2].concretetype)
             return [SpaceOperation('-live-', [], None),
                     SpaceOperation('setarrayitem_vable_%s' % kind[0],
-                                   [v_base, arrayfielddescr, arraydescr,
-                                    op.args[1], op.args[2]], None)]
+                                   [v_base, op.args[1], op.args[2],
+                                    arrayfielddescr, arraydescr], None)]
         arraydescr = self.cpu.arraydescrof(ARRAY)
         kind = getkind(op.args[2].concretetype)
         return SpaceOperation('setarrayitem_%s_%s' % (ARRAY._gckind, kind[0]),
-                              [op.args[0], arraydescr, op.args[1], op.args[2]],
+                              [op.args[0], op.args[1], op.args[2], arraydescr],
                               None)
 
     def rewrite_op_getarraysize(self, op):
             kind = getkind(RESULT)[0]
             return [SpaceOperation('-live-', [], None),
                     SpaceOperation('setfield_vable_%s' % kind,
-                                   [v_inst, descr, v_value], None)]
+                                   [v_inst, v_value, descr], None)]
         self.check_field_access(v_inst.concretetype.TO)
         argname = getattr(v_inst.concretetype.TO, '_gckind', 'gc')
         descr = self.cpu.fielddescrof(v_inst.concretetype.TO,
                                       c_fieldname.value)
         kind = getkind(RESULT)[0]
         return SpaceOperation('setfield_%s_%s' % (argname, kind),
-                              [v_inst, descr, v_value],
+                              [v_inst, v_value, descr],
                               None)
 
     def rewrite_op_getsubstruct(self, op):
         assert kind != 'r'
         descr = self.cpu.arraydescrof(rffi.CArray(T))
         return SpaceOperation('raw_store_%s' % kind,
-                              [op.args[0], op.args[1], descr, op.args[2]],
+                              [op.args[0], op.args[1], op.args[2], descr],
                               None)
 
     def rewrite_op_raw_load(self, op):
             v_posindex = Variable('posindex')
             v_posindex.concretetype = lltype.Signed
             op0 = SpaceOperation('-live-', [], None)
-            op1 = SpaceOperation(checkname, [args[0],
-                                             descr, args[1]], v_posindex)
+            op1 = SpaceOperation(checkname, [args[0], args[1],
+                                             descr], v_posindex)
             return v_posindex, [op0, op1]
 
     def _prepare_void_list_getset(self, op):
             v = Variable('new_length')
             v.concretetype = lltype.Signed
             ops.append(SpaceOperation('int_force_ge_zero', [v_length], v))
-        ops.append(SpaceOperation('new_array', [arraydescr, v], op.result))
+        ops.append(SpaceOperation('new_array', [v, arraydescr], op.result))
         return ops
 
     def do_fixed_list_len(self, op, args, arraydescr):
             kind = getkind(op.result.concretetype)
             return [SpaceOperation('-live-', [], None),
                     SpaceOperation('getarrayitem_vable_%s' % kind[0],
-                                   [v_base, arrayfielddescr, arraydescr,
-                                    args[1]], op.result)]
+                                   [v_base, args[1], arrayfielddescr,
+                                    arraydescr], op.result)]
         v_index, extraop = self._prepare_list_getset(op, arraydescr, args,
                                                      'check_neg_index')
         extra = getkind(op.result.concretetype)[0]
         if pure:
             extra += '_pure'
         op = SpaceOperation('getarrayitem_gc_%s' % extra,
-                            [args[0], arraydescr, v_index], op.result)
+                            [args[0], v_index, arraydescr], op.result)
         return extraop + [op]
 
     def do_fixed_list_getitem_foldable(self, op, args, arraydescr):
             kind = getkind(args[2].concretetype)
             return [SpaceOperation('-live-', [], None),
                     SpaceOperation('setarrayitem_vable_%s' % kind[0],
-                                   [v_base, arrayfielddescr, arraydescr,
-                                    args[1], args[2]], None)]
+                                   [v_base, args[1], args[2],
+                                    arrayfielddescr, arraydescr], None)]
         v_index, extraop = self._prepare_list_getset(op, arraydescr, args,
                                                      'check_neg_index')
         kind = getkind(args[2].concretetype)[0]
         op = SpaceOperation('setarrayitem_gc_%s' % kind,
-                            [args[0], arraydescr, v_index, args[2]], None)
+                            [args[0], v_index, args[2], arraydescr], None)
         return extraop + [op]
 
     def do_fixed_list_ll_arraycopy(self, op, args, arraydescr):
                              itemsdescr, structdescr):
         v_length = self._get_initial_newlist_length(op, args)
         return SpaceOperation('newlist',
-                              [structdescr, lengthdescr, itemsdescr,
-                               arraydescr, v_length],
+                              [v_length, structdescr, lengthdescr, itemsdescr,
+                               arraydescr],
                               op.result)
 
     def do_resizable_newlist_hint(self, op, args, arraydescr, lengthdescr,
                                   itemsdescr, structdescr):
         v_hint = self._get_initial_newlist_length(op, args)
         return SpaceOperation('newlist_hint',
-                              [structdescr, lengthdescr, itemsdescr,
-                               arraydescr, v_hint],
+                              [v_hint, structdescr, lengthdescr, itemsdescr,
+                               arraydescr],
                               op.result)
 
     def do_resizable_list_getitem(self, op, args, arraydescr, lengthdescr,
                                                  'check_resizable_neg_index')
         kind = getkind(op.result.concretetype)[0]
         op = SpaceOperation('getlistitem_gc_%s' % kind,
-                            [args[0], itemsdescr, arraydescr, v_index],
+                            [args[0], v_index, itemsdescr, arraydescr],
                             op.result)
         return extraop + [op]
 
                                                  'check_resizable_neg_index')
         kind = getkind(args[2].concretetype)[0]
         op = SpaceOperation('setlistitem_gc_%s' % kind,
-                            [args[0], itemsdescr, arraydescr,
-                             v_index, args[2]], None)
+                            [args[0], v_index, args[2],
+                             itemsdescr, arraydescr], None)
         return extraop + [op]
 
     def do_resizable_list_len(self, op, args, arraydescr, lengthdescr,
             self.callcontrol.callinfocollection.add(oopspecindex,
                                                     calldescr, func)
         op1 = self.rewrite_call(op, 'residual_call',
-                                [op.args[0], calldescr],
-                                args=args)
+                                [op.args[0]],
+                                args=args, calldescr=calldescr)
         if self.callcontrol.calldescr_canraise(calldescr):
             op1 = [op1, SpaceOperation('-live-', [], None)]
         return op1

pypy/jit/codewriter/test/test_flatten.py

                 return 4
 
         self.encoding_test(f, [65], """
-            residual_call_ir_v $<* fn g>, <Descr>, I[%i0], R[]
+            residual_call_ir_v $<* fn g>, I[%i0], R[], <Descr>
             -live-
             catch_exception L1
             int_return $4
                 foo.sideeffect = 5
 
         self.encoding_test(f, [65], """
-        residual_call_ir_v $<* fn get_exception>, <Descr>, I[%i0], R[]
+        residual_call_ir_v $<* fn get_exception>, I[%i0], R[], <Descr>
         -live-
         catch_exception L1
-        setfield_gc_i $<* struct test.Foo>, <Descr>, $5
+        setfield_gc_i $<* struct test.Foo>, $5, <Descr>
         void_return
         ---
         L1:
         last_exception -> %i1
         last_exc_value -> %r0
-        setfield_gc_i $<* struct test.Foo>, <Descr>, $5
+        setfield_gc_i $<* struct test.Foo>, $5, <Descr>
         -live-
         raise %r0
         """, transform=True)
             except ZeroDivisionError:
                 return -42
         self.encoding_test(f, [7, 2], """
-            residual_call_ir_i $<* fn int_floordiv_ovf_zer>, <Descr>, I[%i0, %i1], R[] -> %i2
+            residual_call_ir_i $<* fn int_floordiv_ovf_zer>, I[%i0, %i1], R[], <Descr> -> %i2
             -live-
             catch_exception L1
             int_return %i2
                 return 42
         # XXX so far, this really produces a int_mod_ovf_zer...
         self.encoding_test(f, [7, 2], """
-            residual_call_ir_i $<* fn int_mod_ovf_zer>, <Descr>, I[%i0, %i1], R[] -> %i2
+            residual_call_ir_i $<* fn int_mod_ovf_zer>, I[%i0, %i1], R[], <Descr> -> %i2
             -live-
             catch_exception L1
             int_return %i2
             except Exception:
                 return 42 + j
         self.encoding_test(f, [7, 2], """
-            residual_call_ir_i $<* fn g>, <Descr>, I[%i0, %i1], R[] -> %i2
+            residual_call_ir_i $<* fn g>, I[%i0, %i1], R[], <Descr> -> %i2
             -live- %i1, %i2
             catch_exception L1
             int_return %i2
             except Exception:
                 return 42 + j
         self.encoding_test(f, [7, 2], """
-            residual_call_ir_i $<* fn cannot_raise>, <Descr>, I[%i0, %i1], R[] -> %i2
+            residual_call_ir_i $<* fn cannot_raise>, I[%i0, %i1], R[], <Descr> -> %i2
             int_return %i2
         """, transform=True, liveness=True)
 
             keepalive_until_here(q)
             return x
         self.encoding_test(f, [5], """
-            residual_call_r_r $<* fn g>, <Descr>, R[] -> %r0
+            residual_call_r_r $<* fn g>, R[], <Descr> -> %r0
             -live-
-            residual_call_r_r $<* fn g>, <Descr>, R[] -> %r1
+            residual_call_r_r $<* fn g>, R[], <Descr> -> %r1
             -live-
             -live- %r0
             -live- %r1
             int_return %i0
         """, transform=True)
         self.encoding_test(f, [5], """
-            residual_call_r_r $<* fn g>, <Descr>, R[] -> %r0
+            residual_call_r_r $<* fn g>, R[], <Descr> -> %r0
             -live- %i0, %r0
-            residual_call_r_r $<* fn g>, <Descr>, R[] -> %r1
+            residual_call_r_r $<* fn g>, R[], <Descr> -> %r1
             -live- %i0, %r0, %r1
             -live- %i0, %r0, %r1
             -live- %i0, %r1
         self.encoding_test(f, [], """
             new_with_vtable <Descr> -> %r0
             virtual_ref %r0 -> %r1
-            residual_call_r_r $<* fn jit_force_virtual>, <Descr>, R[%r1] -> %r2
+            residual_call_r_r $<* fn jit_force_virtual>, R[%r1], <Descr> -> %r2
             ref_return %r2
         """, transform=True, cc=FakeCallControlWithVRefInfo())
 
             array[2] = 5
             return array[2] + len(array)
         self.encoding_test(f, [], """
-            new_array <Descr>, $5 -> %r0
-            setarrayitem_gc_i %r0, <Descr>, $2, $5
-            getarrayitem_gc_i %r0, <Descr>, $2 -> %i0
+            new_array $5, <Descr> -> %r0
+            setarrayitem_gc_i %r0, $2, $5, <Descr>
+            getarrayitem_gc_i %r0, $2, <Descr> -> %i0
             arraylen_gc %r0, <Descr> -> %i1
             int_add %i0, %i1 -> %i2
             int_return %i2
             x = array[2]
             return len(array)
         self.encoding_test(f, [], """
-            new_array <Descr>, $5 -> %r0
+            new_array $5, <Descr> -> %r0
             arraylen_gc %r0, <Descr> -> %i0
             int_return %i0
         """, transform=True)
                     else:
                         FROM = rffi.ULONGLONG
                     expected.insert(0,
-                        "residual_call_irf_i $<* fn llong_to_int>, <Descr>, I[], R[], F[%f0] -> %i0")
+                        "residual_call_irf_i $<* fn llong_to_int>, I[], R[], F[%f0], <Descr> -> %i0")
                     expectedstr = '\n'.join(expected)
                     self.encoding_test(f, [rffi.cast(FROM, 42)], expectedstr,
                                        transform=True)
                         fnname = "u" + fnname
                     expected.pop()   # remove int_return
                     expected.append(
-                        "residual_call_irf_f $<* fn %s>, <Descr>, I[%s], R[], F[] -> %%f0"
+                        "residual_call_irf_f $<* fn %s>, I[%s], R[], F[], <Descr> -> %%f0"
                         % (fnname, returnvar))
                     expected.append("float_return %f0")
                     expectedstr = '\n'.join(expected)
         def f(dbl):
             return rffi.cast(lltype.Unsigned, dbl)
         self.encoding_test(f, [12.456], """
-            residual_call_irf_i $<* fn cast_float_to_uint>, <Descr>, I[], R[], F[%f0] -> %i0
+            residual_call_irf_i $<* fn cast_float_to_uint>, I[], R[], F[%f0], <Descr> -> %i0
             int_return %i0
         """, transform=True)
 
         def f(i):
             return rffi.cast(lltype.Float, r_uint(i))    # "uint -> float"
         self.encoding_test(f, [12], """
-            residual_call_irf_f $<* fn cast_uint_to_float>, <Descr>, I[%i0], R[], F[] -> %f0
+            residual_call_irf_f $<* fn cast_uint_to_float>, I[%i0], R[], F[], <Descr> -> %f0
             float_return %f0
         """, transform=True)
 
             def f(dbl):
                 return rffi.cast(lltype.SignedLongLong, dbl)
             self.encoding_test(f, [12.3], """
-                residual_call_irf_f $<* fn llong_from_float>, <Descr>, I[], R[], F[%f0] -> %f1
+                residual_call_irf_f $<* fn llong_from_float>, I[], R[], F[%f0], <Descr> -> %f1
                 float_return %f1
             """, transform=True)
 
             def f(dbl):
                 return rffi.cast(lltype.UnsignedLongLong, dbl)
             self.encoding_test(f, [12.3], """
-                residual_call_irf_f $<* fn ullong_from_float>, <Descr>, I[], R[], F[%f0] -> %f1
+                residual_call_irf_f $<* fn ullong_from_float>, I[], R[], F[%f0], <Descr> -> %f1
                 float_return %f1
             """, transform=True)
 
                 ll = r_longlong(x)
                 return rffi.cast(lltype.Float, ll)
             self.encoding_test(f, [12], """
-                residual_call_irf_f $<* fn llong_from_int>, <Descr>, I[%i0], R[], F[] -> %f0
-                residual_call_irf_f $<* fn llong_to_float>, <Descr>, I[], R[], F[%f0] -> %f1
+                residual_call_irf_f $<* fn llong_from_int>, I[%i0], R[], F[], <Descr> -> %f0
+                residual_call_irf_f $<* fn llong_to_float>, I[], R[], F[%f0], <Descr> -> %f1
                 float_return %f1
             """, transform=True)
 
                 ll = r_ulonglong(x)
                 return rffi.cast(lltype.Float, ll)
             self.encoding_test(f, [12], """
-                residual_call_irf_f $<* fn ullong_from_int>, <Descr>, I[%i0], R[], F[] -> %f0
-                residual_call_irf_f $<* fn ullong_u_to_float>, <Descr>, I[], R[], F[%f0] -> %f1
+                residual_call_irf_f $<* fn ullong_from_int>, I[%i0], R[], F[], <Descr> -> %f0
+                residual_call_irf_f $<* fn ullong_u_to_float>, I[], R[], F[%f0], <Descr> -> %f1
                 float_return %f1
             """, transform=True)
 

pypy/jit/codewriter/test/test_jtransform.py

     assert op0.opname == 'residual_call_%s_%s' % (expectedkind, reskind)
     assert op0.result == op.result
     assert op0.args[0] == op.args[0]
-    assert op0.args[1] == 'calldescr'
-    assert len(op0.args) == 2 + len(expectedkind)
-    for sublist, kind1 in zip(op0.args[2:], expectedkind):
+    assert op0.args[-1] == 'calldescr'
+    assert len(op0.args) == 1 + len(expectedkind) + 1
+    for sublist, kind1 in zip(op0.args[1:-1], expectedkind):
         assert sublist.kind.startswith(kind1)
         assert list(sublist) == [v for v in op.args[1:]
                                  if getkind(v.concretetype) == sublist.kind]
     assert op0.opname == 'residual_call_%s_%s' % (expectedkind, reskind)
     assert op0.result == op.result
     assert op0.args[0] == op.args[0]
-    assert op0.args[1] == 'calldescr'
-    assert len(op0.args) == 2 + len(expectedkind)
-    for sublist, kind1 in zip(op0.args[2:], expectedkind):
+    assert op0.args[-1] == 'calldescr'
+    assert len(op0.args) == 1 + len(expectedkind) + 1
+    for sublist, kind1 in zip(op0.args[1:-1], expectedkind):
         assert sublist.kind.startswith(kind1)
         assert list(sublist) == [v for v in op.args[1:]
                                  if getkind(v.concretetype)==sublist.kind]
     assert op0.opname == 'residual_call_%s_%s' % (expectedkind, reskind)
     assert op0.result == op.result
     assert op0.args[0] == op.args[0]
-    assert op0.args[1] == 'calldescr'
-    assert isinstance(op0.args[2], IndirectCallTargets)
-    assert op0.args[2].lst == ['somejitcode1', 'somejitcode2']
-    assert len(op0.args) == 3 + len(expectedkind)
-    for sublist, kind1 in zip(op0.args[3:], expectedkind):
+    assert isinstance(op0.args[1], IndirectCallTargets)
+    assert op0.args[1].lst == ['somejitcode1', 'somejitcode2']
+    assert op0.args[-1] == 'calldescr'
+    assert len(op0.args) == 2 + len(expectedkind) + 1
+    for sublist, kind1 in zip(op0.args[2:-1], expectedkind):
         assert sublist.kind.startswith(kind1)
         assert list(sublist) == [v for v in op.args[1:]
                                  if getkind(v.concretetype)==sublist.kind]
         op1 = Transformer(FakeCPU()).rewrite_operation(op)
         assert op1.opname == 'setfield_gc_' + suffix
         fielddescr = ('fielddescr', S, name)
-        assert op1.args == [v_parent, fielddescr, v_newvalue]
+        assert op1.args == [v_parent, v_newvalue, fielddescr]
         assert op1.result is None
 
 def test_malloc_new():
     op0, op1 = oplist
     assert op0.opname == 'residual_call_r_r'
     assert op0.args[0].value == 'alloc_with_del'    # pseudo-function as a str
-    assert list(op0.args[2]) == []
+    assert list(op0.args[1]) == []
     assert op1.opname == '-live-'
     assert op1.args == []
 
     op0, op1 = tr.rewrite_operation(op)
     assert op0.opname == 'residual_call_ir_i'
     assert op0.args[0].value == 'raw_malloc_varsize' # pseudo-function as a str
-    assert (op0.args[1] == 'calldescr-%d' %
+    assert (op0.args[-1] == 'calldescr-%d' %
             effectinfo.EffectInfo.OS_RAW_MALLOC_VARSIZE)
 
     assert op1.opname == '-live-'
     op0 = tr.rewrite_operation(op)
     assert op0.opname == 'residual_call_ir_v'
     assert op0.args[0].value == 'raw_free'
-    assert op0.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_RAW_FREE
+    assert op0.args[-1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_RAW_FREE
 
 def test_raw_free_no_track_allocation():
     S = rffi.CArray(lltype.Signed)
     assert op1.opname == 'raw_store_i'
     assert op1.args[0] == v_storage
     assert op1.args[1] == v_index
-    assert op1.args[2] == ('arraydescr', rffi.CArray(lltype.Signed))
-    assert op1.args[3] == v_item
+    assert op1.args[2] == v_item
+    assert op1.args[3] == ('arraydescr', rffi.CArray(lltype.Signed))
 
 def test_raw_load():
     v_storage = varoftype(llmemory.Address)
     op1 = tr.rewrite_operation(op)
     assert op1.opname == 'residual_call_r_r'
     assert op1.args[0].value == func
-    assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_STR_CONCAT
-    assert op1.args[2] == ListOfKind('ref', [v1, v2])
+    assert op1.args[1] == ListOfKind('ref', [v1, v2])
+    assert op1.args[2] == 'calldescr-%d' % effectinfo.EffectInfo.OS_STR_CONCAT
     assert op1.result == v3
 
 def test_str_promote():
     op1 = tr.rewrite_operation(op)
     assert op1.opname == 'residual_call_r_r'
     assert op1.args[0].value == func
-    assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_UNI_CONCAT
-    assert op1.args[2] == ListOfKind('ref', [v1, v2])
+    assert op1.args[1] == ListOfKind('ref', [v1, v2])
+    assert op1.args[2] == 'calldescr-%d' % effectinfo.EffectInfo.OS_UNI_CONCAT
     assert op1.result == v3
     #
     # check the callinfo_for_oopspec
     got = cc.callinfocollection.seen[0]
     assert got[0] == effectinfo.EffectInfo.OS_UNI_CONCAT
-    assert got[1] == op1.args[1]    # the calldescr
+    assert got[1] == op1.args[2]    # the calldescr
     assert heaptracker.int2adr(got[2]) == llmemory.cast_ptr_to_adr(func)
 
 def test_str_slice():
     op1 = tr.rewrite_operation(op)
     assert op1.opname == 'residual_call_ir_r'
     assert op1.args[0].value == func
-    assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_STR_SLICE
-    assert op1.args[2] == ListOfKind('int', [v2, v3])
-    assert op1.args[3] == ListOfKind('ref', [v1])
+    assert op1.args[1] == ListOfKind('int', [v2, v3])
+    assert op1.args[2] == ListOfKind('ref', [v1])
+    assert op1.args[3] == 'calldescr-%d' % effectinfo.EffectInfo.OS_STR_SLICE
     assert op1.result == v4
 
 def test_unicode_slice():
     op1 = tr.rewrite_operation(op)
     assert op1.opname == 'residual_call_ir_r'
     assert op1.args[0].value == func
-    assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_UNI_SLICE
-    assert op1.args[2] == ListOfKind('int', [v2, v3])
-    assert op1.args[3] == ListOfKind('ref', [v1])
+    assert op1.args[1] == ListOfKind('int', [v2, v3])
+    assert op1.args[2] == ListOfKind('ref', [v1])
+    assert op1.args[3] == 'calldescr-%d' % effectinfo.EffectInfo.OS_UNI_SLICE
     assert op1.result == v4
 
 def test_str2unicode():
     op1 = tr.rewrite_operation(op)
     assert op1.opname == 'residual_call_r_r'
     assert op1.args[0].value == func
-    assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_STR2UNICODE
-    assert op1.args[2] == ListOfKind('ref', [v1])
+    assert op1.args[1] == ListOfKind('ref', [v1])
+    assert op1.args[2] == 'calldescr-%d' % effectinfo.EffectInfo.OS_STR2UNICODE
     assert op1.result == v2
 
 def test_unicode_eq_checknull_char():
     op1 = tr.rewrite_operation(op)
     assert op1.opname == 'residual_call_r_i'
     assert op1.args[0].value == func
-    assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_UNI_EQUAL
-    assert op1.args[2] == ListOfKind('ref', [v1, v2])
+    assert op1.args[1] == ListOfKind('ref', [v1, v2])
+    assert op1.args[2] == 'calldescr-%d' % effectinfo.EffectInfo.OS_UNI_EQUAL
     assert op1.result == v3
     # test that the OS_UNIEQ_* functions are registered
     cic = cc.callinfocollection
     op1 = tr.rewrite_operation(op)
     assert op1.opname == 'residual_call_ir_v'
     assert op1.args[0].value == func
-    assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_ARRAYCOPY
-    assert op1.args[2] == ListOfKind('int', [v3, v4, v5])
-    assert op1.args[3] == ListOfKind('ref', [v1, v2])
+    assert op1.args[1] == ListOfKind('int', [v3, v4, v5])
+    assert op1.args[2] == ListOfKind('ref', [v1, v2])
+    assert op1.args[3] == 'calldescr-%d' % effectinfo.EffectInfo.OS_ARRAYCOPY
 
 def test_math_sqrt():
     # test that the oopspec is present and correctly transformed
     op1 = tr.rewrite_operation(op)
     assert op1.opname == 'residual_call_irf_f'
     assert op1.args[0].value == func
-    assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_MATH_SQRT
-    assert op1.args[2] == ListOfKind("int", [])
-    assert op1.args[3] == ListOfKind("ref", [])
-    assert op1.args[4] == ListOfKind('float', [v1])
+    assert op1.args[1] == ListOfKind("int", [])
+    assert op1.args[2] == ListOfKind("ref", [])
+    assert op1.args[3] == ListOfKind('float', [v1])
+    assert op1.args[4] == 'calldescr-%d' % effectinfo.EffectInfo.OS_MATH_SQRT
     assert op1.result == v2
 
 def test_quasi_immutable():

pypy/jit/codewriter/test/test_list.py

 
 def test_newlist():
     builtin_test('newlist', [], FIXEDLIST,
-                 """new_array <ArrayDescr>, $0 -> %r0""")
+                 """new_array $0, <ArrayDescr> -> %r0""")
     builtin_test('newlist', [Constant(5, lltype.Signed)], FIXEDLIST,
-                 """new_array <ArrayDescr>, $5 -> %r0""")
+                 """new_array $5, <ArrayDescr> -> %r0""")
     builtin_test('newlist', [Constant(-2, lltype.Signed)], FIXEDLIST,
-                 """new_array <ArrayDescr>, $0 -> %r0""")
+                 """new_array $0, <ArrayDescr> -> %r0""")
     builtin_test('newlist', [varoftype(lltype.Signed)], FIXEDLIST,
                  """int_force_ge_zero %i0 -> %i1\n"""
-                 """new_array <ArrayDescr>, %i1 -> %r0""")
+                 """new_array %i1, <ArrayDescr> -> %r0""")
     builtin_test('newlist', [Constant(5, lltype.Signed),
                              Constant(0, lltype.Signed)], FIXEDLIST,
-                 """new_array <ArrayDescr>, $5 -> %r0""")
+                 """new_array $5, <ArrayDescr> -> %r0""")
     builtin_test('newlist', [Constant(5, lltype.Signed),
                              Constant(1, lltype.Signed)], FIXEDLIST,
                  NotSupported)
                   varoftype(lltype.Signed), 
                   varoftype(lltype.Signed)],
                  lltype.Void, """
-                     residual_call_ir_v $'myfunc', <CallDescrOS1>, I[%i0, %i1, %i2], R[%r0, %r1]
+                     residual_call_ir_v $'myfunc', I[%i0, %i1, %i2], R[%r0, %r1], <CallDescrOS1>
                  """)
 
 def test_fixed_getitem():
     builtin_test('list.getitem/NONNEG',
                  [varoftype(FIXEDLIST), varoftype(lltype.Signed)],
                  lltype.Signed, """
-                     getarrayitem_gc_i %r0, <ArrayDescr>, %i0 -> %i1
+                     getarrayitem_gc_i %r0, %i0, <ArrayDescr> -> %i1
                  """)
     builtin_test('list.getitem/NEG',
                  [varoftype(FIXEDLIST), varoftype(lltype.Signed)],
                  lltype.Signed, """
                      -live-
-                     check_neg_index %r0, <ArrayDescr>, %i0 -> %i1
-                     getarrayitem_gc_i %r0, <ArrayDescr>, %i1 -> %i2
+                     check_neg_index %r0, %i0, <ArrayDescr> -> %i1
+                     getarrayitem_gc_i %r0, %i1, <ArrayDescr> -> %i2
                  """)
 
 def test_fixed_getitem_foldable():
     builtin_test('list.getitem_foldable/NONNEG',
                  [varoftype(FIXEDLIST), varoftype(lltype.Signed)],
                  lltype.Signed, """
-                     getarrayitem_gc_i_pure %r0, <ArrayDescr>, %i0 -> %i1
+                     getarrayitem_gc_i_pure %r0, %i0, <ArrayDescr> -> %i1
                  """)
     builtin_test('list.getitem_foldable/NEG',
                  [varoftype(FIXEDLIST), varoftype(lltype.Signed)],
                  lltype.Signed, """
                      -live-
-                     check_neg_index %r0, <ArrayDescr>, %i0 -> %i1
-                     getarrayitem_gc_i_pure %r0, <ArrayDescr>, %i1 -> %i2
+                     check_neg_index %r0, %i0, <ArrayDescr> -> %i1
+                     getarrayitem_gc_i_pure %r0, %i1, <ArrayDescr> -> %i2
                  """)
 
 def test_fixed_setitem():
                                          varoftype(lltype.Signed),
                                          varoftype(lltype.Signed)],
                  lltype.Void, """
-                     setarrayitem_gc_i %r0, <ArrayDescr>, %i0, %i1
+                     setarrayitem_gc_i %r0, %i0, %i1, <ArrayDescr>
                  """)
     builtin_test('list.setitem/NEG', [varoftype(FIXEDLIST),
                                       varoftype(lltype.Signed),
                                       varoftype(lltype.Signed)],
                  lltype.Void, """
                      -live-
-                     check_neg_index %r0, <ArrayDescr>, %i0 -> %i1
-                     setarrayitem_gc_i %r0, <ArrayDescr>, %i1, %i2
+                     check_neg_index %r0, %i0, <ArrayDescr> -> %i1
+                     setarrayitem_gc_i %r0, %i1, %i2, <ArrayDescr>
                  """)
 
 def test_fixed_len():
     alldescrs = ("<SizeDescr>, <FieldDescr length>,"
                  " <FieldDescr items>, <ArrayDescr>")
     builtin_test('newlist', [], VARLIST,
-                 """newlist """+alldescrs+""", $0 -> %r0""")
+                 """newlist $0, """+alldescrs+""" -> %r0""")
     builtin_test('newlist', [Constant(5, lltype.Signed)], VARLIST,
-                 """newlist """+alldescrs+""", $5 -> %r0""")
+                 """newlist $5, """+alldescrs+""" -> %r0""")
     builtin_test('newlist', [varoftype(lltype.Signed)], VARLIST,
-                 """newlist """+alldescrs+""", %i0 -> %r0""")
+                 """newlist %i0, """+alldescrs+""" -> %r0""")
     builtin_test('newlist', [Constant(5, lltype.Signed),
                              Constant(0, lltype.Signed)], VARLIST,
-                 """newlist """+alldescrs+""", $5 -> %r0""")
+                 """newlist $5, """+alldescrs+""" -> %r0""")
     builtin_test('newlist', [Constant(5, lltype.Signed),
                              Constant(1, lltype.Signed)], VARLIST,
                  NotSupported)
     builtin_test('list.getitem/NONNEG',
                  [varoftype(VARLIST), varoftype(lltype.Signed)],
                  lltype.Signed, """
-        getlistitem_gc_i %r0, <FieldDescr items>, <ArrayDescr>, %i0 -> %i1
+        getlistitem_gc_i %r0, %i0, <FieldDescr items>, <ArrayDescr> -> %i1
                  """)
     builtin_test('list.getitem/NEG',
                  [varoftype(VARLIST), varoftype(lltype.Signed)],
                  lltype.Signed, """
         -live-
-        check_resizable_neg_index %r0, <FieldDescr length>, %i0 -> %i1
-        getlistitem_gc_i %r0, <FieldDescr items>, <ArrayDescr>, %i1 -> %i2
+        check_resizable_neg_index %r0, %i0, <FieldDescr length> -> %i1
+        getlistitem_gc_i %r0, %i1, <FieldDescr items>, <ArrayDescr> -> %i2
                  """)
 
 def test_resizable_setitem():
                                          varoftype(lltype.Signed),
                                          varoftype(lltype.Signed)],
                  lltype.Void, """
-        setlistitem_gc_i %r0, <FieldDescr items>, <ArrayDescr>, %i0, %i1
+        setlistitem_gc_i %r0, %i0, %i1, <FieldDescr items>, <ArrayDescr>
                  """)
     builtin_test('list.setitem/NEG', [varoftype(VARLIST),
                                       varoftype(lltype.Signed),
                                       varoftype(lltype.Signed)],
                  lltype.Void, """
         -live-
-        check_resizable_neg_index %r0, <FieldDescr length>, %i0 -> %i1
-        setlistitem_gc_i %r0, <FieldDescr items>, <ArrayDescr>, %i1, %i2
+        check_resizable_neg_index %r0, %i0, <FieldDescr length> -> %i1
+        setlistitem_gc_i %r0, %i1, %i2, <FieldDescr items>, <ArrayDescr>
                  """)
 
 def test_resizable_len():

pypy/jit/codewriter/test/test_longlong.py

         gotindex = getattr(EffectInfo,
                            'OS_' + op1.args[0].value.upper().lstrip('U'))
         assert gotindex == oopspecindex
-        assert op1.args[1] == 'calldescr-%d' % oopspecindex
-        assert list(op1.args[2]) == [v for v in vlist
+        assert list(op1.args[1]) == [v for v in vlist
                                      if not is_llf(v.concretetype)]
-        assert list(op1.args[3]) == []
-        assert list(op1.args[4]) == [v for v in vlist
+        assert list(op1.args[2]) == []
+        assert list(op1.args[3]) == [v for v in vlist
                                      if is_llf(v.concretetype)]
+        assert op1.args[4] == 'calldescr-%d' % oopspecindex
         assert op1.result == v_result
 
     def test_is_true(self):
             assert len(oplist) == 2
             assert oplist[0].opname == 'residual_call_irf_f'
             assert oplist[0].args[0].value == opname.split('_')[0]+'_from_int'
-            assert oplist[0].args[1] == 'calldescr-84'
-            assert list(oplist[0].args[2]) == [const(0)]
+            assert list(oplist[0].args[1]) == [const(0)]
+            assert list(oplist[0].args[2]) == []
             assert list(oplist[0].args[3]) == []
-            assert list(oplist[0].args[4]) == []
+            assert oplist[0].args[4] == 'calldescr-84'
             v_x = oplist[0].result
             assert isinstance(v_x, Variable)
             assert v_x.concretetype is T
             assert oplist[1].opname == 'residual_call_irf_i'
             assert oplist[1].args[0].value == 'llong_ne'
-            assert oplist[1].args[1] == 'calldescr-76'
+            assert list(oplist[1].args[1]) == []
             assert list(oplist[1].args[2]) == []
-            assert list(oplist[1].args[3]) == []
-            assert list(oplist[1].args[4]) == [v, v_x]
+            assert list(oplist[1].args[3]) == [v, v_x]
+            assert oplist[1].args[4] == 'calldescr-76'
             assert oplist[1].result == v_result
 
     def test_llong_neg(self):
         assert len(oplist) == 2
         assert oplist[0].opname == 'residual_call_irf_f'
         assert oplist[0].args[0].value == 'llong_from_int'
-        assert oplist[0].args[1] == 'calldescr-84'
-        assert list(oplist[0].args[2]) == [const(0)]
+        assert list(oplist[0].args[1]) == [const(0)]
+        assert list(oplist[0].args[2]) == []
         assert list(oplist[0].args[3]) == []
-        assert list(oplist[0].args[4]) == []
+        assert oplist[0].args[4] == 'calldescr-84'
         v_x = oplist[0].result
         assert isinstance(v_x, Variable)
         assert oplist[1].opname == 'residual_call_irf_f'
         assert oplist[1].args[0].value == 'llong_sub'
-        assert oplist[1].args[1] == 'calldescr-71'
+        assert list(oplist[1].args[1]) == []
         assert list(oplist[1].args[2]) == []
-        assert list(oplist[1].args[3]) == []
-        assert list(oplist[1].args[4]) == [v_x, v]
+        assert list(oplist[1].args[3]) == [v_x, v]
+        assert oplist[1].args[4] == 'calldescr-71'
         assert oplist[1].result == v_result
 
     def test_unary_op(self):
             op1 = tr.rewrite_operation(op)
             #
             assert op1.opname == 'residual_call_irf_f'
+            assert list(op1.args[1]) == []
             assert list(op1.args[2]) == []
-            assert list(op1.args[3]) == []
-            assert list(op1.args[4]) == vlist
+            assert list(op1.args[3]) == vlist
             assert op1.result == v_result
 
 

pypy/jit/codewriter/test/test_regalloc.py

         #    last_exc_value -> %r0
         #    ref_copy %r0 -> %r1    -- but expect to read the old value of %r0!
         self.check_assembler(graph, """
-            residual_call_r_r $<* fn bar>, <Descr>, R[%r0] -> %r1
+            residual_call_r_r $<* fn bar>, R[%r0], <Descr> -> %r1
             -live-
-            residual_call_ir_r $<* fn g>, <Descr>, I[%i0], R[] -> %r1
+            residual_call_ir_r $<* fn g>, I[%i0], R[], <Descr> -> %r1
             -live-
             catch_exception L1
             ref_return %r1
             goto_if_exception_mismatch $<* struct object_vtable>, L2
             ref_copy %r0 -> %r1
             last_exc_value -> %r0
-            residual_call_r_r $<* fn foo>, <Descr>, R[%r0] -> %r0
+            residual_call_r_r $<* fn foo>, R[%r0], <Descr> -> %r0
             -live-
             ref_return %r1
             ---

pypy/jit/metainterp/blackhole.py

     def bhimpl_recursive_call_i(self, jdindex, greens_i, greens_r, greens_f,
                                                reds_i,   reds_r,   reds_f):
         fnptr, calldescr = self.get_portal_runner(jdindex)
-        return self.cpu.bh_call_i(fnptr, calldescr,
+        return self.cpu.bh_call_i(fnptr,
                                   greens_i + reds_i,
                                   greens_r + reds_r,
-                                  greens_f + reds_f)
+                                  greens_f + reds_f, calldescr)
     @arguments("self", "i", "I", "R", "F", "I", "R", "F", returns="r")
     def bhimpl_recursive_call_r(self, jdindex, greens_i, greens_r, greens_f,
                                                reds_i,   reds_r,   reds_f):
         fnptr, calldescr = self.get_portal_runner(jdindex)
-        return self.cpu.bh_call_r(fnptr, calldescr,
+        return self.cpu.bh_call_r(fnptr,
                                   greens_i + reds_i,
                                   greens_r + reds_r,
-                                  greens_f + reds_f)
+                                  greens_f + reds_f, calldescr)
     @arguments("self", "i", "I", "R", "F", "I", "R", "F", returns="f")
     def bhimpl_recursive_call_f(self, jdindex, greens_i, greens_r, greens_f,
                                                reds_i,   reds_r,   reds_f):
         fnptr, calldescr = self.get_portal_runner(jdindex)
-        return self.cpu.bh_call_f(fnptr, calldescr,
+        return self.cpu.bh_call_f(fnptr,
                                   greens_i + reds_i,
                                   greens_r + reds_r,
-                                  greens_f + reds_f)
+                                  greens_f + reds_f, calldescr)
     @arguments("self", "i", "I", "R", "F", "I", "R", "F")
     def bhimpl_recursive_call_v(self, jdindex, greens_i, greens_r, greens_f,
                                                reds_i,   reds_r,   reds_f):
         fnptr, calldescr = self.get_portal_runner(jdindex)
-        return self.cpu.bh_call_v(fnptr, calldescr,
+        return self.cpu.bh_call_v(fnptr,
                                   greens_i + reds_i,
                                   greens_r + reds_r,
-                                  greens_f + reds_f)
+                                  greens_f + reds_f, calldescr)
 
     # ----------
     # virtual refs
     # ----------
     # list operations
 
-    @arguments("cpu", "r", "d", "i", returns="i")
-    def bhimpl_check_neg_index(cpu, array, arraydescr, index):
+    @arguments("cpu", "r", "i", "d", returns="i")
+    def bhimpl_check_neg_index(cpu, array, index, arraydescr):
         if index < 0:
-            index += cpu.bh_arraylen_gc(arraydescr, array)
+            index += cpu.bh_arraylen_gc(array, arraydescr)
         return index
 
-    @arguments("cpu", "r", "d", "i", returns="i")
-    def bhimpl_check_resizable_neg_index(cpu, lst, lengthdescr, index):
+    @arguments("cpu", "r", "i", "d", returns="i")
+    def bhimpl_check_resizable_neg_index(cpu, lst, index, lengthdescr):
         if index < 0:
             index += cpu.bh_getfield_gc_i(lst, lengthdescr)
         return index
 
-    @arguments("cpu", "d", "d", "d", "d", "i", returns="r")
-    def bhimpl_newlist(cpu, structdescr, lengthdescr, itemsdescr,
-                       arraydescr, length):
+    @arguments("cpu", "i", "d", "d", "d", "d", returns="r")
+    def bhimpl_newlist(cpu, length, structdescr, lengthdescr,
+                       itemsdescr, arraydescr):
         result = cpu.bh_new(structdescr)
-        cpu.bh_setfield_gc_i(result, lengthdescr, length)
-        items = cpu.bh_new_array(arraydescr, length)
-        cpu.bh_setfield_gc_r(result, itemsdescr, items)
+        cpu.bh_setfield_gc_i(result, length, lengthdescr)
+        items = cpu.bh_new_array(length, arraydescr)
+        cpu.bh_setfield_gc_r(result, items, itemsdescr)
         return result
 
-    @arguments("cpu", "d", "d", "d", "d", "i", returns="r")
-    def bhimpl_newlist_hint(cpu, structdescr, lengthdescr, itemsdescr,
-                            arraydescr, lengthhint):
+    @arguments("cpu", "i", "d", "d", "d", "d", returns="r")
+    def bhimpl_newlist_hint(cpu, lengthhint, structdescr, lengthdescr,
+                            itemsdescr, arraydescr):
         result = cpu.bh_new(structdescr)
-        cpu.bh_setfield_gc_i(result, lengthdescr, 0)
-        items = cpu.bh_new_array(arraydescr, lengthhint)
-        cpu.bh_setfield_gc_r(result, itemsdescr, items)
+        cpu.bh_setfield_gc_i(result, 0, lengthdescr)
+        items = cpu.bh_new_array(lengthhint, arraydescr)
+        cpu.bh_setfield_gc_r(result, items, itemsdescr)
         return result
 
-    @arguments("cpu", "r", "d", "d", "i", returns="i")
-    def bhimpl_getlistitem_gc_i(cpu, lst, itemsdescr, arraydescr, index):
+    @arguments("cpu", "r", "i", "d", "d", returns="i")
+    def bhimpl_getlistitem_gc_i(cpu, lst, index, itemsdescr, arraydescr):
         items = cpu.bh_getfield_gc_r(lst, itemsdescr)
-        return cpu.bh_getarrayitem_gc_i(arraydescr, items, index)
-    @arguments("cpu", "r", "d", "d", "i", returns="r")
-    def bhimpl_getlistitem_gc_r(cpu, lst, itemsdescr, arraydescr, index):
+        return cpu.bh_getarrayitem_gc_i(items, index, arraydescr)
+    @arguments("cpu", "r", "i", "d", "d", returns="r")
+    def bhimpl_getlistitem_gc_r(cpu, lst, index, itemsdescr, arraydescr):
         items = cpu.bh_getfield_gc_r(lst, itemsdescr)
-        return cpu.bh_getarrayitem_gc_r(arraydescr, items, index)
-    @arguments("cpu", "r", "d", "d", "i", returns="f")
-    def bhimpl_getlistitem_gc_f(cpu, lst, itemsdescr, arraydescr, index):
+        return cpu.bh_getarrayitem_gc_r(items, index, arraydescr)
+    @arguments("cpu", "r", "i", "d", "d", returns="f")
+    def bhimpl_getlistitem_gc_f(cpu, lst, index, itemsdescr, arraydescr):
         items = cpu.bh_getfield_gc_r(lst, itemsdescr)
-        return cpu.bh_getarrayitem_gc_f(arraydescr, items, index)
+        return cpu.bh_getarrayitem_gc_f(items, index, arraydescr)
 
-    @arguments("cpu", "r", "d", "d", "i", "i")
-    def bhimpl_setlistitem_gc_i(cpu, lst, itemsdescr, arraydescr, index, nval):
+    @arguments("cpu", "r", "i", "i", "d", "d")
+    def bhimpl_setlistitem_gc_i(cpu, lst, index, nval, itemsdescr, arraydescr):
         items = cpu.bh_getfield_gc_r(lst, itemsdescr)
-        cpu.bh_setarrayitem_gc_i(arraydescr, items, index, nval)
-    @arguments("cpu", "r", "d", "d", "i", "r")
-    def bhimpl_setlistitem_gc_r(cpu, lst, itemsdescr, arraydescr, index, nval):
+        cpu.bh_setarrayitem_gc_i(items, index, nval, arraydescr)
+    @arguments("cpu", "r", "i", "r", "d", "d")
+    def bhimpl_setlistitem_gc_r(cpu, lst, index, nval, itemsdescr, arraydescr):
         items = cpu.bh_getfield_gc_r(lst, itemsdescr)
-        cpu.bh_setarrayitem_gc_r(arraydescr, items, index, nval)
-    @arguments("cpu", "r", "d", "d", "i", "f")
-    def bhimpl_setlistitem_gc_f(cpu, lst, itemsdescr, arraydescr, index, nval):
+        cpu.bh_setarrayitem_gc_r(items, index, nval, arraydescr)
+    @arguments("cpu", "r", "i", "f", "d", "d")
+    def bhimpl_setlistitem_gc_f(cpu, lst, index, nval, itemsdescr, arraydescr):
         items = cpu.bh_getfield_gc_r(lst, itemsdescr)
-        cpu.bh_setarrayitem_gc_f(arraydescr, items, index, nval)
+        cpu.bh_setarrayitem_gc_f(items, index, nval, arraydescr)
 
     # ----------
     # the following operations are directly implemented by the backend
 
-    @arguments("cpu", "i", "d", "R", returns="i")
-    def bhimpl_residual_call_r_i(cpu, func, calldescr, args_r):
-        return cpu.bh_call_i(func, calldescr, None, args_r, None)
-    @arguments("cpu", "i", "d", "R", returns="r")
-    def bhimpl_residual_call_r_r(cpu, func, calldescr, args_r):
-        return cpu.bh_call_r(func, calldescr, None, args_r, None)
-    @arguments("cpu", "i", "d", "R")
-    def bhimpl_residual_call_r_v(cpu, func, calldescr, args_r):
-        return cpu.bh_call_v(func, calldescr, None, args_r, None)
+    @arguments("cpu", "i", "R", "d", returns="i")
+    def bhimpl_residual_call_r_i(cpu, func, args_r, calldescr):
+        return cpu.bh_call_i(func, None, args_r, None, calldescr)
+    @arguments("cpu", "i", "R", "d", returns="r")
+    def bhimpl_residual_call_r_r(cpu, func, args_r, calldescr):
+        return cpu.bh_call_r(func, None, args_r, None, calldescr)
+    @arguments("cpu", "i", "R", "d")
+    def bhimpl_residual_call_r_v(cpu, func, args_r, calldescr):
+        return cpu.bh_call_v(func, None, args_r, None, calldescr)
 
-    @arguments("cpu", "i", "d", "I", "R", returns="i")
-    def bhimpl_residual_call_ir_i(cpu, func, calldescr, args_i, args_r):
-        return cpu.bh_call_i(func, calldescr, args_i, args_r, None)
-    @arguments("cpu", "i", "d", "I", "R", returns="r")
-    def bhimpl_residual_call_ir_r(cpu, func, calldescr, args_i, args_r):
-        return cpu.bh_call_r(func, calldescr, args_i, args_r, None)
-    @arguments("cpu", "i", "d", "I", "R")
-    def bhimpl_residual_call_ir_v(cpu, func, calldescr, args_i, args_r):
-        return cpu.bh_call_v(func, calldescr, args_i, args_r, None)
+    @arguments("cpu", "i", "I", "R", "d", returns="i")
+    def bhimpl_residual_call_ir_i(cpu, func, args_i, args_r, calldescr):
+        return cpu.bh_call_i(func, args_i, args_r, None, calldescr)
+    @arguments("cpu", "i", "I", "R", "d", returns="r")
+    def bhimpl_residual_call_ir_r(cpu, func, args_i, args_r, calldescr):
+        return cpu.bh_call_r(func, args_i, args_r, None, calldescr)
+    @arguments("cpu", "i", "I", "R", "d")
+    def bhimpl_residual_call_ir_v(cpu, func, args_i, args_r, calldescr):
+        return cpu.bh_call_v(func, args_i, args_r, None, calldescr)
 
-    @arguments("cpu", "i", "d", "I", "R", "F", returns="i")
-    def bhimpl_residual_call_irf_i(cpu, func, calldescr,args_i,args_r,args_f):
-        return cpu.bh_call_i(func, calldescr, args_i, args_r, args_f)
-    @arguments("cpu", "i", "d", "I", "R", "F", returns="r")
-    def bhimpl_residual_call_irf_r(cpu, func, calldescr,args_i,args_r,args_f):
-        return cpu.bh_call_r(func, calldescr, args_i, args_r, args_f)
-    @arguments("cpu", "i", "d", "I", "R", "F", returns="f")
-    def bhimpl_residual_call_irf_f(cpu, func, calldescr,args_i,args_r,args_f):
-        return cpu.bh_call_f(func, calldescr, args_i, args_r, args_f)
-    @arguments("cpu", "i", "d", "I", "R", "F")
-    def bhimpl_residual_call_irf_v(cpu, func, calldescr,args_i,args_r,args_f):
-        return cpu.bh_call_v(func, calldescr, args_i, args_r, args_f)
+    @arguments("cpu", "i", "I", "R", "F", "d", returns="i")
+    def bhimpl_residual_call_irf_i(cpu, func, args_i,args_r,args_f,calldescr):
+        return cpu.bh_call_i(func, args_i, args_r, args_f, calldescr)
+    @arguments("cpu", "i", "I", "R", "F", "d", returns="r")
+    def bhimpl_residual_call_irf_r(cpu, func, args_i,args_r,args_f,calldescr):
+        return cpu.bh_call_r(func, args_i, args_r, args_f, calldescr)
+    @arguments("cpu", "i", "I", "R", "F", "d", returns="f")
+    def bhimpl_residual_call_irf_f(cpu, func, args_i,args_r,args_f,calldescr):
+        return cpu.bh_call_f(func, args_i, args_r, args_f, calldescr)
+    @arguments("cpu", "i", "I", "R", "F", "d")
+    def bhimpl_residual_call_irf_v(cpu, func, args_i,args_r,args_f,calldescr):
+        return cpu.bh_call_v(func, args_i, args_r, args_f, calldescr)
 
     @arguments("cpu", "j", "R", returns="i")
     def bhimpl_inline_call_r_i(cpu, jitcode, args_r):
-        return cpu.bh_call_i(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             None, args_r, None)
+        return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
+                             None, args_r, None, jitcode.calldescr)
     @arguments("cpu", "j", "R", returns="r")
     def bhimpl_inline_call_r_r(cpu, jitcode, args_r):
-        return cpu.bh_call_r(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             None, args_r, None)
+        return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
+                             None, args_r, None, jitcode.calldescr)
     @arguments("cpu", "j", "R")
     def bhimpl_inline_call_r_v(cpu, jitcode, args_r):
-        return cpu.bh_call_v(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             None, args_r, None)
+        return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
+                             None, args_r, None, jitcode.calldescr)
 
     @arguments("cpu", "j", "I", "R", returns="i")
     def bhimpl_inline_call_ir_i(cpu, jitcode, args_i, args_r):
-        return cpu.bh_call_i(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             args_i, args_r, None)
+        return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
+                             args_i, args_r, None, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R", returns="r")
     def bhimpl_inline_call_ir_r(cpu, jitcode, args_i, args_r):
-        return cpu.bh_call_r(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             args_i, args_r, None)
+        return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
+                             args_i, args_r, None, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R")
     def bhimpl_inline_call_ir_v(cpu, jitcode, args_i, args_r):
-        return cpu.bh_call_v(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             args_i, args_r, None)
+        return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
+                             args_i, args_r, None, jitcode.calldescr)
 
     @arguments("cpu", "j", "I", "R", "F", returns="i")
     def bhimpl_inline_call_irf_i(cpu, jitcode, args_i, args_r, args_f):
-        return cpu.bh_call_i(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             args_i, args_r, args_f)
+        return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
+                             args_i, args_r, args_f, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R", "F", returns="r")
     def bhimpl_inline_call_irf_r(cpu, jitcode, args_i, args_r, args_f):
-        return cpu.bh_call_r(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             args_i, args_r, args_f)
+        return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
+                             args_i, args_r, args_f, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R", "F", returns="f")
     def bhimpl_inline_call_irf_f(cpu, jitcode, args_i, args_r, args_f):
-        return cpu.bh_call_f(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             args_i, args_r, args_f)
+        return cpu.bh_call_f(jitcode.get_fnaddr_as_int(),
+                             args_i, args_r, args_f, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R", "F")
     def bhimpl_inline_call_irf_v(cpu, jitcode, args_i, args_r, args_f):
-        return cpu.bh_call_v(jitcode.get_fnaddr_as_int(), jitcode.calldescr,
-                             args_i, args_r, args_f)
+        return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
+                             args_i, args_r, args_f, jitcode.calldescr)
 
-    @arguments("cpu", "d", "i", returns="r")
-    def bhimpl_new_array(cpu, arraydescr, length):
-        return cpu.bh_new_array(arraydescr, length)
+    @arguments("cpu", "i", "d", returns="r")
+    def bhimpl_new_array(cpu, length, arraydescr):
+        return cpu.bh_new_array(length, arraydescr)
 
-    @arguments("cpu", "r", "d", "i", returns="i")
-    def bhimpl_getarrayitem_gc_i(cpu, array, arraydescr, index):
-        return cpu.bh_getarrayitem_gc_i(arraydescr, array, index)
-    @arguments("cpu", "r", "d", "i", returns="r")
-    def bhimpl_getarrayitem_gc_r(cpu, array, arraydescr, index):
-        return cpu.bh_getarrayitem_gc_r(arraydescr, array, index)
-    @arguments("cpu", "r", "d", "i", returns="f")
-    def bhimpl_getarrayitem_gc_f(cpu, array, arraydescr, index):
-        return cpu.bh_getarrayitem_gc_f(arraydescr, array, index)
+    @arguments("cpu", "r", "i", "d", returns="i")
+    def bhimpl_getarrayitem_gc_i(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_gc_i(array, index, arraydescr)
+    @arguments("cpu", "r", "i", "d", returns="r")
+    def bhimpl_getarrayitem_gc_r(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_gc_r(array, index, arraydescr)
+    @arguments("cpu", "r", "i", "d", returns="f")
+    def bhimpl_getarrayitem_gc_f(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_gc_f(array, index, arraydescr)
 
     bhimpl_getarrayitem_gc_i_pure = bhimpl_getarrayitem_gc_i
     bhimpl_getarrayitem_gc_r_pure = bhimpl_getarrayitem_gc_r
     bhimpl_getarrayitem_gc_f_pure = bhimpl_getarrayitem_gc_f
 
-    @arguments("cpu", "i", "d", "i", returns="i")
-    def bhimpl_getarrayitem_raw_i(cpu, array, arraydescr, index):
-        return cpu.bh_getarrayitem_raw_i(arraydescr, array, index)
-    @arguments("cpu", "i", "d", "i", returns="f")
-    def bhimpl_getarrayitem_raw_f(cpu, array, arraydescr, index):
-        return cpu.bh_getarrayitem_raw_f(arraydescr, array, index)
+    @arguments("cpu", "i", "i", "d", returns="i")
+    def bhimpl_getarrayitem_raw_i(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_raw_i(array, index, arraydescr)
+    @arguments("cpu", "i", "i", "d", returns="f")
+    def bhimpl_getarrayitem_raw_f(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_raw_f(array, index, arraydescr)
 
     bhimpl_getarrayitem_raw_i_pure = bhimpl_getarrayitem_raw_i
     bhimpl_getarrayitem_raw_f_pure = bhimpl_getarrayitem_raw_f
 
-    @arguments("cpu", "r", "d", "i", "i")
-    def bhimpl_setarrayitem_gc_i(cpu, array, arraydescr, index, newvalue):
-        cpu.bh_setarrayitem_gc_i(arraydescr, array, index, newvalue)
-    @arguments("cpu", "r", "d", "i", "r")
-    def bhimpl_setarrayitem_gc_r(cpu, array, arraydescr, index, newvalue):
-        cpu.bh_setarrayitem_gc_r(arraydescr, array, index, newvalue)
-    @arguments("cpu", "r", "d", "i", "f")
-    def bhimpl_setarrayitem_gc_f(cpu, array, arraydescr, index, newvalue):
-        cpu.bh_setarrayitem_gc_f(arraydescr, array, index, newvalue)
+    @arguments("cpu", "r", "i", "i", "d")
+    def bhimpl_setarrayitem_gc_i(cpu, array, index, newvalue, arraydescr):
+        cpu.bh_setarrayitem_gc_i(array, index, newvalue, arraydescr)
+    @arguments("cpu", "r", "i", "r", "d")
+    def bhimpl_setarrayitem_gc_r(cpu, array, index, newvalue, arraydescr):
+        cpu.bh_setarrayitem_gc_r(array, index, newvalue, arraydescr)
+    @arguments("cpu", "r", "i", "f", "d")
+    def bhimpl_setarrayitem_gc_f(cpu, array, index, newvalue, arraydescr):
+        cpu.bh_setarrayitem_gc_f(array, index, newvalue, arraydescr)
 
-    @arguments("cpu", "i", "d", "i", "i")
-    def bhimpl_setarrayitem_raw_i(cpu, array, arraydescr, index, newvalue):
-        cpu.bh_setarrayitem_raw_i(arraydescr, array, index, newvalue)
-    @arguments("cpu", "i", "d", "i", "f")
-    def bhimpl_setarrayitem_raw_f(cpu, array, arraydescr, index, newvalue):
-        cpu.bh_setarrayitem_raw_f(arraydescr, array, index, newvalue)
+    @arguments("cpu", "i", "i", "i", "d")
+    def bhimpl_setarrayitem_raw_i(cpu, array, index, newvalue, arraydescr):
+        cpu.bh_setarrayitem_raw_i(array, index, newvalue, arraydescr)
+    @arguments("cpu", "i", "i", "f", "d")
+    def bhimpl_setarrayitem_raw_f(cpu, array, index, newvalue, arraydescr):
+        cpu.bh_setarrayitem_raw_f(array, index, newvalue, arraydescr)
 
     # note, there is no 'r' here, since it can't happen
 
     @arguments("cpu", "r", "d", returns="i")
     def bhimpl_arraylen_gc(cpu, array, arraydescr):
-        return cpu.bh_arraylen_gc(arraydescr, array)
+        return cpu.bh_arraylen_gc(array, arraydescr)
 
-    @arguments("cpu", "r", "d", "d", "i", returns="i")
-    def bhimpl_getarrayitem_vable_i(cpu, vable, fielddescr, arraydescr, index):
+    @arguments("cpu", "r", "i", "d", "d", returns="i")
+    def bhimpl_getarrayitem_vable_i(cpu, vable, index, fielddescr, arraydescr):
         array = cpu.bh_getfield_gc_r(vable, fielddescr)
-        return cpu.bh_getarrayitem_gc_i(arraydescr, array, index)
-    @arguments("cpu", "r", "d", "d", "i", returns="r")
-    def bhimpl_getarrayitem_vable_r(cpu, vable, fielddescr, arraydescr, index):
+        return cpu.bh_getarrayitem_gc_i(array, index, arraydescr)
+    @arguments("cpu", "r", "i", "d", "d", returns="r")
+    def bhimpl_getarrayitem_vable_r(cpu, vable, index, fielddescr, arraydescr):
         array = cpu.bh_getfield_gc_r(vable, fielddescr)
-        return cpu.bh_getarrayitem_gc_r(arraydescr, array, index)
-    @arguments("cpu", "r", "d", "d", "i", returns="f")
-    def bhimpl_getarrayitem_vable_f(cpu, vable, fielddescr, arraydescr, index):
+        return cpu.bh_getarrayitem_gc_r(array, index, arraydescr)
+    @arguments("cpu", "r", "i", "d", "d", returns="f")
+    def bhimpl_getarrayitem_vable_f(cpu, vable, index, fielddescr, arraydescr):
         array = cpu.bh_getfield_gc_r(vable, fielddescr)
-        return cpu.bh_getarrayitem_gc_f(arraydescr, array, index)
+        return cpu.bh_getarrayitem_gc_f(array, index, arraydescr)
 
-    @arguments("cpu", "r", "d", "d", "i", "i")
-    def bhimpl_setarrayitem_vable_i(cpu, vable, fdescr, adescr, index, newval):
+    @arguments("cpu", "r", "i", "i", "d", "d")
+    def bhimpl_setarrayitem_vable_i(cpu, vable, index, newval, fdescr, adescr):
         array = cpu.bh_getfield_gc_r(vable, fdescr)
-        cpu.bh_setarrayitem_gc_i(adescr, array, index, newval)
-    @arguments("cpu", "r", "d", "d", "i", "r")
-    def bhimpl_setarrayitem_vable_r(cpu, vable, fdescr, adescr, index, newval):
+        cpu.bh_setarrayitem_gc_i(array, index, newval, adescr)
+    @arguments("cpu", "r", "i", "r", "d", "d")
+    def bhimpl_setarrayitem_vable_r(cpu, vable, index, newval, fdescr, adescr):
         array = cpu.bh_getfield_gc_r(vable, fdescr)
-        cpu.bh_setarrayitem_gc_r(adescr, array, index, newval)
-    @arguments("cpu", "r", "d", "d", "i", "f")
-    def bhimpl_setarrayitem_vable_f(cpu, vable, fdescr, adescr, index, newval):
+        cpu.bh_setarrayitem_gc_r(array, index, newval, adescr)
+    @arguments("cpu", "r", "i", "f", "d", "d")
+    def bhimpl_setarrayitem_vable_f(cpu, vable, index, newval, fdescr, adescr):
         array = cpu.bh_getfield_gc_r(vable, fdescr)
-        cpu.bh_setarrayitem_gc_f(adescr, array, index, newval)
+        cpu.bh_setarrayitem_gc_f(array, index, newval, adescr)
 
     @arguments("cpu", "r", "d", "d", returns="i")
     def bhimpl_arraylen_vable(cpu, vable, fdescr, adescr):
         array = cpu.bh_getfield_gc_r(vable, fdescr)
-        return cpu.bh_arraylen_gc(adescr, array)
+        return cpu.bh_arraylen_gc(array, adescr)