Skip to content

Commit 7ea2ec3

Browse files
committed
Revert ovf check fast path
1 parent 8e6e14e commit 7ea2ec3

File tree

1 file changed

+1
-56
lines changed

1 file changed

+1
-56
lines changed

rpython/jit/codewriter/genextension.py

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,9 @@ def generate(self):
157157
self.jitcode._genext_source = "\n".join(allcode)
158158
# Import rop for opnum constants used in type-specialized recording
159159
from rpython.jit.metainterp.resoperation import rop
160-
from rpython.rlib.rarithmetic import ovfcheck
161160
d = {"ConstInt": ConstInt, "ConstPtr": ConstPtr, "ConstFloat": ConstFloat, "JitCode": JitCode, "ChangeFrame": ChangeFrame,
162161
"lltype": lltype, "rstr": rstr, 'llmemory': llmemory, 'OBJECTPTR': OBJECTPTR, 'support': support,
163-
'rop': rop, 'ovfcheck': ovfcheck}
162+
'rop': rop}
164163
d.update(self.globals)
165164
source = py.code.Source(self.jitcode._genext_source)
166165
exec source.compile() in d
@@ -2138,60 +2137,6 @@ def emit_unspecialized_goto_if_not_int_ne(self):
21382137
def emit_unspecialized_goto_if_not_int_eq(self):
21392138
return self._emit_goto_if_not_int_comparison_fast("INT_EQ", "==")
21402139

2141-
def _emit_int_ovf_fast(self, rop_name, py_op):
2142-
lines = []
2143-
_, label, arg0, arg1, _, result = self.insn
2144-
2145-
target_pc = self.get_target_pc(label)
2146-
2147-
self._emit_n_ary_if([arg0, arg1], lines)
2148-
specializer = self.work_list.specialize_insn(
2149-
self.insn, self.constant_registers.union({arg0, arg1}), self.orig_pc)
2150-
lines.append(" pc = %d" % (specializer.get_pc(),))
2151-
lines.append(" continue")
2152-
2153-
# Fast-path: compute with overflow check, record directly, skip heapcache
2154-
self._emit_sync_registers(lines)
2155-
box0 = self._get_as_box_after_sync(arg0)
2156-
box1 = self._get_as_box_after_sync(arg1)
2157-
lines.append("_v0 = %s" % self._get_as_unboxed_after_sync(arg0))
2158-
lines.append("_v1 = %s" % self._get_as_unboxed_after_sync(arg1))
2159-
2160-
lines.append("self.metainterp.ovf_flag = False")
2161-
lines.append("try:")
2162-
lines.append(" _res = ovfcheck(_v0 %s _v1)" % py_op)
2163-
lines.append("except OverflowError:")
2164-
lines.append(" self.metainterp.ovf_flag = True")
2165-
lines.append(" _res = 0")
2166-
2167-
lines.append("# fast-path: record overflow op directly, skip heapcache")
2168-
lines.append("_op = self.metainterp.history.record2_int(rop.%s, %s, %s, _res)" % (
2169-
rop_name, box0, box1))
2170-
lines.append("self.registers_i[%d] = _op" % result.index)
2171-
lines.append("i%d = _res" % result.index)
2172-
2173-
lines.append("self.handle_possible_overflow_error(%d, %d, _op)" % (target_pc, self.orig_pc))
2174-
lines.append("if self.metainterp.ovf_flag:")
2175-
specializer = self.work_list.specialize_pc(
2176-
self.constant_registers - {result}, target_pc)
2177-
lines.append(" pc = %s" % (specializer.spec_pc,))
2178-
lines.append("else:")
2179-
next_pc = self.work_list.pc_to_nextpc[self.orig_pc]
2180-
specializer = self.work_list.specialize_pc(
2181-
self.constant_registers - {result}, next_pc)
2182-
lines.append(" pc = %s" % (specializer.spec_pc,))
2183-
lines.append("continue")
2184-
return lines
2185-
2186-
def emit_unspecialized_int_add_jump_if_ovf(self):
2187-
return self._emit_int_ovf_fast("INT_ADD_OVF", "+")
2188-
2189-
def emit_unspecialized_int_sub_jump_if_ovf(self):
2190-
return self._emit_int_ovf_fast("INT_SUB_OVF", "-")
2191-
2192-
def emit_unspecialized_int_mul_jump_if_ovf(self):
2193-
return self._emit_int_ovf_fast("INT_MUL_OVF", "*")
2194-
21952140
def emit_unspecialized_switch(self):
21962141
lines = []
21972142
arg0, descr = self._get_args()

0 commit comments

Comments
 (0)