Skip to content
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

PERL_NO_GET_CONTEXT+win32 fix #7

Merged
merged 3 commits into from
Dec 30, 2015
Merged

PERL_NO_GET_CONTEXT+win32 fix #7

merged 3 commits into from
Dec 30, 2015

Conversation

bulk88
Copy link

@bulk88 bulk88 commented Oct 23, 2015

No description provided.

On Win32 expat installs by default to "C:\Program Files\Expat 2.1.0" which
has spaces, this makes compiling impossible since the cmd lines to CC and
LD are broken.
@toddr
Copy link
Member

toddr commented Oct 24, 2015

Can you clarify why "alot less Perl_get_context func calls" is a good thing pls?

With VC 2013 32b -O1, with threaded perl 5.23.5, with C expat library in a
separate DLL (no static linking), before this patch, Expat.dll was 47KB
on disk, with a .text section size of 0x8BF0 bytes of x86 machine code,
and 1616 call sites to Perl_get_context (on threaded unix perl, it would
be pthread_getspecific isntead of Perl_get_context). After this patch,
Expat.dll is 42 KB on disk, .text size is 0x7800 bytes, and
Perl_get_context has 0 call sites (it isn't imported anymore).
ERRSV is a macro that contains a getter function call. Only plain vars
or non function containing expressions can be placed in macros that
evaluate their argument multiple times like SvTRUE (a dozen times) and
SvPV (2 times). In this case Perl_gv_add_by_type which is a getter func
inside ERRSV was called dozens and dozens of times inside
externalEntityRef. Save the SV* to a C auto to prevent multiple getter
function calls to Perl_gv_add_by_type. This decreases the .text section
size of Expat.dll (VC2013 -O1, threaded perl, expat lib is a seperate
DLL) from 0x7800 to 0x73E0 bytes of x86 machine code.
@bulk88
Copy link
Author

bulk88 commented Oct 24, 2015

Made the commit message more wordy and added another patch (again with a wordy message). PERL_NO_GET_CONTEXT makes absolutely no difference for unthreaded perls, since the perl engine is C global vars, and those C global vars cross shared lib boundaries, but on threaded perl, there are no C global vars, and the interp is stored in a malloc block, so there can be multiple interps in 1 process, therefore each interp needs its "my_perl" pointer, without PERL_NO_GET_CONTEXT, for source code backwards compatibility the perl engine pointer must be fetched from thread local storage with a function call every time it needed, which is atleast once in every single Perl API global var (PL_*) and macro, and function call, and typically half a dozen times per C statement.

@bulk88
Copy link
Author

bulk88 commented Oct 30, 2015

Bump.

@toddr
Copy link
Member

toddr commented Oct 30, 2015

I probably won't have a release for a month or so. is this a rush?

@bulk88
Copy link
Author

bulk88 commented Oct 30, 2015

No, but I would like it to be released early enough to make into Active and Strawberry Perl 5.24 (before spring 2016), so Im fine with waiting a month.

@bulk88
Copy link
Author

bulk88 commented Nov 28, 2015

Could you please merge this to your master so I can delete my repo?

toddr added a commit that referenced this pull request Dec 30, 2015
PERL_NO_GET_CONTEXT+win32 fix
@toddr toddr merged commit 0febec1 into cpan-authors:master Dec 30, 2015
@toddr
Copy link
Member

toddr commented Apr 13, 2016

I'm having to revert this. Your code doesn't function when PERL_IMPLICIT_CONTEXT isn't defined. It isn't always and in point of fact, travis doesn't define it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants