Example #1
0
 def execute_call_release_gil(self, descr, saveerr, func, *args):
     if hasattr(descr, '_original_func_'):
         func = descr._original_func_  # see pyjitpl.py
         # we want to call the function that does the aroundstate
         # manipulation here (as a hack, instead of really doing
         # the aroundstate manipulation ourselves)
         return self.execute_call_may_force(descr, func, *args)
     guard_op = self.lltrace.operations[self.current_index + 1]
     assert guard_op.getopnum() == rop.GUARD_NOT_FORCED
     self.force_guard_op = guard_op
     call_args = support.cast_call_args_in_order(descr.ARGS, args)
     #
     func_adr = llmemory.cast_int_to_adr(func)
     if hasattr(func_adr.ptr._obj, '_callable'):
         # this is needed e.g. by test_fficall.test_guard_not_forced_fails,
         # because to actually force the virtualref we need to llinterp the
         # graph, not to directly execute the python function
         result = self.cpu.maybe_on_top_of_llinterp(func, call_args,
                                                    descr.RESULT)
     else:
         FUNC = lltype.FuncType(descr.ARGS, descr.RESULT, descr.ABI)
         func_to_call = rffi.cast(lltype.Ptr(FUNC), func)
         result = func_to_call(*call_args)
     del self.force_guard_op
     return support.cast_result(descr.RESULT, result)
Example #2
0
 def execute_call(self, calldescr, func, *args):
     effectinfo = calldescr.get_extra_info()
     if effectinfo is not None and hasattr(effectinfo, 'oopspecindex'):
         oopspecindex = effectinfo.oopspecindex
         if oopspecindex == EffectInfo.OS_MATH_SQRT:
             return self._do_math_sqrt(args[0])
     TP = llmemory.cast_int_to_adr(func).ptr._obj._TYPE
     call_args = support.cast_call_args_in_order(TP.ARGS, args)
     try:
         res = self.cpu.maybe_on_top_of_llinterp(func, call_args, TP.RESULT)
         self.last_exception = None
     except LLException, lle:
         self.last_exception = lle
         res = _example_res[getkind(TP.RESULT)[0]]
Example #3
0
 def execute_call(self, calldescr, func, *args):
     effectinfo = calldescr.get_extra_info()
     if effectinfo is not None and hasattr(effectinfo, 'oopspecindex'):
         oopspecindex = effectinfo.oopspecindex
         if oopspecindex == EffectInfo.OS_MATH_SQRT:
             return self._do_math_sqrt(args[0])
     TP = llmemory.cast_int_to_adr(func).ptr._obj._TYPE
     call_args = support.cast_call_args_in_order(TP.ARGS, args)
     try:
         res = self.cpu.maybe_on_top_of_llinterp(func, call_args, TP.RESULT)
         self.last_exception = None
     except LLException, lle:
         self.last_exception = lle
         res = _example_res[getkind(TP.RESULT)[0]]
Example #4
0
 def execute_call_release_gil(self, descr, saveerr, func, *args):
     if hasattr(descr, '_original_func_'):
         func = descr._original_func_     # see pyjitpl.py
         # we want to call the function that does the aroundstate
         # manipulation here (as a hack, instead of really doing
         # the aroundstate manipulation ourselves)
         return self.execute_call_may_force(descr, func, *args)
     guard_op = self.lltrace.operations[self.current_index + 1]
     assert guard_op.getopnum() == rop.GUARD_NOT_FORCED
     self.force_guard_op = guard_op
     call_args = support.cast_call_args_in_order(descr.ARGS, args)
     #
     func_adr = llmemory.cast_int_to_adr(func)
     if hasattr(func_adr.ptr._obj, '_callable'):
         # this is needed e.g. by test_fficall.test_guard_not_forced_fails,
         # because to actually force the virtualref we need to llinterp the
         # graph, not to directly execute the python function
         result = self.cpu.maybe_on_top_of_llinterp(func, call_args, descr.RESULT)
     else:
         FUNC = lltype.FuncType(descr.ARGS, descr.RESULT, descr.ABI)
         func_to_call = rffi.cast(lltype.Ptr(FUNC), func)
         result = func_to_call(*call_args)
     del self.force_guard_op
     return support.cast_result(descr.RESULT, result)