[pypy-commit] pypy share-guard-info: kill guard_opnum
fijal
noreply at buildbot.pypy.org
Mon Sep 21 20:58:48 CEST 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: share-guard-info
Changeset: r79745:8588d6767134
Date: 2015-09-21 20:59 +0200
http://bitbucket.org/pypy/pypy/changeset/8588d6767134/
Log: kill guard_opnum
diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py
--- a/rpython/jit/metainterp/blackhole.py
+++ b/rpython/jit/metainterp/blackhole.py
@@ -1465,58 +1465,9 @@
assert kind == 'v'
return lltype.nullptr(rclass.OBJECTPTR.TO)
- def _prepare_resume_from_failure(self, opnum, deadframe):
- from rpython.jit.metainterp.resoperation import rop
- #
- if opnum == rop.GUARD_FUTURE_CONDITION:
- pass
- elif opnum == rop.GUARD_TRUE:
- # Produced directly by some goto_if_not_xxx() opcode that did not
- # jump, but which must now jump. The pc is just after the opcode.
- pass # self.position = self.jitcode.follow_jump(self.position)
- #
- elif opnum == rop.GUARD_FALSE:
- # Produced directly by some goto_if_not_xxx() opcode that jumped,
- # but which must no longer jump. The pc is just after the opcode.
- pass
- #
- elif opnum == rop.GUARD_VALUE or opnum == rop.GUARD_CLASS:
- # Produced by guard_class(), xxx_guard_value(), or a few other
- # opcodes like switch(). The pc is at the start of the opcode
- # (so it will be redone).
- pass
- #
- elif (opnum == rop.GUARD_NONNULL or
- opnum == rop.GUARD_ISNULL or
- opnum == rop.GUARD_NONNULL_CLASS):
- # Produced by goto_if_not_ptr_{non,is}zero(). The pc is at the
- # start of the opcode (so it will be redone); this is needed
- # because of GUARD_NONNULL_CLASS.
- pass
- #
- elif (opnum == rop.GUARD_NO_EXCEPTION or
- opnum == rop.GUARD_EXCEPTION or
- opnum == rop.GUARD_NOT_FORCED):
- return lltype.cast_opaque_ptr(rclass.OBJECTPTR,
- self.cpu.grab_exc_value(deadframe))
- #
- elif opnum == rop.GUARD_NO_OVERFLOW:
- # Produced by int_xxx_ovf(). The pc is just after the opcode.
- # We get here because it did not used to overflow, but now it does.
- #return get_llexception(self.cpu, OverflowError())
- pass
- #
- elif opnum == rop.GUARD_OVERFLOW:
- # Produced by int_xxx_ovf(). The pc is just after the opcode.
- # We get here because it used to overflow, but now it no longer
- # does.
- pass
- elif opnum == rop.GUARD_NOT_INVALIDATED:
- pass
- else:
- from rpython.jit.metainterp.resoperation import opname
- raise NotImplementedError(opname[opnum])
- return lltype.nullptr(rclass.OBJECTPTR.TO)
+ def _prepare_resume_from_failure(self, deadframe):
+ return lltype.cast_opaque_ptr(rclass.OBJECTPTR,
+ self.cpu.grab_exc_value(deadframe))
# connect the return of values from the called frame to the
# 'xxx_call_yyy' instructions from the caller frame
@@ -1642,8 +1593,7 @@
deadframe,
all_virtuals)
- current_exc = blackholeinterp._prepare_resume_from_failure(
- resumedescr.guard_opnum, deadframe)
+ current_exc = blackholeinterp._prepare_resume_from_failure(deadframe)
_run_forever(blackholeinterp, current_exc)
resume_in_blackhole._dont_inline_ = True
diff --git a/rpython/jit/metainterp/compile.py b/rpython/jit/metainterp/compile.py
--- a/rpython/jit/metainterp/compile.py
+++ b/rpython/jit/metainterp/compile.py
@@ -847,44 +847,8 @@
assert 0, box.type
self.status = ty | (r_uint(i) << self.ST_SHIFT)
-class ResumeGuardNonnullDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_NONNULL
-
-class ResumeGuardIsnullDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_ISNULL
-
-class ResumeGuardClassDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_CLASS
-
-class ResumeGuardTrueDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_TRUE
-
-class ResumeGuardFalseDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_FALSE
-
-class ResumeGuardNonnullClassDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_NONNULL_CLASS
-
-class ResumeGuardExceptionDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_EXCEPTION
-
-class ResumeGuardNoExceptionDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_NO_EXCEPTION
-
-class ResumeGuardOverflowDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_OVERFLOW
-
-class ResumeGuardNoOverflowDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_NO_OVERFLOW
-
-class ResumeGuardValueDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_VALUE
-
-class ResumeGuardNotInvalidated(ResumeGuardDescr):
- guard_opnum = rop.GUARD_NOT_INVALIDATED
-
class ResumeAtPositionDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_FUTURE_CONDITION
+ pass
class AllVirtuals:
llopaque = True
@@ -905,8 +869,6 @@
class ResumeGuardForcedDescr(ResumeGuardDescr):
- guard_opnum = rop.GUARD_NOT_FORCED
-
def _init(self, metainterp_sd, jitdriver_sd):
# to please the annotator
self.metainterp_sd = metainterp_sd
@@ -969,37 +931,11 @@
if opnum == rop.GUARD_NOT_FORCED or opnum == rop.GUARD_NOT_FORCED_2:
resumedescr = ResumeGuardForcedDescr()
resumedescr._init(optimizer.metainterp_sd, optimizer.jitdriver_sd)
- elif opnum == rop.GUARD_NOT_INVALIDATED:
- resumedescr = ResumeGuardNotInvalidated()
- elif opnum == rop.GUARD_FUTURE_CONDITION:
- resumedescr = ResumeAtPositionDescr()
- elif opnum == rop.GUARD_VALUE:
- resumedescr = ResumeGuardValueDescr()
- elif opnum == rop.GUARD_NONNULL:
- resumedescr = ResumeGuardNonnullDescr()
- elif opnum == rop.GUARD_ISNULL:
- resumedescr = ResumeGuardIsnullDescr()
- elif opnum == rop.GUARD_NONNULL_CLASS:
- resumedescr = ResumeGuardNonnullClassDescr()
- elif opnum == rop.GUARD_CLASS:
- resumedescr = ResumeGuardClassDescr()
- elif opnum == rop.GUARD_TRUE:
- resumedescr = ResumeGuardTrueDescr()
- elif opnum == rop.GUARD_FALSE:
- resumedescr = ResumeGuardFalseDescr()
- elif opnum == rop.GUARD_EXCEPTION:
- resumedescr = ResumeGuardExceptionDescr()
- elif opnum == rop.GUARD_NO_EXCEPTION:
- resumedescr = ResumeGuardNoExceptionDescr()
- elif opnum == rop.GUARD_OVERFLOW:
- resumedescr = ResumeGuardOverflowDescr()
- elif opnum == rop.GUARD_NO_OVERFLOW:
- resumedescr = ResumeGuardNoOverflowDescr()
elif opnum in (rop.GUARD_IS_OBJECT, rop.GUARD_SUBCLASS, rop.GUARD_GC_TYPE):
# note - this only happens in tests
resumedescr = ResumeAtPositionDescr()
else:
- assert False
+ resumedescr = ResumeGuardDescr()
return resumedescr
class ResumeFromInterpDescr(ResumeDescr):
diff --git a/rpython/jit/metainterp/test/test_ajit.py b/rpython/jit/metainterp/test/test_ajit.py
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -115,10 +115,13 @@
while y > 0:
myjitdriver.can_enter_jit(x=x, y=y, res=res)
myjitdriver.jit_merge_point(x=x, y=y, res=res)
- res += ovfcheck(x * x)
- x += 1
- res += ovfcheck(x * x)
- y -= 1
+ try:
+ res += ovfcheck(x * x)
+ x += 1
+ res += ovfcheck(x * x)
+ y -= 1
+ except OverflowError:
+ assert 0
return res
res = self.meta_interp(f, [6, 7])
assert res == 1323
More information about the pypy-commit
mailing list