Пример #1
0
 def get_location_str(greenkey):
     greenargs = unwrap_greenkey(greenkey)
     fn = support.maybe_on_top_of_llinterp(rtyper, get_location_ptr)
     llres = fn(*greenargs)
     if not we_are_translated() and isinstance(llres, str):
         return llres
     return hlstr(llres)
Пример #2
0
 def get_location_str(greenkey):
     greenargs = unwrap_greenkey(greenkey)
     fn = support.maybe_on_top_of_llinterp(rtyper, get_location_ptr)
     llres = fn(*greenargs)
     if not we_are_translated() and isinstance(llres, str):
         return llres
     return hlstr(llres)
Пример #3
0
 def get_jitcell(build, *greenargs):
     fn = support.maybe_on_top_of_llinterp(rtyper, get_jitcell_at_ptr)
     cellref = fn(*greenargs)
     # <hacks>
     if we_are_translated():
         BASEJITCELL = lltype.typeOf(cellref)
         cell = cast_base_ptr_to_instance(JitCell, cellref)
     else:
         if isinstance(cellref, (BaseJitCell, type(None))):
             BASEJITCELL = None
             cell = cellref
         else:
             BASEJITCELL = lltype.typeOf(cellref)
             if cellref:
                 cell = lltohlhack[rtyper.type_system.deref(cellref)]
             else:
                 cell = None
     if not build:
         return cell
     if cell is None:
         cell = JitCell()
         # <hacks>
         if we_are_translated():
             cellref = cast_object_to_ptr(BASEJITCELL, cell)
         else:
             if BASEJITCELL is None:
                 cellref = cell
             else:
                 if isinstance(BASEJITCELL, lltype.Ptr):
                     cellref = lltype.malloc(BASEJITCELL.TO)
                 elif isinstance(BASEJITCELL, ootype.Instance):
                     cellref = ootype.new(BASEJITCELL)
                 else:
                     assert False, "no clue"
                 lltohlhack[rtyper.type_system.deref(cellref)] = cell
         # </hacks>
         fn = support.maybe_on_top_of_llinterp(rtyper,
                                               set_jitcell_at_ptr)
         fn(cellref, *greenargs)
     return cell
Пример #4
0
 def get_jitcell(build, *greenargs):
     fn = support.maybe_on_top_of_llinterp(rtyper, get_jitcell_at_ptr)
     cellref = fn(*greenargs)
     # <hacks>
     if we_are_translated():
         BASEJITCELL = lltype.typeOf(cellref)
         cell = cast_base_ptr_to_instance(JitCell, cellref)
     else:
         if isinstance(cellref, (BaseJitCell, type(None))):
             BASEJITCELL = None
             cell = cellref
         else:
             BASEJITCELL = lltype.typeOf(cellref)
             if cellref:
                 cell = lltohlhack[rtyper.type_system.deref(cellref)]
             else:
                 cell = None
     if not build:
         return cell
     if cell is None:
         cell = JitCell()
         # <hacks>
         if we_are_translated():
             cellref = cast_object_to_ptr(BASEJITCELL, cell)
         else:
             if BASEJITCELL is None:
                 cellref = cell
             else:
                 if isinstance(BASEJITCELL, lltype.Ptr):
                     cellref = lltype.malloc(BASEJITCELL.TO)
                 elif isinstance(BASEJITCELL, ootype.Instance):
                     cellref = ootype.new(BASEJITCELL)
                 else:
                     assert False, "no clue"
                 lltohlhack[rtyper.type_system.deref(cellref)] = cell
         # </hacks>
         fn = support.maybe_on_top_of_llinterp(rtyper,
                                               set_jitcell_at_ptr)
         fn(cellref, *greenargs)
     return cell
Пример #5
0
 def ll_portal_runner(*args):
     start = True
     while 1:
         try:
             if start:
                 jd._maybe_enter_from_start_fn(*args)
             return support.maybe_on_top_of_llinterp(rtyper,
                                               portal_ptr)(*args)
         except self.ContinueRunningNormally, e:
             args = ()
             for ARGTYPE, attrname, count in portalfunc_ARGS:
                 x = getattr(e, attrname)[count]
                 x = specialize_value(ARGTYPE, x)
                 args = args + (x,)
             start = False
             continue
         except self.DoneWithThisFrameVoid:
             assert result_kind == 'void'
             return
Пример #6
0
 def ll_portal_runner(*args):
     start = True
     while 1:
         try:
             if start:
                 jd._maybe_enter_from_start_fn(*args)
             return support.maybe_on_top_of_llinterp(rtyper,
                                               portal_ptr)(*args)
         except self.ContinueRunningNormally, e:
             args = ()
             for ARGTYPE, attrname, count in portalfunc_ARGS:
                 x = getattr(e, attrname)[count]
                 x = specialize_value(ARGTYPE, x)
                 args = args + (x,)
             start = False
             continue
         except self.DoneWithThisFrameVoid:
             assert result_kind == 'void'
             return
Пример #7
0
 def can_never_inline(*greenargs):
     fn = support.maybe_on_top_of_llinterp(rtyper,
                                           can_never_inline_ptr)
     return fn(*greenargs)
Пример #8
0
 def confirm_enter_jit(*args):
     fn = support.maybe_on_top_of_llinterp(rtyper,
                                           confirm_enter_jit_ptr)
     return fn(*args)
Пример #9
0
 def should_unroll_one_iteration(greenkey):
     greenargs = unwrap_greenkey(greenkey)
     fn = support.maybe_on_top_of_llinterp(rtyper, inline_ptr)
     return fn(*greenargs)
Пример #10
0
 def can_never_inline(*greenargs):
     fn = support.maybe_on_top_of_llinterp(rtyper,
                                           can_never_inline_ptr)
     return fn(*greenargs)
Пример #11
0
 def confirm_enter_jit(*args):
     fn = support.maybe_on_top_of_llinterp(rtyper,
                                           confirm_enter_jit_ptr)
     return fn(*args)
Пример #12
0
 def should_unroll_one_iteration(greenkey):
     greenargs = unwrap_greenkey(greenkey)
     fn = support.maybe_on_top_of_llinterp(rtyper, inline_ptr)
     return fn(*greenargs)