コード例 #1
0
 def setraw(value):
     if we_are_translated():
         _threadlocalref_seeme(self)
         addr = llop.threadlocalref_addr(llmemory.Address)
         llop.raw_store(lltype.Void, addr, offset, value)
     else:
         self.local.rawvalue = value
コード例 #2
0
 def get_or_make_raw():
     if we_are_translated():
         _threadlocalref_seeme(self)
         addr = llop.threadlocalref_addr(llmemory.Address)
         return llop.raw_load(FIELDTYPE, addr, offset)
     else:
         return getattr(self.local, 'rawvalue', zero)
コード例 #3
0
 def execute_token(executable_token, *args):
     clt = executable_token.compiled_loop_token
     assert isinstance(clt, CompiledLoopTokenASMJS)
     funcid = clt.func.compiled_funcid
     loopid = clt.compiled_loopid
     frame_info = clt.func.frame_info
     frame = self.gc_ll_descr.malloc_jitframe(frame_info)
     ll_frame = lltype.cast_opaque_ptr(llmemory.GCREF, frame)
     locs = clt._ll_initial_locs
     if SANITYCHECK:
         assert len(locs) == len(args)
     if not self.translate_support_code:
         prev_interpreter = LLInterpreter.current_interpreter
         LLInterpreter.current_interpreter = self.debug_ll_interpreter
     try:
         # Store each argument into the frame.
         for i, kind in kinds:
             arg = args[i]
             num = locs[i]
             if kind == history.INT:
                 self.set_int_value(ll_frame, num, arg)
             elif kind == history.FLOAT:
                 self.set_float_value(ll_frame, num, arg)
             else:
                 assert kind == history.REF
                 self.set_ref_value(ll_frame, num, arg)
         llop.gc_writebarrier(lltype.Void, ll_frame)
         # Send the threadlocaladdr.
         if self.translate_support_code:
             ll_tlref = llop.threadlocalref_addr(llmemory.Address)
         else:
             ll_tlref = rffi.cast(llmemory.Address,
                                  self._debug_errno_container)
         # Invoke it via the helper.
         ll_frameadr = self.cast_ptr_to_int(ll_frame)
         ll_tladdr = self.cast_adr_to_int(ll_tlref)
         ll_frameadr = support.jitInvoke(funcid, ll_frameadr, ll_tladdr,
                                         loopid)
         ll_frame = self.cast_int_to_ptr(ll_frameadr, llmemory.GCREF)
     finally:
         if not self.translate_support_code:
             LLInterpreter.current_interpreter = prev_interpreter
     return ll_frame
コード例 #4
0
ファイル: runner.py プロジェクト: Darriall/pypy
 def execute_token(executable_token, *args):
     clt = executable_token.compiled_loop_token
     assert isinstance(clt, CompiledLoopTokenASMJS)
     funcid = clt.func.compiled_funcid
     loopid = clt.compiled_loopid
     frame_info = clt.func.frame_info
     frame = self.gc_ll_descr.malloc_jitframe(frame_info)
     ll_frame = lltype.cast_opaque_ptr(llmemory.GCREF, frame)
     locs = clt._ll_initial_locs
     if SANITYCHECK:
         assert len(locs) == len(args)
     if not self.translate_support_code:
         prev_interpreter = LLInterpreter.current_interpreter
         LLInterpreter.current_interpreter = self.debug_ll_interpreter
     try:
         # Store each argument into the frame.
         for i, kind in kinds:
             arg = args[i]
             num = locs[i]
             if kind == history.INT:
                 self.set_int_value(ll_frame, num, arg)
             elif kind == history.FLOAT:
                 self.set_float_value(ll_frame, num, arg)
             else:
                 assert kind == history.REF
                 self.set_ref_value(ll_frame, num, arg)
         llop.gc_writebarrier(lltype.Void, ll_frame)
         # Send the threadlocaladdr.
         if self.translate_support_code:
             ll_tlref = llop.threadlocalref_addr(
                 llmemory.Address)
         else:
             ll_tlref = rffi.cast(llmemory.Address,
                 self._debug_errno_container)
         # Invoke it via the helper.
         ll_frameadr = self.cast_ptr_to_int(ll_frame)
         ll_tladdr = self.cast_adr_to_int(ll_tlref)
         ll_frameadr = support.jitInvoke(funcid, ll_frameadr, ll_tladdr, loopid)
         ll_frame = self.cast_int_to_ptr(ll_frameadr, llmemory.GCREF)
     finally:
         if not self.translate_support_code:
             LLInterpreter.current_interpreter = prev_interpreter
     return ll_frame
コード例 #5
0
ファイル: llmodel.py プロジェクト: Mu-L/pypy
 def execute_token(executable_token, *args):
     clt = executable_token.compiled_loop_token
     assert len(args) == clt._debug_nbargs
     #
     addr = executable_token._ll_function_addr
     func = rffi.cast(FUNCPTR, addr)
     #llop.debug_print(lltype.Void, ">>>> Entering", addr)
     frame_info = clt.frame_info
     frame = self.gc_ll_descr.malloc_jitframe(frame_info)
     ll_frame = lltype.cast_opaque_ptr(llmemory.GCREF, frame)
     locs = executable_token.compiled_loop_token._ll_initial_locs
     prev_interpreter = None   # help flow space
     if not self.translate_support_code:
         prev_interpreter = LLInterpreter.current_interpreter
         LLInterpreter.current_interpreter = self.debug_ll_interpreter
     try:
         for i, kind in kinds:
             arg = args[i]
             num = locs[i]
             if kind == history.INT:
                 self.set_int_value(ll_frame, num, arg)
             elif kind == history.FLOAT:
                 self.set_float_value(ll_frame, num, arg)
             else:
                 assert kind == history.REF
                 self.set_ref_value(ll_frame, num, arg)
         if self.translate_support_code:
             ll_threadlocal_addr = llop.threadlocalref_addr(
                 llmemory.Address)
         else:
             ll_threadlocal_addr = rffi.cast(llmemory.Address,
                 self._debug_tls_errno_container)
         llop.gc_writebarrier(lltype.Void, ll_frame)
         ll_frame = func(ll_frame, ll_threadlocal_addr)
     finally:
         if not self.translate_support_code:
             LLInterpreter.current_interpreter = prev_interpreter
     #llop.debug_print(lltype.Void, "<<<< Back")
     return ll_frame
コード例 #6
0
ファイル: llmodel.py プロジェクト: mozillazg/pypy
 def execute_token(executable_token, *args):
     clt = executable_token.compiled_loop_token
     assert len(args) == clt._debug_nbargs
     #
     addr = executable_token._ll_function_addr
     func = rffi.cast(FUNCPTR, addr)
     #llop.debug_print(lltype.Void, ">>>> Entering", addr)
     frame_info = clt.frame_info
     frame = self.gc_ll_descr.malloc_jitframe(frame_info)
     ll_frame = lltype.cast_opaque_ptr(llmemory.GCREF, frame)
     locs = executable_token.compiled_loop_token._ll_initial_locs
     prev_interpreter = None   # help flow space
     if not self.translate_support_code:
         prev_interpreter = LLInterpreter.current_interpreter
         LLInterpreter.current_interpreter = self.debug_ll_interpreter
     try:
         for i, kind in kinds:
             arg = args[i]
             num = locs[i]
             if kind == history.INT:
                 self.set_int_value(ll_frame, num, arg)
             elif kind == history.FLOAT:
                 self.set_float_value(ll_frame, num, arg)
             else:
                 assert kind == history.REF
                 self.set_ref_value(ll_frame, num, arg)
         if self.translate_support_code:
             ll_threadlocal_addr = llop.threadlocalref_addr(
                 llmemory.Address)
         else:
             ll_threadlocal_addr = rffi.cast(llmemory.Address,
                 self._debug_errno_container)
         llop.gc_writebarrier(lltype.Void, ll_frame)
         ll_frame = func(ll_frame, ll_threadlocal_addr)
     finally:
         if not self.translate_support_code:
             LLInterpreter.current_interpreter = prev_interpreter
     #llop.debug_print(lltype.Void, "<<<< Back")
     return ll_frame