Read about our upcoming Code of Conduct on this issue

Commit a2a6dbf2 authored by Armin Rigo's avatar Armin Rigo
Browse files

Fix noConst(): recent improvements to heapcache mean this hack no longer

works.  Use instead some direct way.
parent 62fe68e481ea
......@@ -561,8 +561,10 @@ class Transformer(object):
return [SpaceOperation('-live-', [], None), op1, None]
if hints.get('force_virtualizable'):
return SpaceOperation('hint_force_virtualizable', [op.args[0]], None)
log.WARNING('ignoring hint %r at %r' % (hints, self.graph))
if hints.get('force_no_const'): # for tests only
assert getkind(op.args[0].concretetype) == 'int'
return SpaceOperation('int_same_as', [op.args[0]], op.result)
log.WARNING('ignoring hint %r at %r' % (hints, self.graph))
def _rewrite_raw_malloc(self, op, name, args):
d = op.args[1].value.copy()
......@@ -380,6 +380,10 @@ class BlackholeInterpreter(object):
# ----------
@arguments("i", returns="i")
def bhimpl_int_same_as(a):
return a
@arguments("i", "i", returns="i")
def bhimpl_int_add(a, b):
return intmask(a + b)
......@@ -230,6 +230,14 @@ class MIFrame(object):
return self.execute(rop.%s, b)
''' % (_opimpl, _opimpl.upper())).compile()
def opimpl_int_same_as(self, box):
# for tests only: emits a same_as, forcing the result to be in a Box
resbox = history.BoxInt(box.getint())
rop.SAME_AS, resbox, None, [box])
return resbox
def opimpl_ptr_nonzero(self, box):
return self.execute(rop.PTR_NE, box, history.CONST_NULL)
......@@ -273,6 +273,5 @@ class _Foo:
def noConst(x):
"""Helper function for tests, returning 'x' as a BoxInt/BoxPtr
even if it is a ConstInt/ConstPtr."""
f1 = _Foo(); f2 = _Foo()
f1.x = x; f2.x = 0
return f1.x
from rpython.rlib import jit
return jit.hint(x, force_no_const=True)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment