Author: Richard Plangger <planri...@gmail.com>
Branch: vecopt-merge
Changeset: r79822:a856dc8ba36f
Date: 2015-09-25 15:30 +0200
http://bitbucket.org/pypy/pypy/changeset/a856dc8ba36f/

Log:    checked for accidental removal of code, or failed merged lines

diff --git a/rpython/jit/backend/llsupport/llmodel.py 
b/rpython/jit/backend/llsupport/llmodel.py
--- a/rpython/jit/backend/llsupport/llmodel.py
+++ b/rpython/jit/backend/llsupport/llmodel.py
@@ -336,7 +336,7 @@
     def cast_int_to_ptr(self, x, TYPE):
         return rffi.cast(TYPE, x)
 
-    def sizeof(self, S, vtable):
+    def sizeof(self, S, vtable=lltype.nullptr(rclass.OBJECT_VTABLE)):
         return get_size_descr(self.gc_ll_descr, S, vtable)
 
     def fielddescrof(self, STRUCT, fieldname):
diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -650,7 +650,6 @@
                 startpos = self.mc.get_relative_pos()
                 self.store_info_on_descr(startpos, tok)
             else:
-                # TODO regalloc.position = tok.position
                 tok.pos_recovery_stub = self.generate_quick_failure(tok, 
regalloc)
         if WORD == 8 and len(self.pending_memoryerror_trampoline_from) > 0:
             self.error_trampoline_64 = self.generate_propagate_error_64()
@@ -1067,8 +1066,6 @@
         if result_loc is ebp:
             self.guard_success_cc = cond
         else:
-            if result_loc.is_xmm:
-                return
             rl = result_loc.lowest8bits()
             self.mc.SET_ir(cond, rl.value)
             self.mc.MOVZX8_rr(result_loc.value, rl.value)
@@ -1789,13 +1786,12 @@
         self.guard_success_cc = rx86.Conditions['E']
         self.implement_guard(guard_token)
 
-    def genop_guard_guard_gc_type(self, ign_1, guard_op,
-                                  guard_token, locs, ign_2):
+    def genop_guard_guard_gc_type(self, guard_op, guard_token, locs, ign):
         self._cmp_guard_gc_type(locs[0], locs[1])
-        self.implement_guard(guard_token, 'NE')
+        self.guard_success_cc = rx86.Conditions['E']
+        self.implement_guard(guard_token)
 
-    def genop_guard_guard_is_object(self, ign_1, guard_op,
-                                    guard_token, locs, ign_2):
+    def genop_guard_guard_is_object(self, guard_op, guard_token, locs, ign):
         assert self.cpu.supports_guard_gc_type
         [loc_object, loc_typeid] = locs
         # idea: read the typeid, fetch the field 'infobits' from the big
@@ -1811,12 +1807,12 @@
             self.cpu.gc_ll_descr.get_translated_info_for_guard_is_object())
         loc_infobits = addr_add(imm(base_type_info), loc_typeid,
                                 scale=shift_by, offset=infobits_offset)
-        self.mc.TEST(loc_infobits, imm(IS_OBJECT_FLAG))
+        self.mc.TEST8(loc_infobits, imm(IS_OBJECT_FLAG))
         #
-        self.implement_guard(guard_token, 'Z')
+        self.guard_success_cc = rx86.Conditions['NZ']
+        self.implement_guard(guard_token)
 
-    def genop_guard_guard_subclass(self, op, guard_op,
-                                   guard_token, locs, ign_2):
+    def genop_guard_guard_subclass(self, guard_op, guard_token, locs, ign):
         assert self.cpu.supports_guard_gc_type
         [loc_object, loc_check_against_class, loc_tmp] = locs
         assert isinstance(loc_object, RegLoc)
@@ -1849,8 +1845,9 @@
         # check by doing the unsigned comparison (tmp - min) < (max - min)
         self.mc.SUB_ri(loc_tmp.value, check_min)
         self.mc.CMP_ri(loc_tmp.value, check_max - check_min)
-        # the guard fails if we get a "not below" result
-        self.implement_guard(guard_token, 'NB')
+        # the guard passes if we get a result of "below"
+        self.guard_success_cc = rx86.Conditions['B']
+        self.implement_guard(guard_token)
 
     def implement_guard_recovery(self, guard_opnum, faildescr, failargs,
                                  fail_locs, frame_depth):
@@ -2078,9 +2075,8 @@
         self.guard_success_cc = rx86.Conditions['E']
         self.implement_guard(guard_token)
 
-    def _genop_call_may_force(self, op, guard_op, guard_token,
-                                   arglocs, result_loc):
-        self._store_force_index(guard_op)
+    def _genop_call_may_force(self, op, arglocs, result_loc):
+        self._store_force_index(self._find_nearby_operation(+1))
         self._genop_call(op, arglocs, result_loc)
     genop_call_may_force_i = _genop_call_may_force
     genop_call_may_force_r = _genop_call_may_force
@@ -2332,6 +2328,7 @@
         self.mc.J_il8(rx86.invert_condition(self.guard_success_cc), 0)
                                                             # patched later
         jmp_adr = self.mc.get_relative_pos()
+        self.guard_success_cc = rx86.cond_none
         #
         self.push_gcmap(self.mc, gcmap, store=True)
         #
diff --git a/rpython/jit/backend/x86/regalloc.py 
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -725,7 +725,7 @@
         args = [op.getarg(1), op.getarg(2)]
         loc1 = self.load_xmm_aligned_16_bytes(args[0])
         loc2 = self.load_xmm_aligned_16_bytes(args[1], args)
-        tmpxvar = TempBox()
+        tmpxvar = TempVar()
         loc3 = self.xrm.force_allocate_reg(tmpxvar, args)
         self.xrm.possibly_free_var(tmpxvar)
         loc0 = self.rm.force_allocate_reg(op, need_lower_byte=True)
@@ -822,7 +822,7 @@
                 resloc = self.rm.after_call(op)
         else:
             resloc = None
-            self.perform(op, arglocs, resloc)
+        self.perform(op, arglocs, resloc)
 
     def _consider_call(self, op, guard_not_forced=False, first_arg_index=1):
         calldescr = op.getdescr()
diff --git a/rpython/jit/backend/x86/vector_ext.py 
b/rpython/jit/backend/x86/vector_ext.py
--- a/rpython/jit/backend/x86/vector_ext.py
+++ b/rpython/jit/backend/x86/vector_ext.py
@@ -325,32 +325,6 @@
         # ----------- pxor
         # 00 11 00 00
 
-    def gen_cmp(func):
-        """ The requirement for func is that it must return one bits for each
-        entry that matches the query, zero otherwise.
-        """
-        def generate_assembler(self, op, guard_op, guard_token, arglocs, 
resloc):
-            lhsloc, rhsloc, sizeloc = arglocs
-            size = sizeloc.value
-            func(self, op, arglocs, lhsloc)
-            guard_opnum = guard_op.getopnum()
-            if guard_opnum == rop.GUARD_TRUE:
-                temp = X86_64_XMM_SCRATCH_REG
-                self.mc.PXOR(temp, temp) # set all to zero
-                self.mc.PCMPEQ(lhsloc, temp, size) # compare
-                self.mc.PCMPEQQ(temp, temp) # set all bits to 1
-                self.mc.PTEST(lhsloc, temp)
-            else:
-                self.mc.PTEST(lhsloc, lhsloc)
-            self.flush_cc(x86.Conditions['NZ'], lhsloc)
-        return generate_assembler
-
-    genop_guard_vec_float_eq = gen_cmp(genop_vec_float_eq)
-    genop_guard_vec_float_ne = gen_cmp(genop_vec_float_ne)
-    genop_guard_vec_int_eq = gen_cmp(genop_vec_int_eq)
-    genop_guard_vec_int_ne = gen_cmp(genop_vec_int_ne)
-    del gen_cmp
-
     def genop_vec_int_signext(self, op, arglocs, resloc):
         srcloc, sizeloc, tosizeloc = arglocs
         size = sizeloc.value
diff --git a/rpython/jit/metainterp/compile.py 
b/rpython/jit/metainterp/compile.py
--- a/rpython/jit/metainterp/compile.py
+++ b/rpython/jit/metainterp/compile.py
@@ -24,7 +24,7 @@
 
 class CompileData(object):
     memo = None
-    
+
     def forget_optimization_info(self):
         for arg in self.start_label.getarglist():
             arg.set_forwarded(None)
@@ -261,7 +261,7 @@
         del enable_opts['unroll']
 
     ops = history.operations[start:]
-    if 'unroll' not in enable_opts:
+    if 'unroll' not in enable_opts or not 
metainterp.cpu.supports_guard_gc_type:
         return compile_simple_loop(metainterp, greenkey, start, inputargs, ops,
                                    jumpargs, enable_opts)
     jitcell_token = make_jitcell_token(jitdriver_sd)
@@ -358,8 +358,7 @@
                                  enable_opts=enable_opts)
     try:
         loop_info, loop_ops = optimize_trace(metainterp_sd, jitdriver_sd,
-                                             loop_data,
-                                             metainterp.box_names_memo)
+                                             loop_data)
     except InvalidLoop:
         # Fall back on jumping directly to preamble
         jump_op = ResOperation(rop.JUMP, inputargs[:], 
descr=loop_jitcell_token)
@@ -682,7 +681,7 @@
     _attrs_ = ('rd_numb', 'rd_count', 'rd_consts', 'rd_virtuals',
                'rd_frame_info_list', 'rd_pendingfields', 'rd_accum_list',
                'status')
-    
+
     rd_numb = lltype.nullptr(NUMBERING)
     rd_count = 0
     rd_consts = None
@@ -890,12 +889,6 @@
 class ResumeAtPositionDescr(ResumeGuardDescr):
     guard_opnum = rop.GUARD_FUTURE_CONDITION
 
-class ResumeAtLoopHeaderDescr(ResumeGuardDescr):
-    guard_opnum = rop.GUARD_EARLY_EXIT
-
-    def exits_early(self):
-        return True
-
 class CompileLoopVersionDescr(ResumeGuardDescr):
     guard_opnum = rop.GUARD_EARLY_EXIT
 
@@ -1002,8 +995,6 @@
         resumedescr = ResumeGuardNotInvalidated()
     elif opnum == rop.GUARD_FUTURE_CONDITION:
         resumedescr = ResumeAtPositionDescr()
-    elif opnum == rop.GUARD_EARLY_EXIT:
-        resumedescr = ResumeAtLoopHeaderDescr()
     elif opnum == rop.GUARD_VALUE:
         resumedescr = ResumeGuardValueDescr()
     elif opnum == rop.GUARD_NONNULL:
@@ -1067,7 +1058,6 @@
     #
     # Attempt to use optimize_bridge().  This may return None in case
     # it does not work -- i.e. none of the existing old_loop_tokens match.
-
     metainterp_sd = metainterp.staticdata
     jitdriver_sd = metainterp.jitdriver_sd
     if isinstance(resumekey, ResumeAtPositionDescr):
@@ -1095,6 +1085,7 @@
         info, newops = optimize_trace(metainterp_sd, jitdriver_sd,
                                       data, metainterp.box_names_memo)
     except InvalidLoop:
+        #pdb.post_mortem(sys.exc_info()[2])
         debug_print("compile_new_bridge: got an InvalidLoop")
         # XXX I am fairly convinced that optimize_bridge cannot actually raise
         # InvalidLoop
diff --git a/rpython/jit/metainterp/history.py 
b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -187,7 +187,7 @@
     else:
         assert lltype.typeOf(value) == llmemory.GCREF
         return ConstPtr(value)
-        
+
 class MissingValue(object):
     "NOT_RPYTHON"
 
@@ -808,14 +808,12 @@
             check['getfield_gc_pure_i'] = check['getfield_gc_pure_r'] = 
check['getfield_gc_pure_f'] = 0
         if 'getarrayitem_gc_pure' in check:
             assert check.pop('getarrayitem_gc_pure') == 0
-            check['getarrayitem_gc_pure_i'] = check['getarrayitem_gc_pure_r'] 
= check['getarrayitem_gc_pure_f'] = 0            
+            check['getarrayitem_gc_pure_i'] = check['getarrayitem_gc_pure_r'] 
= check['getarrayitem_gc_pure_f'] = 0
         if 'getarrayitem_gc' in check:
             assert check.pop('getarrayitem_gc') == 0
             check['getarrayitem_gc_i'] = check['getarrayitem_gc_r'] = 
check['getarrayitem_gc_f'] = 0
         for loop in self.get_all_loops():
             insns = loop.summary(adding_insns=insns, omit_finish=omit_finish)
-        if 'guard_early_exit' in insns:
-            del insns['guard_early_exit']
         return self._check_insns(insns, expected, check)
 
     def _check_insns(self, insns, expected, check):
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py 
b/rpython/jit/metainterp/optimizeopt/rewrite.py
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -273,7 +273,7 @@
                     r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(
                         op)
                     raise InvalidLoop('A GUARD_VALUE (%s) '
-                                      'to always fail' % r)
+                                      'was proven to always fail' % r)
                 return
                     
         if emit_operation:
diff --git a/rpython/jit/metainterp/resoperation.py 
b/rpython/jit/metainterp/resoperation.py
--- a/rpython/jit/metainterp/resoperation.py
+++ b/rpython/jit/metainterp/resoperation.py
@@ -1011,7 +1011,7 @@
     'CAST_INT_TO_FLOAT/1/f',          # need some messy code in the backend
     'CAST_FLOAT_TO_SINGLEFLOAT/1/i',
     'CAST_SINGLEFLOAT_TO_FLOAT/1/f',
-    'CONVERT_FLOAT_BYTES_TO_LONGLONG/1/i',
+    'CONVERT_FLOAT_BYTES_TO_LONGLONG/1/' + ('i' if longlong.is_64_bit else 
'f'),
     'CONVERT_LONGLONG_BYTES_TO_FLOAT/1/f',
     #
     # vector operations
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to