Commits

Maciej Fijalkowski committed 4726582

finish plumbing until we pass a few more tests

Comments (0)

Files changed (8)

 
 * compress the resumedata in the backend
 
-* do escape analysis in the resumeopt.py
+* do escape analysis in the resume/optimizer.py
 
+* make_a_counter_per_value got screwed, but a bit no clue what it does

rpython/jit/metainterp/compile.py

 
     def make_a_counter_per_value(self, guard_value_op):
         assert guard_value_op.getopnum() == rop.GUARD_VALUE
+        # XXX I have no clue what exactly it does, but we killed failargs
+        #     so i is always 0 now
         box = guard_value_op.getarg(0)
-        try:
-            i = guard_value_op.getfailargs().index(box)
-        except ValueError:
-            return     # xxx probably very rare
+        i = 0
+        # used to be i = guard_value_op.getfailargs().index(box)
+        if i > self.CNT_BASE_MASK:
+            return    # probably never, but better safe than sorry
+        if box.type == history.INT:
+            cnt = self.CNT_INT
+        elif box.type == history.REF:
+            cnt = self.CNT_REF
+        elif box.type == history.FLOAT:
+            cnt = self.CNT_FLOAT
         else:
-            if i > self.CNT_BASE_MASK:
-                return    # probably never, but better safe than sorry
-            if box.type == history.INT:
-                cnt = self.CNT_INT
-            elif box.type == history.REF:
-                cnt = self.CNT_REF
-            elif box.type == history.FLOAT:
-                cnt = self.CNT_FLOAT
-            else:
-                assert 0, box.type
-            assert cnt > self.CNT_BASE_MASK
-            self._counter = cnt | i
+            assert 0, box.type
+        assert cnt > self.CNT_BASE_MASK
+        self._counter = cnt | i
 
     def handle_fail(self, deadframe, metainterp_sd, jitdriver_sd):
         if self.must_compile(deadframe, metainterp_sd, jitdriver_sd):

rpython/jit/metainterp/optimizeopt/unroll.py

             op = short[i]
             if op.is_guard():
                 op = op.clone()
-                op.setfailargs(None)
                 descr = target_token.resume_at_jump_descr.clone_if_mutable()
                 op.setdescr(descr)
                 short[i] = op
                 for guard in extra_guards:
                     if guard.is_guard():
                         descr = target.resume_at_jump_descr.clone_if_mutable()
-                        inliner.inline_descr_inplace(descr)
                         guard.setdescr(descr)
                     self.optimizer.send_extra_operation(guard)
 

rpython/jit/metainterp/test/test_loop_unroll.py

     enable_opts = ALL_OPTS_NAMES
 
     automatic_promotion_result = {
-        'int_gt': 1, 'guard_false': 1, 'jump': 1, 'int_add': 3,
+        'int_gt': 2, 'guard_false': 2, 'jump': 1, 'int_add': 6,
         'guard_value': 1
     }
 

rpython/jit/resume/backend.py

     def resume_new(self, result, descr):
         self.deps[result] = DepsFields()
 
-    def resume_newunicode(self, result, length):
+    def resume_newstr(self, result, length):
         self.deps[result] = DepsArray(length)
 
-    def resume_concatunicode(self, result, left, right):
+    def resume_concatstr(self, result, left, right):
         self.deps[result] = DepsConcat(left, right)
 
     def resume_new_with_vtable(self, result, klass):
                 self.resume_clear(op.getarg(0).getint(),
                                   op.getarg(1).getint())
             elif op.getopnum() == rop.RESUME_NEWSTR:
-                xxx
+                self.resume_newstr(op.result, op.getarg(0).getint())
             elif op.getopnum() == rop.RESUME_NEWUNICODE:
-                self.resume_newunicode(op.result, op.getarg(0).getint())
+                self.resume_newstr(op.result, op.getarg(0).getint())
             elif op.getopnum() == rop.RESUME_CONCATSTR:
-                xxx
+                self.resume_concatstr(op.result, op.getarg(0), op.getarg(1))
             elif op.getopnum() == rop.RESUME_CONCATUNICODE:
-                self.resume_concatunicode(op.result, op.getarg(0), op.getarg(1))
+                self.resume_concatstr(op.result, op.getarg(0), op.getarg(1))
             elif op.getopnum() == rop.RESUME_STRSETITEM:
                 self.resume_strsetitem(op.getarg(0), op.getarg(1).getint(),
                                        op.getarg(2))
             self.builder.resume_clear(op.getarg(0).getint(),
                                       op.getarg(1).getint())
         elif op.getopnum() == rop.RESUME_NEWSTR:
-            xxx
+            v_pos = len(self.virtuals)
+            self.virtuals[op.result] = v_pos
+            self.builder.resume_newstr(v_pos, op.getarg(0).getint())
         elif op.getopnum() == rop.RESUME_NEWUNICODE:
             v_pos = len(self.virtuals)
             self.virtuals[op.result] = v_pos
             self.builder.resume_newunicode(v_pos, op.getarg(0).getint())
         elif op.getopnum() == rop.RESUME_CONCATSTR:
-            xxx
+            v_pos = len(self.virtuals)
+            self.virtuals[op.result] = v_pos
+            leftpos = self.get_box_pos(op.getarg(0))
+            rightpos = self.get_box_pos(op.getarg(1))
+            self.builder.resume_concatstr(v_pos, leftpos, rightpos)
         elif op.getopnum() == rop.RESUME_CONCATUNICODE:
             v_pos = len(self.virtuals)
             self.virtuals[op.result] = v_pos

rpython/jit/resume/frontend.py

 
     def finish(self):
         nextbh = None
+        curbh = None
         for frame in self.framestack:
             curbh = self.bhinterpbuilder.acquire_interp()
             curbh.nextblackholeinterp = nextbh

rpython/jit/resume/reader.py

             str2 = lltype.cast_opaque_ptr(lltype.Ptr(rstr.UNICODE), rightval)
             result = funcptr(str1, str2)
             return lltype.cast_opaque_ptr(llmemory.GCREF, result)
-        else:
-            xxx
+        funcptr = cic.funcptr_for_oopspec(EffectInfo.OS_STR_CONCAT)
+        str1 = lltype.cast_opaque_ptr(lltype.Ptr(rstr.STR), leftval)
+        str2 = lltype.cast_opaque_ptr(lltype.Ptr(rstr.STR), rightval)
+        result = funcptr(str1, str2)
+        return lltype.cast_opaque_ptr(llmemory.GCREF, result)
 
 class AbstractResumeReader(object):
     """ A resume reader that can follow resume until given point. Consult
                 self.resume_newunicode(v_pos, lgt)
                 pos += 4
             elif op == rescode.RESUME_CONCATSTR:
-                xxx
+                v_pos = self.read_short(pos + 1)
+                left = self.read_short(pos + 3)
+                right = self.read_short(pos + 5)
+                self.resume_concatstr(v_pos, left, right)
+                pos += 7
             elif op == rescode.RESUME_CONCATUNICODE:
                 v_pos = self.read_short(pos + 1)
                 left = self.read_short(pos + 3)

rpython/jit/resume/rescode.py

         self.write(index)
         self.write_short(encoded_source)
 
+    def resume_concatstr(self, v_pos, leftpos, rightpos):
+        self.write(RESUME_CONCATSTR)
+        self.write_short(v_pos)
+        self.write_short(leftpos)
+        self.write_short(rightpos)
+
     def resume_newunicode(self, v_pos, lgt):
         self.write(RESUME_NEWUNICODE)
         self.write_short(v_pos) # XXX byte virtuals?
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.