[pypy-commit] pypy optresult-unroll: Kill guard_nonnull_gc_type again
arigo
noreply at buildbot.pypy.org
Thu Sep 3 07:52:12 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: optresult-unroll
Changeset: r79386:0ffbe45ebce5
Date: 2015-09-03 07:26 +0200
http://bitbucket.org/pypy/pypy/changeset/0ffbe45ebce5/
Log: Kill guard_nonnull_gc_type again
diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -913,10 +913,6 @@
if TYPE != typeid.STRUCT_OR_ARRAY:
self.fail_guard(descr)
- def execute_guard_nonnull_gc_type(self, descr, arg, typeid):
- self.execute_guard_nonnull(descr, arg)
- self.execute_guard_gc_type(descr, arg, typeid)
-
def execute_guard_no_exception(self, descr):
if self.last_exception is not None:
self.fail_guard(descr)
diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -4840,9 +4840,6 @@
c_typeid = ConstInt(descr.get_type_id())
self.execute_operation(rop.GUARD_GC_TYPE, [t_box, c_typeid], 'void')
assert not self.guard_failed
- self.execute_operation(rop.GUARD_NONNULL_GC_TYPE, [t_box, c_typeid],
- 'void')
- assert not self.guard_failed
def test_passing_guard_gc_type_array(self):
if not self.cpu.supports_guard_gc_type:
@@ -4852,9 +4849,6 @@
c_typeid = ConstInt(arraydescr.get_type_id())
self.execute_operation(rop.GUARD_GC_TYPE, [a_box, c_typeid], 'void')
assert not self.guard_failed
- self.execute_operation(rop.GUARD_NONNULL_GC_TYPE, [a_box, c_typeid],
- 'void')
- assert not self.guard_failed
def test_failing_guard_gc_type(self):
if not self.cpu.supports_guard_gc_type:
@@ -4866,17 +4860,10 @@
c_ttypeid = ConstInt(tdescr.get_type_id())
c_utypeid = ConstInt(udescr.get_type_id())
c_atypeid = ConstInt(adescr.get_type_id())
- null_box = self.null_instance()
for opname, args in [(rop.GUARD_GC_TYPE, [t_box, c_utypeid]),
(rop.GUARD_GC_TYPE, [u_box, c_ttypeid]),
(rop.GUARD_GC_TYPE, [a_box, c_utypeid]),
(rop.GUARD_GC_TYPE, [t_box, c_atypeid]),
- (rop.GUARD_NONNULL_GC_TYPE, [t_box, c_utypeid]),
- (rop.GUARD_NONNULL_GC_TYPE, [u_box, c_ttypeid]),
- (rop.GUARD_NONNULL_GC_TYPE, [a_box, c_ttypeid]),
- (rop.GUARD_NONNULL_GC_TYPE, [u_box, c_atypeid]),
- (rop.GUARD_NONNULL_GC_TYPE, [null_box, c_ttypeid]),
- (rop.GUARD_NONNULL_GC_TYPE, [null_box, c_atypeid]),
]:
assert self.execute_operation(opname, args, 'void') == None
assert self.guard_failed
diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -1734,7 +1734,9 @@
self.mc.CMP(locs[0], locs[1])
self.implement_guard(guard_token, 'NE')
- def _cmp_guard_class(self, loc_ptr, loc_classptr):
+ def _cmp_guard_class(self, locs):
+ loc_ptr = locs[0]
+ loc_classptr = locs[1]
offset = self.cpu.vtable_offset
if offset is not None:
self.mc.CMP(mem(loc_ptr, offset), loc_classptr)
@@ -1770,18 +1772,8 @@
assert isinstance(loc_expected_typeid, ImmedLoc)
self.mc.CMP32_mi((loc_ptr.value, 0), loc_expected_typeid.value)
- def _cmp_guard_class_or_gc_type(self, guard_op, locs):
- if ( guard_op.getopnum() == rop.GUARD_CLASS or
- guard_op.getopnum() == rop.GUARD_NONNULL_CLASS):
- self._cmp_guard_class(locs[0], locs[1])
- elif (guard_op.getopnum() == rop.GUARD_GC_TYPE or
- guard_op.getopnum() == rop.GUARD_NONNULL_GC_TYPE):
- self._cmp_guard_gc_type(locs[0], locs[1])
- else:
- assert 0
-
def genop_guard_guard_class(self, ign_1, guard_op, guard_token, locs, ign_2):
- self._cmp_guard_class_or_gc_type(guard_op, locs)
+ self._cmp_guard_class(locs)
self.implement_guard(guard_token, 'NE')
def genop_guard_guard_nonnull_class(self, ign_1, guard_op,
@@ -1790,7 +1782,7 @@
# Patched below
self.mc.J_il8(rx86.Conditions['B'], 0)
jb_location = self.mc.get_relative_pos()
- self._cmp_guard_class_or_gc_type(guard_op, locs)
+ self._cmp_guard_class(locs)
# patch the JB above
offset = self.mc.get_relative_pos() - jb_location
assert 0 < offset <= 127
@@ -1798,8 +1790,10 @@
#
self.implement_guard(guard_token, 'NE')
- genop_guard_guard_gc_type = genop_guard_guard_class
- genop_guard_guard_nonnull_gc_type = genop_guard_guard_nonnull_class
+ def genop_guard_guard_gc_type(self, ign_1, guard_op,
+ guard_token, locs, ign_2):
+ self._cmp_guard_gc_type(locs[0], locs[1])
+ self.implement_guard(guard_token, 'NE')
def implement_guard_recovery(self, guard_opnum, faildescr, failargs,
fail_locs, frame_depth):
diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -429,7 +429,6 @@
consider_guard_nonnull_class = consider_guard_class
consider_guard_gc_type = consider_guard_class
- consider_guard_nonnull_gc_type = consider_guard_class
def _consider_binop_part(self, op, symm=False):
x = op.getarg(0)
diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py
--- a/rpython/jit/metainterp/resoperation.py
+++ b/rpython/jit/metainterp/resoperation.py
@@ -661,8 +661,9 @@
'GUARD_NONNULL/1d/n',
'GUARD_ISNULL/1d/n',
'GUARD_NONNULL_CLASS/2d/n',
- 'GUARD_GC_TYPE/2d/n',
- 'GUARD_NONNULL_GC_TYPE/2d/n',
+ 'GUARD_GC_TYPE/2d/n', # only if supports_guard_gc_type
+ 'GUARD_IS_OBJECT/1d/n', # only if supports_guard_gc_type
+ 'GUARD_SUBCLASS/2d/n', # only if supports_guard_gc_type
'_GUARD_FOLDABLE_LAST',
'GUARD_NO_EXCEPTION/0d/n', # may be called with an exception currently set
'GUARD_EXCEPTION/1d/r', # may be called with an exception currently set
More information about the pypy-commit
mailing list