Esempio n. 1
0
 def finaloplist(self, jitcell_token=None, reset_label_token=True, label=False):
     oplist = []
     if jitcell_token:
         if reset_label_token:
             token = TargetToken(jitcell_token)
             token.original_jitcell_token = jitcell_token
             jitcell_token.target_tokens.append(token)
             self.label.setdescr(token)
         else:
             token = self.jump.getdescr()
             assert isinstance(token, TargetToken)
         if self.prefix_label:
             token = TargetToken(jitcell_token)
             token.original_jitcell_token = jitcell_token
             jitcell_token.target_tokens.append(token)
             self.prefix_label.setdescr(token)
             self.jump.setdescr(token)
         if reset_label_token:
             self.jump.setdescr(token)
     if self.prefix_label:
         oplist = self.prefix + [self.prefix_label]
     elif self.prefix:
         oplist = self.prefix
     if label:
         oplist = [self.label] + oplist
     return oplist + self.operations + [self.jump]
Esempio n. 2
0
def compile_simple_loop(metainterp, greenkey, trace, runtime_args, enable_opts,
                        cut_at):
    from rpython.jit.metainterp.optimizeopt import optimize_trace

    jitdriver_sd = metainterp.jitdriver_sd
    metainterp_sd = metainterp.staticdata
    jitcell_token = make_jitcell_token(jitdriver_sd)
    call_pure_results = metainterp.call_pure_results
    data = SimpleCompileData(trace, call_pure_results=call_pure_results,
                             enable_opts=enable_opts)
    try:
        loop_info, ops = optimize_trace(metainterp_sd, jitdriver_sd,
                                        data, metainterp.box_names_memo)
    except InvalidLoop:
        trace.cut_at(cut_at)
        return None
    loop = create_empty_loop(metainterp)
    loop.original_jitcell_token = jitcell_token
    loop.inputargs = loop_info.inputargs
    if loop_info.quasi_immutable_deps:
        loop.quasi_immutable_deps = loop_info.quasi_immutable_deps
    jump_op = ops[-1]
    target_token = TargetToken(jitcell_token)
    target_token.original_jitcell_token = jitcell_token
    label = ResOperation(rop.LABEL, loop_info.inputargs[:], descr=target_token)
    jump_op.setdescr(target_token)
    loop.operations = [label] + ops
    if not we_are_translated():
        loop.check_consistency()
    jitcell_token.target_tokens = [target_token]
    send_loop_to_backend(greenkey, jitdriver_sd, metainterp_sd, loop, "loop",
                         runtime_args, metainterp.box_names_memo)
    record_loop_or_bridge(metainterp_sd, loop)
    return target_token
Esempio n. 3
0
 def finalize_short_preamble(self, label_op, virtual_state):
     sb = self.short_preamble_producer
     self.optimizer._clean_optimization_info(sb.short_inputargs)
     short_preamble = sb.build_short_preamble()
     jitcelltoken = label_op.getdescr()
     assert isinstance(jitcelltoken, JitCellToken)
     if jitcelltoken.target_tokens is None:
         jitcelltoken.target_tokens = []
     target_token = TargetToken(jitcelltoken,
                                original_jitcell_token=jitcelltoken)
     target_token.original_jitcell_token = jitcelltoken
     target_token.virtual_state = virtual_state
     target_token.short_preamble = short_preamble
     jitcelltoken.target_tokens.append(target_token)
     self.short_preamble_producer = ExtendedShortPreambleBuilder(
         target_token, sb)
     label_op.initarglist(label_op.getarglist() + sb.used_boxes)
     return target_token
Esempio n. 4
0
 def finalize_short_preamble(self, label_op, virtual_state):
     sb = self.short_preamble_producer
     self.optimizer._clean_optimization_info(sb.short_inputargs)
     short_preamble = sb.build_short_preamble()
     jitcelltoken = label_op.getdescr()
     assert isinstance(jitcelltoken, JitCellToken)
     if jitcelltoken.target_tokens is None:
         jitcelltoken.target_tokens = []
     target_token = TargetToken(jitcelltoken,
                                original_jitcell_token=jitcelltoken)
     target_token.original_jitcell_token = jitcelltoken
     target_token.virtual_state = virtual_state
     target_token.short_preamble = short_preamble
     jitcelltoken.target_tokens.append(target_token)
     self.short_preamble_producer = ExtendedShortPreambleBuilder(
         target_token, sb)
     label_op.initarglist(label_op.getarglist() + sb.used_boxes)
     return target_token