Author: Armin Rigo <ar...@tunes.org>
Branch: inline-dict-ops
Changeset: r48309:bf8fa9caf308
Date: 2011-10-21 15:05 +0200
http://bitbucket.org/pypy/pypy/changeset/bf8fa9caf308/

Log:    Small fixes in preparation for the merge.

diff --git a/pypy/jit/backend/x86/assembler.py 
b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -1598,6 +1598,7 @@
 
     def genop_getinteriorfield_gc(self, op, arglocs, resloc):
         base_loc, ofs_loc, itemsize_loc, fieldsize_loc, index_loc, sign_loc = 
arglocs
+        # XXX should not use IMUL in most cases
         self.mc.IMUL(index_loc, itemsize_loc)
         src_addr = AddressLoc(base_loc, index_loc, 0, ofs_loc.value)
         self.load_from_mem(resloc, src_addr, fieldsize_loc, sign_loc)
@@ -1611,6 +1612,7 @@
 
     def genop_discard_setinteriorfield_gc(self, op, arglocs):
         base_loc, ofs_loc, itemsize_loc, fieldsize_loc, index_loc, value_loc = 
arglocs
+        # XXX should not use IMUL in most cases
         self.mc.IMUL(index_loc, itemsize_loc)
         dest_addr = AddressLoc(base_loc, index_loc, 0, ofs_loc.value)
         self.save_into_mem(dest_addr, value_loc, fieldsize_loc)
diff --git a/pypy/jit/codewriter/jtransform.py 
b/pypy/jit/codewriter/jtransform.py
--- a/pypy/jit/codewriter/jtransform.py
+++ b/pypy/jit/codewriter/jtransform.py
@@ -738,13 +738,12 @@
 
     def rewrite_op_getinteriorfield(self, op):
         assert len(op.args) == 3
-        if isinstance(op.args[1], Constant) and op.args[1].value == 'chars':
-            optype = op.args[0].concretetype
-            if optype == lltype.Ptr(rstr.STR):
-                opname = "strgetitem"
-            else:
-                assert optype == lltype.Ptr(rstr.UNICODE)
-                opname = "unicodegetitem"
+        optype = op.args[0].concretetype
+        if optype == lltype.Ptr(rstr.STR):
+            opname = "strgetitem"
+            return SpaceOperation(opname, [op.args[0], op.args[2]], op.result)
+        elif optype == lltype.Ptr(rstr.UNICODE):
+            opname = "unicodegetitem"
             return SpaceOperation(opname, [op.args[0], op.args[2]], op.result)
         else:
             v_inst, v_index, c_field = op.args
@@ -763,13 +762,13 @@
 
     def rewrite_op_setinteriorfield(self, op):
         assert len(op.args) == 4
-        if isinstance(op.args[1], Constant) and op.args[1].value == 'chars':
-            optype = op.args[0].concretetype
-            if optype == lltype.Ptr(rstr.STR):
-                opname = "strsetitem"
-            else:
-                assert optype == lltype.Ptr(rstr.UNICODE)
-                opname = "unicodesetitem"
+        optype = op.args[0].concretetype
+        if optype == lltype.Ptr(rstr.STR):
+            opname = "strsetitem"
+            return SpaceOperation(opname, [op.args[0], op.args[2], op.args[3]],
+                                  op.result)
+        elif optype == lltype.Ptr(rstr.UNICODE):
+            opname = "unicodesetitem"
             return SpaceOperation(opname, [op.args[0], op.args[2], op.args[3]],
                                   op.result)
         else:
diff --git a/pypy/jit/codewriter/support.py b/pypy/jit/codewriter/support.py
--- a/pypy/jit/codewriter/support.py
+++ b/pypy/jit/codewriter/support.py
@@ -47,6 +47,8 @@
     a.build_types(func, argtypes, main_entry_point=True)
     rtyper = t.buildrtyper(type_system = type_system)
     rtyper.specialize()
+    #if inline:
+    #    auto_inlining(t, threshold=inline)
     if backendoptimize:
         from pypy.translator.backendopt.all import backend_optimizations
         backend_optimizations(t, inline_threshold=inline or 0,
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to