[pypy-svn] r40622 - in pypy/branch/jit-virtual-world/pypy: jit/hintannotator/test rpython rpython/lltypesystem
arigo at codespeak.net
arigo at codespeak.net
Fri Mar 16 23:06:42 CET 2007
Author: arigo
Date: Fri Mar 16 23:06:38 2007
New Revision: 40622
Modified:
pypy/branch/jit-virtual-world/pypy/jit/hintannotator/test/test_annotator.py
pypy/branch/jit-virtual-world/pypy/rpython/llinterp.py
pypy/branch/jit-virtual-world/pypy/rpython/lltypesystem/opimpl.py
pypy/branch/jit-virtual-world/pypy/rpython/lltypesystem/rstr.py
pypy/branch/jit-virtual-world/pypy/rpython/rlist.py
Log:
(arigo, pedronis)
We should never constant-folding CDefinedIntSymbolics.
Only the llinterpreter is allowed to use the 'default'.
The hintannotator test failed because of that.
Modified: pypy/branch/jit-virtual-world/pypy/jit/hintannotator/test/test_annotator.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/hintannotator/test/test_annotator.py (original)
+++ pypy/branch/jit-virtual-world/pypy/jit/hintannotator/test/test_annotator.py Fri Mar 16 23:06:38 2007
@@ -873,3 +873,11 @@
return 5
hs = hannotate(g, [int])
assert hs.is_green()
+
+ def g(n):
+ if not we_are_jitted():
+ return n
+ else:
+ return 5
+ hs = hannotate(g, [int], backendoptimize=True)
+ assert hs.is_green()
Modified: pypy/branch/jit-virtual-world/pypy/rpython/llinterp.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/rpython/llinterp.py (original)
+++ pypy/branch/jit-virtual-world/pypy/rpython/llinterp.py Fri Mar 16 23:06:38 2007
@@ -4,7 +4,7 @@
from pypy.rpython.lltypesystem import lltype, llmemory, lloperation, llheap
from pypy.rpython.lltypesystem import rclass
from pypy.rpython.ootypesystem import ootype
-from pypy.rlib.objectmodel import ComputedIntSymbolic
+from pypy.rlib.objectmodel import ComputedIntSymbolic, CDefinedIntSymbolic
import sys, os
import math
@@ -875,6 +875,13 @@
except OverflowError:
self.make_llexception()
+ def op_int_is_true(self, x):
+ # special case
+ if type(x) is CDefinedIntSymbolic:
+ x = x.default
+ assert isinstance(x, int)
+ return bool(x)
+
# read frame var support
def op_get_frame_base(self):
Modified: pypy/branch/jit-virtual-world/pypy/rpython/lltypesystem/opimpl.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/rpython/lltypesystem/opimpl.py (original)
+++ pypy/branch/jit-virtual-world/pypy/rpython/lltypesystem/opimpl.py Fri Mar 16 23:06:38 2007
@@ -2,7 +2,6 @@
from pypy.tool.sourcetools import func_with_new_name
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.lltypesystem.lloperation import opimpls
-from pypy.rlib.objectmodel import CDefinedIntSymbolic
# ____________________________________________________________
# Implementation of the 'canfold' operations
@@ -27,10 +26,6 @@
'ullong': r_ulonglong,
}
-# this is just a flag, when we should check for
-# CDefinedSymbolicInt
-ops_to_check = {'is_true':True}
-
def no_op(x):
return x
@@ -63,16 +58,7 @@
fullopname,)
argtype = type_by_name[typname]
- if opname in ops_to_check:
- def op_function(x):
- # is instead of isinstance for performance
- if type(x) is CDefinedIntSymbolic:
- x = x.default
- if not isinstance(x, argtype):
- raise TypeError("%r arg must be %s, got %r instead" % (
- fullopname, typname, type(x).__name__))
- return adjust_result(func(x))
- elif opname in ops_unary:
+ if opname in ops_unary:
def op_function(x):
if not isinstance(x, argtype):
raise TypeError("%r arg must be %s, got %r instead" % (
Modified: pypy/branch/jit-virtual-world/pypy/rpython/lltypesystem/rstr.py
==============================================================================
Modified: pypy/branch/jit-virtual-world/pypy/rpython/rlist.py
==============================================================================
More information about the Pypy-commit
mailing list