-
Notifications
You must be signed in to change notification settings - Fork 560
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 av_delete #13659
Comments
From @bulk88Created by @bulk88See attached patch. Perl Info
|
From @bulk880001-refactor-av_delete.patchFrom 5d065ae2a1ec0881fd2ece2f97b5511dd4adff11 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Thu, 13 Mar 2014 02:51:51 -0400
Subject: [PATCH] refactor av_delete
Some bad code generation/bad optimization from VC caused me to clean this
up. Dont write AvARRAY(av)[key] = NULL twice. It appears in 2 branches
just as written VC asm wise. Don't call sv_2mortal on a NULL SV*. It
works but less efficient. On VC2008 x64 -O1 this func dropped from 0x208
to 0x202 bytes of machine code after this patch.
---
av.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/av.c b/av.c
index 5ef3a55..c08d2c2 100644
--- a/av.c
+++ b/av.c
@@ -889,23 +889,23 @@ Perl_av_delete(pTHX_ AV *av, SSize_t key, I32 flags)
if (!AvREAL(av) && AvREIFY(av))
av_reify(av);
sv = AvARRAY(av)[key];
+ AvARRAY(av)[key] = NULL;
if (key == AvFILLp(av)) {
- AvARRAY(av)[key] = NULL;
do {
AvFILLp(av)--;
} while (--key >= 0 && !AvARRAY(av)[key]);
}
- else
- AvARRAY(av)[key] = NULL;
if (SvSMAGICAL(av))
mg_set(MUTABLE_SV(av));
}
- if (flags & G_DISCARD) {
- SvREFCNT_dec(sv);
- sv = NULL;
+ if(sv != NULL) {
+ if (flags & G_DISCARD) {
+ SvREFCNT_dec_NN(sv);
+ return NULL;
+ }
+ else if (AvREAL(av))
+ sv_2mortal(sv);
}
- else if (AvREAL(av))
- sv = sv_2mortal(sv);
return sv;
}
--
1.8.0.msysgit.0
|
From @bulk88On Thu Mar 13 11:06:24 2014, bulk88 wrote:
I didn't smoke this due to another bug I'm dealing with, so you may find out it fails when you test it. -- |
From @tonycozOn Thu Mar 13 11:06:24 2014, bulk88 wrote:
I'll apply this after 5.20, added as a 5.21.1 blocker. Tony |
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#121436 (status was 'resolved')
Searchable as RT121436$
The text was updated successfully, but these errors were encountered: