Author: Armin Rigo <ar...@tunes.org> Branch: shadowstack-again Changeset: r71604:ed8c9de9b293 Date: 2014-05-20 17:58 +0200 http://bitbucket.org/pypy/pypy/changeset/ed8c9de9b293/
Log: Revert partially 35fc2a0ae50c: found out that using r15 to return exceptions gives no measurable speed improvement diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py --- a/rpython/rtyper/lltypesystem/lloperation.py +++ b/rpython/rtyper/lltypesystem/lloperation.py @@ -438,9 +438,6 @@ 'gc_gettypeptr_group': LLOp(canfold=True), 'get_member_index': LLOp(canfold=True), - 'getfield_exc_type': LLOp(sideeffects=False), - 'setfield_exc_type': LLOp(), - # __________ used by the JIT ________ 'jit_marker': LLOp(), diff --git a/rpython/translator/c/src/mem.h b/rpython/translator/c/src/mem.h --- a/rpython/translator/c/src/mem.h +++ b/rpython/translator/c/src/mem.h @@ -224,18 +224,5 @@ pypy_g_rpython_memory_gctypelayout_GCData.gcd_inst_root_stack_top = s; } -#define OP_GETFIELD_EXC_TYPE(r) \ - if (__builtin_expect(((Signed)rpy_shadowstack) & 1, 0)) { \ - r = (struct pypy_object_vtable0 *)(((char *)rpy_shadowstack) - 1); \ - if (!r) __builtin_unreachable(); \ - } \ - else { \ - r = NULL; \ - } -#define OP_SETFIELD_EXC_TYPE(x, r) \ - rpy_shadowstack = (x) ? \ - (struct rpy_shadowstack_s *)(((char *)x) + 1) \ - : NULL - #endif diff --git a/rpython/translator/exceptiontransform.py b/rpython/translator/exceptiontransform.py --- a/rpython/translator/exceptiontransform.py +++ b/rpython/translator/exceptiontransform.py @@ -67,19 +67,17 @@ self.c_n_i_error_ll_exc_type = constant_value(n_i_error_ll_exc_type) def rpyexc_occured(): - exc_type = lloperation.llop.getfield_exc_type( - self.lltype_of_exception_type) + exc_type = exc_data.exc_type return bool(exc_type) def rpyexc_fetch_type(): - return lloperation.llop.getfield_exc_type( - self.lltype_of_exception_type) + return exc_data.exc_type def rpyexc_fetch_value(): return exc_data.exc_value def rpyexc_clear(): - lloperation.llop.setfield_exc_type(lltype.Void, null_type) + exc_data.exc_type = null_type exc_data.exc_value = null_value def rpyexc_raise(etype, evalue): @@ -92,12 +90,12 @@ # us to see at least part of the traceback for them. ll_assert(etype != assertion_error_ll_exc_type, "AssertionError") ll_assert(etype != n_i_error_ll_exc_type, "NotImplementedError") - lloperation.llop.setfield_exc_type(lltype.Void, etype) + exc_data.exc_type = etype exc_data.exc_value = evalue lloperation.llop.debug_start_traceback(lltype.Void, etype) def rpyexc_reraise(etype, evalue): - lloperation.llop.setfield_exc_type(lltype.Void, etype) + exc_data.exc_type = etype exc_data.exc_value = evalue lloperation.llop.debug_reraise_traceback(lltype.Void, etype) @@ -108,8 +106,7 @@ def rpyexc_restore_exception(evalue): if evalue: - lloperation.llop.setfield_exc_type(lltype.Void, - ll_inst_type(evalue)) + exc_data.exc_type = ll_inst_type(evalue) exc_data.exc_value = evalue self.rpyexc_occured_ptr = self.build_func( @@ -146,15 +143,15 @@ lltype.Void, jitcallkind='rpyexc_raise') # for the JIT - #self.rpyexc_fetch_exception_ptr = self.build_func( - # "RPyFetchException", - # rpyexc_fetch_exception, - # [], self.lltype_of_exception_value) + self.rpyexc_fetch_exception_ptr = self.build_func( + "RPyFetchException", + rpyexc_fetch_exception, + [], self.lltype_of_exception_value) - #self.rpyexc_restore_exception_ptr = self.build_func( - # "RPyRestoreException", - # self.noinline(rpyexc_restore_exception), - # [self.lltype_of_exception_value], lltype.Void) + self.rpyexc_restore_exception_ptr = self.build_func( + "RPyRestoreException", + self.noinline(rpyexc_restore_exception), + [self.lltype_of_exception_value], lltype.Void) self.build_extra_funcs() @@ -464,6 +461,7 @@ def setup_excdata(self): EXCDATA = lltype.Struct('ExcData', + ('exc_type', self.lltype_of_exception_type), ('exc_value', self.lltype_of_exception_value)) self.EXCDATA = EXCDATA @@ -484,17 +482,11 @@ return Constant(fn_ptr, lltype.Ptr(FUNC_TYPE)) def gen_getfield(self, name, llops): - if name == 'exc_type': - return llops.genop('getfield_exc_type', [], - resulttype = self.lltype_of_exception_type) c_name = inputconst(lltype.Void, name) return llops.genop('getfield', [self.cexcdata, c_name], resulttype = getattr(self.EXCDATA, name)) def gen_setfield(self, name, v_value, llops): - if name == 'exc_type': - llops.genop('setfield_exc_type', [v_value]) - return c_name = inputconst(lltype.Void, name) llops.genop('setfield', [self.cexcdata, c_name, v_value]) @@ -523,7 +515,6 @@ exc_data = self.exc_data_ptr def rpyexc_get_exception_addr(): - raise NotImplementedError return (llmemory.cast_ptr_to_adr(exc_data) + llmemory.offsetof(EXCDATA, 'exc_type')) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit