[pypy-commit] pypy value-profiling: make record_exact_class also imply that the box is not null
cfbolz
noreply at buildbot.pypy.org
Sun Aug 16 09:15:52 CEST 2015
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: value-profiling
Changeset: r78994:4c2707c6443a
Date: 2015-08-15 16:42 +0200
http://bitbucket.org/pypy/pypy/changeset/4c2707c6443a/
Log: make record_exact_class also imply that the box is not null
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
@@ -335,6 +335,7 @@
value = self.getvalue(op.getarg(0))
expectedclassbox = op.getarg(1)
if not isinstance(expectedclassbox, Const):
+ value.make_nonnull(None)
# can't optimize
return
realclassbox = value.get_constant_class(self.optimizer.cpu)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -7089,6 +7089,7 @@
[p0]
p1 = getfield_gc(p0, descr=nextdescr)
record_exact_class(p1, ConstClass(node_vtable))
+ guard_nonnull(p1) []
guard_class(p1, ConstClass(node_vtable)) []
jump(p1)
"""
@@ -7098,10 +7099,12 @@
jump(p1)
"""
self.optimize_loop(ops, expected)
+
ops = """
[p0, i0]
p1 = getfield_gc(p0, descr=nextdescr)
record_exact_class(p1, i0)
+ guard_nonnull(p1) []
guard_class(p1, ConstClass(node_vtable)) []
jump(p1, i0)
"""
diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -282,6 +282,7 @@
adr = clsbox.getaddr()
self.execute(rop.RECORD_EXACT_CLASS, box, clsbox)
self.metainterp.heapcache.class_now_known(box)
+ self.metainterp.heapcache.nullity_now_known(box)
@arguments("box")
def _opimpl_any_return(self, box):
diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -1085,14 +1085,13 @@
Assure the JIT that value is an instance of cls. This is a precise
class check, like a guard_class.
"""
- assert type(value) is cls
+ assert value is not None and type(value) is cls
class Entry(ExtRegistryEntry):
_about_ = record_exact_class
def compute_result_annotation(self, s_inst, s_cls):
from rpython.annotator import model as annmodel
- assert not s_inst.can_be_none()
assert isinstance(s_inst, annmodel.SomeInstance)
def specialize_call(self, hop):
More information about the pypy-commit
mailing list