Author: Armin Rigo <[email protected]>
Branch: continulet-jit-3
Changeset: r58107:6d3477e87488
Date: 2012-10-13 19:04 +0200
http://bitbucket.org/pypy/pypy/changeset/6d3477e87488/
Log: (fijal, arigo)
Replace save_data/fetch_data with something much simpler: store it
on the jitframe.
diff --git a/pypy/jit/backend/llgraph/llimpl.py
b/pypy/jit/backend/llgraph/llimpl.py
--- a/pypy/jit/backend/llgraph/llimpl.py
+++ b/pypy/jit/backend/llgraph/llimpl.py
@@ -1381,9 +1381,13 @@
return lltype.cast_opaque_ptr(llmemory.GCREF, result)
else:
return lltype.nullptr(llmemory.GCREF.TO)
- assert lltype.typeOf(x) == llmemory.GCREF
+ #assert lltype.typeOf(x) == llmemory.GCREF
return x
+def set_finish_value_ref(frame, value):
+ frame = _from_opaque(frame)
+ frame._finish_value = value
+
##_pseudo_exceptions = {}
##def _get_error(Class):
@@ -1943,6 +1947,7 @@
setannotation(finish_value_int, annmodel.SomeInteger())
setannotation(finish_value_float, s_FloatStorage)
setannotation(finish_value_ref, annmodel.SomePtr(llmemory.GCREF))
+setannotation(set_finish_value_ref, annmodel.s_None)
setannotation(force, annmodel.SomeInteger())
setannotation(do_arraylen_gc, annmodel.SomeInteger())
diff --git a/pypy/jit/backend/llgraph/runner.py
b/pypy/jit/backend/llgraph/runner.py
--- a/pypy/jit/backend/llgraph/runner.py
+++ b/pypy/jit/backend/llgraph/runner.py
@@ -321,6 +321,11 @@
assert lltype.typeOf(jitframe) == llmemory.GCREF
return llimpl.finish_value_ref(jitframe)
+ def set_finish_value_ref(self, jitframe, value):
+ assert lltype.typeOf(jitframe) == llmemory.GCREF
+ #assert lltype.typeOf(value) == llmemory.GCREF
+ llimpl.set_finish_value_ref(jitframe, value)
+
def redirect_call_assembler(self, oldlooptoken, newlooptoken):
if we_are_translated():
raise ValueError("CALL_ASSEMBLER not supported")
diff --git a/pypy/jit/backend/model.py b/pypy/jit/backend/model.py
--- a/pypy/jit/backend/model.py
+++ b/pypy/jit/backend/model.py
@@ -167,6 +167,11 @@
GUARD_NO_EXCEPTION, to return the exception."""
return jitframe.jf_finish_ref
+ def set_finish_value_ref(self, jitframe, value):
+ """Store on the jitframe a random GCREF value that will be returned
+ by the following call to get_finish_value_ref()."""
+ jitframe.jf_finish_ref = value
+
def redirect_call_assembler(self, oldlooptoken, newlooptoken):
"""Redirect oldlooptoken to newlooptoken. More precisely, it is
enough to redirect all CALL_ASSEMBLERs already compiled that call
diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py
--- a/pypy/jit/metainterp/compile.py
+++ b/pypy/jit/metainterp/compile.py
@@ -6,6 +6,7 @@
from pypy.rlib.debug import debug_start, debug_stop, debug_print
from pypy.rlib import rstack
from pypy.rlib.jit import JitDebugInfo, Counters
+from pypy.rlib.rerased import new_erasing_pair
from pypy.conftest import option
from pypy.tool.sourcetools import func_with_new_name
@@ -584,6 +585,10 @@
self.copy_all_attributes_into(res)
return res
+
+erase_list_virtuals, unerase_list_virtuals = (
+ new_erasing_pair("list of virtuals"))
+
class ResumeGuardForcedDescr(ResumeGuardDescr):
def __init__(self, metainterp_sd, jitdriver_sd):
@@ -634,34 +639,12 @@
self.save_data(jitframe, all_virtuals)
def save_data(self, jitframe, value):
- return # XXXXX
- globaldata = self.metainterp_sd.globaldata
- if we_are_translated():
- assert key not in globaldata.resume_virtuals
- globaldata.resume_virtuals[key] = value
- else:
- rv = globaldata.resume_virtuals_not_translated
- for key1, value1 in rv:
- assert key1 != key
- rv.append((key, value))
+ llvalue = erase_list_virtuals(value)
+ self.metainterp_sd.cpu.set_finish_value_ref(jitframe, llvalue)
- def fetch_data(self, key):
- XXXXX
- globaldata = self.metainterp_sd.globaldata
- if we_are_translated():
- assert key in globaldata.resume_virtuals
- data = globaldata.resume_virtuals[key]
- del globaldata.resume_virtuals[key]
- else:
- rv = globaldata.resume_virtuals_not_translated
- for i in range(len(rv)):
- if rv[i][0] == key:
- data = rv[i][1]
- del rv[i]
- break
- else:
- assert 0, "not found: %r" % (key,)
- return data
+ def fetch_data(self, jitframe):
+ llvalue = self.metainterp_sd.cpu.get_finish_value_ref(jitframe)
+ return unerase_list_virtuals(llvalue)
def _clone_if_mutable(self):
res = self.__class__(self.metainterp_sd, self.jitdriver_sd)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit