Author: Richard Plangger <planri...@gmail.com> Branch: vecopt-merge Changeset: r79905:190de8806c18 Date: 2015-09-30 15:31 +0200 http://bitbucket.org/pypy/pypy/changeset/190de8806c18/
Log: forgot to cache the descr when concrete type is set, some minor changes reverted diff --git a/rpython/jit/backend/arm/assembler.py b/rpython/jit/backend/arm/assembler.py --- a/rpython/jit/backend/arm/assembler.py +++ b/rpython/jit/backend/arm/assembler.py @@ -932,7 +932,6 @@ while regalloc.position() < len(operations) - 1: regalloc.next_instruction() i = regalloc.position() - self.position = i op = operations[i] self.mc.mark_op(op) opnum = op.getopnum() diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py --- a/rpython/jit/backend/arm/opassembler.py +++ b/rpython/jit/backend/arm/opassembler.py @@ -180,13 +180,13 @@ gcmap = allocate_gcmap(self, frame_depth, JITFRAME_FIXED_SIZE) token = ArmGuardToken(self.cpu, gcmap, - descr, - failargs=op.getfailargs(), - fail_locs=arglocs, - offset=offset, - guard_opnum=op.getopnum(), - frame_depth=frame_depth, - fcond=fcond) + descr, + failargs=op.getfailargs(), + fail_locs=arglocs, + offset=offset, + guard_opnum=op.getopnum(), + frame_depth=frame_depth, + fcond=fcond) return token def _emit_guard(self, op, arglocs, is_guard_not_invalidated=False): @@ -199,6 +199,7 @@ pos = self.mc.currpos() token = self.build_guard_token(op, arglocs[0].value, arglocs[1:], pos, fcond) self.pending_guards.append(token) + assert token.guard_not_invalidated() == is_guard_not_invalidated # For all guards that are not GUARD_NOT_INVALIDATED we emit a # breakpoint to ensure the location is patched correctly. In the case # of GUARD_NOT_INVALIDATED we use just a NOP, because it is only diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -209,8 +209,7 @@ def is_array_of_primitives(self): kind = getkind(self.A.OF) return kind == 'float' or \ - kind == 'int' or \ - kind == '' + kind == 'int' def is_always_pure(self): return self._is_pure @@ -221,12 +220,6 @@ def __repr__(self): return 'ArrayDescr(%r)' % (self.OUTERA,) - def get_all_fielddescrs(self): - return self.all_interiorfielddescrs - - def __repr__(self): - return 'ArrayDescr(%r)' % (self.OUTERA,) - def is_array_of_pointers(self): return getkind(self.A.OF) == 'ref' @@ -1069,7 +1062,7 @@ def fail_guard(self, descr, saved_data=None): values = [] - for i,box in enumerate(self.current_op.getfailargs()): + for box in self.current_op.getfailargs(): if box is not None: value = self.env[box] else: @@ -1095,9 +1088,6 @@ argboxes = self.current_op.getarglist() self.do_renaming(argboxes, args) - def execute_guard_early_exit(self, descr): - pass - def _test_true(self, arg): if isinstance(arg, list): return all(arg) diff --git a/rpython/jit/backend/llsupport/assembler.py b/rpython/jit/backend/llsupport/assembler.py --- a/rpython/jit/backend/llsupport/assembler.py +++ b/rpython/jit/backend/llsupport/assembler.py @@ -2,8 +2,8 @@ from rpython.jit.backend.llsupport.memcpy import memcpy_fn, memset_fn from rpython.jit.backend.llsupport.symbolic import WORD from rpython.jit.backend.llsupport.codemap import CodemapBuilder -from rpython.jit.metainterp.history import (INT, REF, FLOAT, VECTOR, - JitCellToken, ConstInt, AbstractFailDescr) +from rpython.jit.metainterp.history import (INT, REF, FLOAT, JitCellToken, + ConstInt, AbstractFailDescr, VECTOR) from rpython.jit.metainterp.resoperation import ResOperation, rop from rpython.rlib import rgc from rpython.rlib.debug import (debug_start, debug_stop, have_debug_prints_for, diff --git a/rpython/jit/backend/llsupport/descr.py b/rpython/jit/backend/llsupport/descr.py --- a/rpython/jit/backend/llsupport/descr.py +++ b/rpython/jit/backend/llsupport/descr.py @@ -285,9 +285,6 @@ def get_item_size_in_bytes(self): return self.itemsize - def get_flag(self): - return self.flag - def is_array_of_structs(self): return self.flag == FLAG_STRUCT @@ -337,18 +334,16 @@ flag = get_type_flag(ARRAY_INSIDE.OF) is_pure = bool(ARRAY_INSIDE._immutable_field(None)) arraydescr = ArrayDescr(basesize, itemsize, lendescr, flag, is_pure) + if ARRAY_INSIDE.OF is lltype.SingleFloat or \ + ARRAY_INSIDE.OF is lltype.Float: + # it would be better to set the flag as FLOAT_TYPE + # for single float -> leads to problems + arraydescr = ArrayDescr(basesize, itemsize, lendescr, flag, is_pure, concrete_type='f') cache[ARRAY_OR_STRUCT] = arraydescr if isinstance(ARRAY_INSIDE.OF, lltype.Struct): descrs = heaptracker.all_interiorfielddescrs(gccache, ARRAY_INSIDE, get_field_descr=get_interiorfield_descr) arraydescr.all_interiorfielddescrs = descrs - concrete_type = '\x00' - if ARRAY_INSIDE.OF is lltype.SingleFloat or \ - ARRAY_INSIDE.OF is lltype.Float: - # it would be better to set the flag as FLOAT_TYPE - # for single float -> leads to problems - concrete_type = 'f' - arraydescr = ArrayDescr(basesize, itemsize, lendescr, flag, is_pure, concrete_type=concrete_type) if ARRAY_OR_STRUCT._gckind == 'gc': gccache.init_array_descr(ARRAY_OR_STRUCT, arraydescr) return arraydescr diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py --- a/rpython/jit/metainterp/blackhole.py +++ b/rpython/jit/metainterp/blackhole.py @@ -1465,13 +1465,11 @@ assert kind == 'v' return lltype.nullptr(rclass.OBJECTPTR.TO) - def _prepare_resume_from_failure(self, opnum, deadframe, resumedescr): + def _prepare_resume_from_failure(self, opnum, deadframe): from rpython.jit.metainterp.resoperation import rop # if opnum == rop.GUARD_FUTURE_CONDITION: pass - elif opnum == rop.GUARD_EARLY_EXIT: - self.position = resumedescr.rd_frame_info_list.pc elif opnum == rop.GUARD_TRUE: # Produced directly by some goto_if_not_xxx() opcode that did not # jump, but which must now jump. The pc is just after the opcode. @@ -1644,7 +1642,7 @@ all_virtuals) current_exc = blackholeinterp._prepare_resume_from_failure( - resumedescr.guard_opnum, deadframe, resumedescr) + resumedescr.guard_opnum, deadframe) _run_forever(blackholeinterp, current_exc) resume_in_blackhole._dont_inline_ = True 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 @@ -19,13 +19,14 @@ ResumeDataDirectReader, AccumInfo) from rpython.jit.codewriter import heaptracker, longlong + def giveup(): from rpython.jit.metainterp.pyjitpl import SwitchToBlackhole raise SwitchToBlackhole(Counters.ABORT_BRIDGE) class CompileData(object): memo = None - + def forget_optimization_info(self): for arg in self.start_label.getarglist(): arg.set_forwarded(None) @@ -149,6 +150,7 @@ loop = TreeLoop(name_prefix + name) return loop + def make_jitcell_token(jitdriver_sd): jitcell_token = JitCellToken() jitcell_token.outermost_jitdriver_sd = jitdriver_sd @@ -359,7 +361,8 @@ enable_opts=enable_opts) try: loop_info, loop_ops = optimize_trace(metainterp_sd, jitdriver_sd, - loop_data) + loop_data, + metainterp.box_names_memo) except InvalidLoop: # Fall back on jumping directly to preamble jump_op = ResOperation(rop.JUMP, inputargs[:], descr=loop_jitcell_token) @@ -369,7 +372,8 @@ inline_short_preamble=False) try: loop_info, loop_ops = optimize_trace(metainterp_sd, jitdriver_sd, - loop_data) + loop_data, + metainterp.box_names_memo) except InvalidLoop: return None @@ -854,7 +858,7 @@ return cloned def exits_early(self): - return True + return False def attach_accum_info(self, pos, operator, arg, loc): self.rd_accum_list = \ diff --git a/rpython/jit/metainterp/jitdriver.py b/rpython/jit/metainterp/jitdriver.py --- a/rpython/jit/metainterp/jitdriver.py +++ b/rpython/jit/metainterp/jitdriver.py @@ -33,4 +33,3 @@ def _freeze_(self): return True - diff --git a/rpython/jit/metainterp/logger.py b/rpython/jit/metainterp/logger.py --- a/rpython/jit/metainterp/logger.py +++ b/rpython/jit/metainterp/logger.py @@ -138,7 +138,7 @@ return 'ConstPtr(ptr' + str(mv) + ')' return 'ConstPtr(null)' elif isinstance(arg, ConstFloat): - return str(arg.getfloatstorage()) + return str(arg.getfloat()) elif arg is None: return 'None' elif arg.is_vector(): diff --git a/rpython/jit/metainterp/optimizeopt/__init__.py b/rpython/jit/metainterp/optimizeopt/__init__.py --- a/rpython/jit/metainterp/optimizeopt/__init__.py +++ b/rpython/jit/metainterp/optimizeopt/__init__.py @@ -11,6 +11,7 @@ from rpython.rlib.unroll import unrolling_iterable from rpython.rlib.debug import debug_start, debug_stop, debug_print + ALL_OPTS = [('intbounds', OptIntBounds), ('rewrite', OptRewrite), ('virtualize', OptVirtualize), @@ -52,9 +53,9 @@ """ debug_start("jit-optimize") inputargs = compile_data.start_label.getarglist() - try: - metainterp_sd.logger_noopt.log_loop(inputargs, compile_data.operations, + metainterp_sd.logger_noopt.log_loop(inputargs, + compile_data.operations, memo=memo) if memo is None: memo = {} 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 @@ -515,6 +515,7 @@ class PlainResOp(AbstractResOp): pass + class ResOpWithDescr(AbstractResOp): _descr = None @@ -1113,13 +1114,6 @@ # must be forced, however we need to execute it anyway '_NOSIDEEFFECT_LAST', # ----- end of no_side_effect operations ----- - '_DEBUG_FIRST', - 'DEBUG_MERGE_POINT/*/n', # debugging only - 'ENTER_PORTAL_FRAME/2/n', # debugging only - 'LEAVE_PORTAL_FRAME/1/n', # debugging only - 'JIT_DEBUG/*/n', # debugging only - '_DEBUG_LAST', - 'INCREMENT_DEBUG_COUNTER/1/n', '_RAW_STORE_FIRST', 'SETARRAYITEM_GC/3d/n', @@ -1141,6 +1135,12 @@ 'UNICODESETITEM/3/n', 'COND_CALL_GC_WB/1d/n', # [objptr] (for the write barrier) 'COND_CALL_GC_WB_ARRAY/2d/n', # [objptr, arrayindex] (write barr. for array) + '_DEBUG_FIRST', + 'DEBUG_MERGE_POINT/*/n', # debugging only + 'ENTER_PORTAL_FRAME/2/n', # debugging only + 'LEAVE_PORTAL_FRAME/1/n', # debugging only + 'JIT_DEBUG/*/n', # debugging only + '_DEBUG_LAST', 'VIRTUAL_REF_FINISH/2/n', # removed before it's passed to the backend 'COPYSTRCONTENT/5/n', # src, dst, srcstart, dststart, length 'COPYUNICODECONTENT/5/n', @@ -1299,6 +1299,7 @@ return type(cls_name, bases, dic) setup(__name__ == '__main__') # print out the table when run directly +del _oplist _opboolinverse = { rop.INT_EQ: rop.INT_NE, diff --git a/rpython/jit/metainterp/warmspot.py b/rpython/jit/metainterp/warmspot.py --- a/rpython/jit/metainterp/warmspot.py +++ b/rpython/jit/metainterp/warmspot.py @@ -70,6 +70,7 @@ def jittify_and_run(interp, graph, args, repeat=1, graph_and_interp_only=False, backendopt=False, trace_limit=sys.maxint, inline=False, loop_longevity=0, retrace_limit=5, function_threshold=4, + disable_unrolling=sys.maxint, enable_opts=ALL_OPTS_NAMES, max_retrace_guards=15, max_unroll_recursion=7, vec=1, vec_all=0, vec_cost=0, vec_length=60, vec_ratio=2, vec_guard_ratio=3, **kwds): @@ -95,6 +96,7 @@ jd.warmstate.set_param_max_retrace_guards(max_retrace_guards) jd.warmstate.set_param_enable_opts(enable_opts) jd.warmstate.set_param_max_unroll_recursion(max_unroll_recursion) + jd.warmstate.set_param_disable_unrolling(disable_unrolling) jd.warmstate.set_param_vec(vec) jd.warmstate.set_param_vec_all(vec_all) jd.warmstate.set_param_vec_cost(vec_cost) diff --git a/rpython/jit/metainterp/warmstate.py b/rpython/jit/metainterp/warmstate.py --- a/rpython/jit/metainterp/warmstate.py +++ b/rpython/jit/metainterp/warmstate.py @@ -381,7 +381,7 @@ if vinfo is not None: virtualizable = args[index_of_virtualizable] vinfo.clear_vable_token(virtualizable) - # + deadframe = func_execute_token(loop_token, *args) # # Record in the memmgr that we just ran this loop, _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit