[pypy-commit] pypy optresult: finish the deal with merging guards

fijal noreply at buildbot.pypy.org
Tue May 26 11:59:18 CEST 2015


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: optresult
Changeset: r77567:5756264c7aaa
Date: 2015-05-26 11:55 +0200
http://bitbucket.org/pypy/pypy/changeset/5756264c7aaa/

Log:	finish the deal with merging guards

diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py b/rpython/jit/metainterp/optimizeopt/optimizer.py
--- a/rpython/jit/metainterp/optimizeopt/optimizer.py
+++ b/rpython/jit/metainterp/optimizeopt/optimizer.py
@@ -297,10 +297,19 @@
 
     def make_constant_class(self, op, class_const, update_last_guard=True):
         op = self.get_box_replacement(op)
-        opinfo = info.InstancePtrInfo(class_const)
+        opinfo = op.get_forwarded()
+        if isinstance(opinfo, info.InstancePtrInfo):
+            opinfo._known_class = class_const
+        else:
+            if opinfo is not None:
+                last_guard_pos = opinfo.last_guard_pos
+            else:
+                last_guard_pos = -1
+            opinfo = info.InstancePtrInfo(class_const)
+            opinfo.last_guard_pos = last_guard_pos
+            op.set_forwarded(opinfo)
         if update_last_guard:
             opinfo.mark_last_guard(self.optimizer)
-        op.set_forwarded(opinfo)
         return opinfo
 
     def getptrinfo(self, op, create=False, is_object=False):
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py b/rpython/jit/metainterp/optimizeopt/rewrite.py
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -376,13 +376,13 @@
                 # on the same box.
                 self.optimizer.replace_guard(op, info)
                 self.emit_operation(op)
-                self.make_constant_class(op.getarg(0), expectedclassbox,
-                                         False)
+                self.make_constant_class(op.getarg(0), expectedclassbox, False)
                 return
         self.emit_operation(op)
         self.make_constant_class(op.getarg(0), expectedclassbox)
 
     def optimize_GUARD_NONNULL_CLASS(self, op):
+        xxx
         value = self.getvalue(op.getarg(0))
         if value.is_null():
             r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)


More information about the pypy-commit mailing list