-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] refactor pp_tied #13874
Comments
From @bulk88Created by @bulk88See attached patch. Perl Info
|
From @bulk880001-refactor-pp_tied.patchFrom 45753263334050eb7b0da59d7dc0b31f9ffc66db Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Tue, 27 May 2014 17:14:20 -0400
Subject: [PATCH] refactor pp_tied
remove some redundant code regarding stack handling
-removed:
-4/-8 pop on SP
+4/+8 push on SP
PUTBACK
function's machine code size dropped from 0xC5 to 0xBD bytes on VC2003
---
pp_sys.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/pp_sys.c b/pp_sys.c
index 9f97177..175fad3 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1003,21 +1003,23 @@ PP(pp_tied)
dVAR;
dSP;
const MAGIC *mg;
- SV *sv = POPs;
+ dTOPss;
const char how = (SvTYPE(sv) == SVt_PVHV || SvTYPE(sv) == SVt_PVAV)
? PERL_MAGIC_tied : PERL_MAGIC_tiedscalar;
if (isGV_with_GP(sv) && !SvFAKE(sv) && !(sv = MUTABLE_SV(GvIOp(sv))))
- RETPUSHUNDEF;
+ goto ret_undef;
if (SvTYPE(sv) == SVt_PVLV && LvTYPE(sv) == 'y' &&
- !(sv = defelem_target(sv, NULL))) RETPUSHUNDEF;
+ !(sv = defelem_target(sv, NULL))) goto ret_undef;
if ((mg = SvTIED_mg(sv, how))) {
- PUSHs(SvTIED_obj(sv, mg));
- RETURN;
+ SETs(SvTIED_obj(sv, mg));
+ return NORMAL; /* PUTBACK not needed, pp_tied never moves SP */
}
- RETPUSHUNDEF;
+ ret_undef:
+ SETs(&PL_sv_undef);
+ return NORMAL;
}
PP(pp_dbmopen)
--
1.7.9.msysgit.0
|
From @bulk88On Tue May 27 14:16:49 2014, bulk88 wrote:
Interesting trivia, in Strawberry Perl 5.18, GCC optimize out the -4 and +4 to SP (and that is across function calls), it didn't optimize out the PUTBACK. Quite interesting the GCC optimizer looks so many lines back/forwards. -- |
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#121969 (status was 'resolved')
Searchable as RT121969$
The text was updated successfully, but these errors were encountered: