Author: Maciej Fijalkowski <[email protected]>
Branch: continulet-jit-3
Changeset: r58250:794269d9494a
Date: 2012-10-19 18:10 +0200
http://bitbucket.org/pypy/pypy/changeset/794269d9494a/

Log:    (arigo, fijal) slow progress on restoring the virtualizable

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
@@ -131,6 +131,10 @@
     def is_float_field(self):
         return getkind(self.FIELD) == 'float'
 
+class JFDescrDescr(AbstractDescr):
+    def is_pointer_field(self):
+        return True
+
 _example_res = {'v': None,
                 'r': lltype.nullptr(llmemory.GCREF.TO),
                 'i': 0,
@@ -270,6 +274,14 @@
     def get_savedata_ref(self, frame):
         return frame.saved_data
 
+    def jitframe_get_jfdescr_descr(self):
+        return JFDescrDescr()
+
+    def jitframe_cast_jfdescr_to_descr(self, descr):
+        return descr
+    
+    # ------------------------------------------------------------
+
     def calldescrof(self, FUNC, ARGS, RESULT, effect_info):
         key = ('call', getkind(RESULT),
                tuple([getkind(A) for A in ARGS]),
@@ -368,6 +380,9 @@
     bh_call_v = _do_call
 
     def bh_getfield_gc(self, p, descr):
+        if isinstance(descr, JFDescrDescr):
+            p.latest_descr._TYPE = llmemory.GCREF # <XXX> HACK <XXX/>
+            return p.latest_descr
         p = support.cast_arg(lltype.Ptr(descr.S), p)
         return support.cast_result(descr.FIELD, getattr(p, descr.fieldname))
 
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
@@ -232,6 +232,11 @@
     def typedescrof(self, TYPE):
         raise NotImplementedError
 
+    def jitframe_get_jfdescr_descr(self):
+        """ Return a descr that can be used to read the XXX field
+        """
+        raise NotImplementedError
+
     # ---------- the backend-dependent operations ----------
 
     # lltype specific operations
diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -750,8 +750,8 @@
         descr = cpu.jitframe_cast_jfdescr_to_descr(jfdescr)
         if not descr:
             return
-        import pdb; pdb.set_trace()
-        xxx
+        resume.rebuild_virtualizable_from_resumedata(self.metainterp, descr,
+                                                     vinfo, box)
 
     def _get_virtualizable_field_index(self, fielddescr):
         # Get the index of a fielddescr.  Must only be called for
diff --git a/pypy/jit/metainterp/resume.py b/pypy/jit/metainterp/resume.py
--- a/pypy/jit/metainterp/resume.py
+++ b/pypy/jit/metainterp/resume.py
@@ -694,9 +694,8 @@
     virtuals_cache = None
     virtual_default = None
 
-    def _init(self, cpu, jitframe, storage):
+    def _init(self, cpu, storage):
         self.cpu = cpu
-        self.jitframe = jitframe
         self.cur_numb = storage.rd_numb
         self.consts = storage.rd_consts
 
@@ -798,7 +797,8 @@
     unique_id = lambda: None
 
     def __init__(self, jitframe, storage, metainterp):
-        self._init(metainterp.cpu, jitframe, storage)
+        self._init(metainterp.cpu, storage)
+        self.jitframe = jitframe
         self.metainterp = metainterp
         count = metainterp.cpu.get_latest_value_count(jitframe)
         self.liveboxes = [None] * count
@@ -1004,6 +1004,22 @@
     def write_a_float(self, index, box):
         self.boxes_f[index] = box
 
+def rebuild_virtualizable_from_resumedata(metainterp, storage,
+                                          virtualizable_info, vable_box):
+    resumereader = ResumeDataForceVirtualizableReader(storage, metainterp,
+                                                      vable_box)
+    resumereader.consume_vref_and_vable_boxes(virtualizable_info,
+                                              None)
+
+class ResumeDataForceVirtualizableReader(ResumeDataBoxReader):
+    def __init__(self, storage, metainterp, vable_box):
+        self.metainterp = metainterp
+        self._init(metainterp.cpu, storage)
+        self.liveboxes = [None] * xxx
+
+    def load_box_from_cpu(self, num, kind):
+        xxx
+
 # ---------- when resuming for blackholing, get direct values ----------
 
 def blackhole_from_resumedata(blackholeinterpbuilder, jitdriver_sd,
@@ -1064,7 +1080,8 @@
     #             2: resuming from the GUARD_NOT_FORCED
 
     def __init__(self, metainterp_sd, jitframe, storage, all_virtuals=None):
-        self._init(metainterp_sd.cpu, jitframe, storage)
+        self._init(metainterp_sd.cpu, storage)
+        self.jitframe = jitframe
         self.callinfocollection = metainterp_sd.callinfocollection
         if all_virtuals is None:        # common case
             self._prepare(storage)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to