[pypy-svn] r62309 - pypy/branch/pyjitpl5/pypy/jit/metainterp
fijal at codespeak.net
fijal at codespeak.net
Sun Mar 1 22:16:21 CET 2009
Author: fijal
Date: Sun Mar 1 22:16:20 2009
New Revision: 62309
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/heaptracker.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/support.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py
Log:
Fix translation, try to have isstrartblock correct (it's still not though)
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/heaptracker.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/heaptracker.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/heaptracker.py Sun Mar 1 22:16:20 2009
@@ -73,9 +73,13 @@
if isinstance(STRUCT, lltype.GcStruct):
vtable = get_vtable_for_gcstruct(cpu, STRUCT)
if vtable:
- vt = cpu.cast_adr_to_int(
- llmemory.cast_ptr_to_adr(vtable))
- cache[vt] = cpu.sizeof(STRUCT)
+ if not cpu.translate_support_code:
+ vt = cpu.cast_adr_to_int(
+ llmemory.cast_ptr_to_adr(vtable))
+ cache[vt] = cpu.sizeof(STRUCT)
+ else:
+ vt = llmemory.cast_ptr_to_adr(vtable)
+ cache[vt] = cpu.sizeof(STRUCT)
return cache
testing_gcstruct2vtable = {}
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py Sun Mar 1 22:16:20 2009
@@ -380,7 +380,6 @@
op = ResOperation(opnum, argboxes, resbox)
self.operations.append(op)
return op
- record._annspecialcase_ = 'specialize:arg(4)'
def generate_anything_since(self, old_index):
return len(self.operations) > old_index
@@ -391,7 +390,6 @@
class BlackHole(RunningMatcher):
def record(self, step, argboxes, resbox):
return None
- record._annspecialcase_ = 'specialize:arg(4)'
def generate_anything_since(self, old_index):
return True
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py Sun Mar 1 22:16:20 2009
@@ -894,7 +894,11 @@
history = metainterp.history
for vtable in storage.allocations:
- sizebox = ConstInt(metainterp.class_sizes[vtable])
+ if metainterp.cpu.translate_support_code:
+ vtable_addr = metainterp.cpu.cast_int_to_adr(vtable)
+ sizebox = ConstInt(metainterp.class_sizes[vtable_addr])
+ else:
+ sizebox = ConstInt(metainterp.class_sizes[vtable])
vtablebox = ConstInt(vtable)
instbox = history.execute_and_record(rop.NEW_WITH_VTABLE,
[sizebox, vtablebox],
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/support.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/support.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/support.py Sun Mar 1 22:16:20 2009
@@ -4,7 +4,7 @@
from pypy.rpython.lltypesystem import rdict, rstr
from pypy.rpython.llinterp import LLInterpreter
from pypy.rpython.extregistry import ExtRegistryEntry
-from pypy.translator.simplify import get_funcobj
+from pypy.translator.simplify import get_funcobj, checkgraph, simplify_graph
from pypy.translator.unsimplify import split_block
from pypy.objspace.flow.model import Constant
from pypy import conftest
@@ -52,6 +52,7 @@
"""Find the block with 'jit_merge_point' and split just before,
making sure the input args are in the canonical order.
"""
+ origstartblock = graph.startblock
# split the block just before the jit_merge_point()
if portalopindex > 0:
link = split_block(None, portalblock, portalopindex)
@@ -64,6 +65,12 @@
livevars = [v for v in portalop.args[2:]
if v.concretetype is not lltype.Void]
link = split_block(None, portalblock, 0, livevars)
+ if origstartblock != portalblock:
+ portalblock.isstartblock = True
+ origstartblock.isstartblock = False
+ graph.startblock = portalblock
+ simplify_graph(graph)
+ checkgraph(graph)
return link.target
def maybe_on_top_of_llinterp(rtyper, fnptr):
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py Sun Mar 1 22:16:20 2009
@@ -6,7 +6,7 @@
from pypy.rpython.test.test_llinterp import get_interpreter, clear_tcache
from pypy.objspace.flow.model import SpaceOperation, Variable, Constant
from pypy.objspace.flow.model import checkgraph, Link, copygraph
-from pypy.rlib.objectmodel import we_are_translated, UnboxedValue
+from pypy.rlib.objectmodel import we_are_translated, UnboxedValue, specialize
from pypy.rlib.unroll import unrolling_iterable
from pypy.rlib.jit import PARAMETERS
from pypy.rlib.rarithmetic import r_uint
@@ -105,11 +105,14 @@
translate_support_code=False, **kwds):
opt = Options(**kwds)
self.stats = history.Stats()
- cpu = CPUClass(self.translator.rtyper, self.stats,
- translate_support_code)
- self.cpu = cpu
if translate_support_code:
self.annhelper = MixLevelHelperAnnotator(self.translator.rtyper)
+ annhelper = self.annhelper
+ else:
+ annhelper = None
+ cpu = CPUClass(self.translator.rtyper, self.stats,
+ translate_support_code, annhelper)
+ self.cpu = cpu
graphs = self.translator.graphs
self.jit_merge_point_pos = find_jit_merge_point(graphs)
graph, block, pos = self.jit_merge_point_pos
@@ -348,7 +351,8 @@
jitdriver = warmrunnerdesc.jitdriver
num_green_args = len(jitdriver.greens)
warmrunnerdesc.num_green_args = num_green_args
- green_args_spec = unrolling_iterable(warmrunnerdesc.green_args_spec)
+ green_args_spec = unrolling_iterable(
+ list(enumerate(warmrunnerdesc.green_args_spec)))
green_args_names = unrolling_iterable(jitdriver.greens)
if num_green_args:
MAX_HASH_TABLE_BITS = 28
@@ -461,17 +465,20 @@
return self.compile(argshash, *args)
handle_hash_collision._dont_inline_ = True
+ @specialize.arg(2)
+ def _get_hash_part(self, greenargs, i, TYPE, result):
+ item = greenargs[i]
+ return result ^ cast_whatever_to_int(TYPE, item)
+
def getkeyhash(self, *greenargs):
result = r_uint(0x345678)
i = 0
mult = r_uint(1000003)
- for TYPE in green_args_spec:
+ for i, TYPE in green_args_spec:
if i > 0:
result = result * mult
mult = mult + 82520 + 2*len(greenargs)
- item = greenargs[i]
- result = result ^ cast_whatever_to_int(TYPE, item)
- i += 1
+ result = self._get_hash_part(greenargs, i, TYPE, result)
return result
getkeyhash._always_inline_ = True
More information about the Pypy-commit
mailing list