[pypy-svn] r71374 - in pypy/branch/debug-vref2/pypy/jit/metainterp: . test
arigo at codespeak.net
arigo at codespeak.net
Sun Feb 21 13:34:22 CET 2010
Author: arigo
Date: Sun Feb 21 13:34:20 2010
New Revision: 71374
Modified:
pypy/branch/debug-vref2/pypy/jit/metainterp/codewriter.py
pypy/branch/debug-vref2/pypy/jit/metainterp/effectinfo.py
pypy/branch/debug-vref2/pypy/jit/metainterp/optimizeopt.py
pypy/branch/debug-vref2/pypy/jit/metainterp/pyjitpl.py
pypy/branch/debug-vref2/pypy/jit/metainterp/test/test_codewriter.py
pypy/branch/debug-vref2/pypy/jit/metainterp/test/test_optimizefindnode.py
Log:
Simplify things: the effectinfos that used to have the flag
'forces_virtual_or_virtualizable' are now always stored just as None.
I think that there is not a lot of benefits from optimizing field
reads or writes around calls to functions that can force anyway.
Modified: pypy/branch/debug-vref2/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/debug-vref2/pypy/jit/metainterp/codewriter.py (original)
+++ pypy/branch/debug-vref2/pypy/jit/metainterp/codewriter.py Sun Feb 21 13:34:20 2010
@@ -337,10 +337,12 @@
assert RESULT == FUNC.RESULT
# ok
if consider_effects_of is not None:
- effectinfo = effectinfo_from_writeanalyze(
+ if self.virtualizable_analyzer.analyze(consider_effects_of):
+ effectinfo = None # forcing virtualizable or vrefs
+ else:
+ effectinfo = effectinfo_from_writeanalyze(
self.readwrite_analyzer.analyze(consider_effects_of),
- self.cpu,
- self.virtualizable_analyzer.analyze(consider_effects_of))
+ self.cpu)
calldescr = self.cpu.calldescrof(FUNC, tuple(NON_VOID_ARGS), RESULT, effectinfo)
else:
calldescr = self.cpu.calldescrof(FUNC, tuple(NON_VOID_ARGS), RESULT)
@@ -1259,8 +1261,7 @@
loopinvariant = getattr(func, "_jit_loop_invariant_", False)
if pure or loopinvariant:
effectinfo = calldescr.get_extra_info()
- assert (effectinfo is not None and
- not effectinfo.forces_virtual_or_virtualizable)
+ assert effectinfo is not None
try:
canraise = self.codewriter.raise_analyzer.can_raise(op)
except lltype.DelayedPointer:
Modified: pypy/branch/debug-vref2/pypy/jit/metainterp/effectinfo.py
==============================================================================
--- pypy/branch/debug-vref2/pypy/jit/metainterp/effectinfo.py (original)
+++ pypy/branch/debug-vref2/pypy/jit/metainterp/effectinfo.py Sun Feb 21 13:34:20 2010
@@ -8,24 +8,20 @@
_cache = {}
def __new__(cls, readonly_descrs_fields,
- write_descrs_fields, write_descrs_arrays,
- forces_virtual_or_virtualizable=False):
+ write_descrs_fields, write_descrs_arrays):
key = (frozenset(readonly_descrs_fields),
frozenset(write_descrs_fields),
- frozenset(write_descrs_arrays),
- forces_virtual_or_virtualizable)
+ frozenset(write_descrs_arrays))
if key in cls._cache:
return cls._cache[key]
result = object.__new__(cls)
result.readonly_descrs_fields = readonly_descrs_fields
result.write_descrs_fields = write_descrs_fields
result.write_descrs_arrays = write_descrs_arrays
- result.forces_virtual_or_virtualizable= forces_virtual_or_virtualizable
cls._cache[key] = result
return result
-def effectinfo_from_writeanalyze(effects, cpu,
- forces_virtual_or_virtualizable=False):
+def effectinfo_from_writeanalyze(effects, cpu):
from pypy.translator.backendopt.writeanalyze import top_set
if effects is top_set:
return None
@@ -61,8 +57,7 @@
assert 0
return EffectInfo(readonly_descrs_fields,
write_descrs_fields,
- write_descrs_arrays,
- forces_virtual_or_virtualizable)
+ write_descrs_arrays)
def consider_struct(TYPE, fieldname):
if fieldType(TYPE, fieldname) is lltype.Void:
Modified: pypy/branch/debug-vref2/pypy/jit/metainterp/optimizeopt.py
==============================================================================
--- pypy/branch/debug-vref2/pypy/jit/metainterp/optimizeopt.py (original)
+++ pypy/branch/debug-vref2/pypy/jit/metainterp/optimizeopt.py Sun Feb 21 13:34:20 2010
@@ -1029,12 +1029,11 @@
if (opnum == rop.CALL or
opnum == rop.CALL_MAY_FORCE or
opnum == rop.CALL_ASSEMBLER):
- if opnum == rop.CALL_ASSEMBLER:
+ if opnum != rop.CALL:
effectinfo = None
else:
effectinfo = op.descr.get_extra_info()
- if (effectinfo is not None and
- not effectinfo.forces_virtual_or_virtualizable):
+ if effectinfo is not None:
# XXX we can get the wrong complexity here, if the lists
# XXX stored on effectinfo are large
for fielddescr in effectinfo.readonly_descrs_fields:
Modified: pypy/branch/debug-vref2/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/debug-vref2/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/debug-vref2/pypy/jit/metainterp/pyjitpl.py Sun Feb 21 13:34:20 2010
@@ -1073,7 +1073,7 @@
def do_residual_call(self, argboxes, descr, exc):
effectinfo = descr.get_extra_info()
- if effectinfo is None or effectinfo.forces_virtual_or_virtualizable:
+ if effectinfo is None:
# residual calls require attention to keep virtualizables in-sync
self.metainterp.vable_and_vrefs_before_residual_call()
# xxx do something about code duplication
Modified: pypy/branch/debug-vref2/pypy/jit/metainterp/test/test_codewriter.py
==============================================================================
--- pypy/branch/debug-vref2/pypy/jit/metainterp/test/test_codewriter.py (original)
+++ pypy/branch/debug-vref2/pypy/jit/metainterp/test/test_codewriter.py Sun Feb 21 13:34:20 2010
@@ -306,7 +306,6 @@
assert calldescrs[0][4] is not None
assert not calldescrs[0][4].write_descrs_fields
assert not calldescrs[0][4].write_descrs_arrays
- assert not calldescrs[0][4].forces_virtual_or_virtualizable
def test_oosend_look_inside_only_one(self):
class A:
@@ -453,9 +452,9 @@
effectinfo_g1 = calldescrs[1][4]
effectinfo_g2 = calldescrs[2][4]
effectinfo_h = calldescrs[3][4]
- assert effectinfo_g1.forces_virtual_or_virtualizable
- assert effectinfo_g2.forces_virtual_or_virtualizable
- assert not effectinfo_h.forces_virtual_or_virtualizable
+ assert effectinfo_g1 is None
+ assert effectinfo_g2 is None
+ assert effectinfo_h is not None
def make_vrefinfo(self):
from pypy.jit.metainterp.virtualref import VirtualRefInfo
Modified: pypy/branch/debug-vref2/pypy/jit/metainterp/test/test_optimizefindnode.py
==============================================================================
--- pypy/branch/debug-vref2/pypy/jit/metainterp/test/test_optimizefindnode.py (original)
+++ pypy/branch/debug-vref2/pypy/jit/metainterp/test/test_optimizefindnode.py Sun Feb 21 13:34:20 2010
@@ -111,9 +111,7 @@
EffectInfo([], [adescr], [arraydescr]))
readadescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
EffectInfo([adescr], [], []))
- mayforcevirtdescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
- EffectInfo([nextdescr], [], [],
- forces_virtual_or_virtualizable=True))
+ mayforcevirtdescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
class LoopToken(AbstractDescr):
pass
asmdescr = LoopToken() # it can be whatever, it's not a descr though
More information about the Pypy-commit
mailing list