From: Nicholas Clark Date: Sun, 29 Jan 2006 00:09:10 +0000 (+0000) Subject: Avoid using space to create 2 functions just to force mathoms to be X-Git-Tag: perl-5.9.4~1530 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/d0647d4e83baeaee38f56423fa99ba248e8c0db2?ds=inline;hp=90e5519e3100e145a0051dac121e038bd45695c6 Avoid using space to create 2 functions just to force mathoms to be linked. Instead, force the link via the perl interpreter structure via a function pointer that gets replaced at run time anyway. p4raw-id: //depot/perl@26990 --- diff --git a/embed.fnc b/embed.fnc index 9cd0ff1..4d46a2a 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1012,7 +1012,11 @@ pMX |int |sv_release_IVX |NN SV *sv Adp |void |sv_nosharing |NULLOK SV *sv Adpbm |void |sv_nolocking |NULLOK SV *sv +#ifdef NO_MATHOMS Adpbm |void |sv_nounlocking |NULLOK SV *sv +#else +Adpb |void |sv_nounlocking |NULLOK SV *sv +#endif Adp |int |nothreadhook END_EXTERN_C diff --git a/embed.h b/embed.h index a8867d8..745aad7 100644 --- a/embed.h +++ b/embed.h @@ -1027,6 +1027,10 @@ #endif #endif #define sv_nosharing Perl_sv_nosharing +#ifdef NO_MATHOMS +#else +#define sv_nounlocking Perl_sv_nounlocking +#endif #define nothreadhook Perl_nothreadhook #if defined(PERL_IN_DOOP_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE @@ -3067,6 +3071,10 @@ #endif #endif #define sv_nosharing(a) Perl_sv_nosharing(aTHX_ a) +#ifdef NO_MATHOMS +#else +#define sv_nounlocking(a) Perl_sv_nounlocking(aTHX_ a) +#endif #define nothreadhook() Perl_nothreadhook(aTHX) #if defined(PERL_IN_DOOP_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE diff --git a/intrpvar.h b/intrpvar.h index aa0f0c3..3d3db7a 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -484,7 +484,14 @@ PERLVAR(Ireentrant_retint, int) /* Integer return value from reentrant functions /* Hooks to shared SVs and locks. */ PERLVARI(Isharehook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nosharing)) PERLVARI(Ilockhook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nosharing)) -PERLVARI(Iunlockhook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nosharing)) +#ifdef NO_MATHOMS +# define PERL_UNLOCK_HOOK Perl_sv_nosharing +#else +/* This reference ensures that the mathoms are linked with perl */ +# define PERL_UNLOCK_HOOK Perl_sv_nounlocking +#endif +PERLVARI(Iunlockhook, share_proc_t, MEMBER_TO_FPTR(PERL_UNLOCK_HOOK)) + PERLVARI(Ithreadhook, thrhook_proc_t, MEMBER_TO_FPTR(Perl_nothreadhook)) /* Force inclusion of both runops options */ diff --git a/mathoms.c b/mathoms.c index d3713f5..2acdb42 100644 --- a/mathoms.c +++ b/mathoms.c @@ -29,8 +29,6 @@ #define PERL_IN_MATHOMS_C #include "perl.h" -void Perl_mathoms(void) {} - /* ref() is now a macro using Perl_doref; * this version provided for binary compatibility only. */ diff --git a/perl.c b/perl.c index 68c597b..82960f3 100644 --- a/perl.c +++ b/perl.c @@ -137,15 +137,6 @@ static I32 read_e_script(pTHX_ int idx, SV *buf_sv, int maxlen); #endif #endif -#ifndef NO_MATHOMS -/* This reference ensures that the mathoms are linked with perl */ -extern void Perl_mathoms(void); -void Perl_mathoms_ref(void); -void Perl_mathoms_ref(void) { - Perl_mathoms(); -} -#endif - static void S_init_tls_and_interp(PerlInterpreter *my_perl) { diff --git a/proto.h b/proto.h index f401ade..6272c76 100644 --- a/proto.h +++ b/proto.h @@ -2808,7 +2808,11 @@ PERL_CALLCONV int Perl_sv_release_IVX(pTHX_ SV *sv) PERL_CALLCONV void Perl_sv_nosharing(pTHX_ SV *sv); /* PERL_CALLCONV void Perl_sv_nolocking(pTHX_ SV *sv); */ +#ifdef NO_MATHOMS /* PERL_CALLCONV void Perl_sv_nounlocking(pTHX_ SV *sv); */ +#else +PERL_CALLCONV void Perl_sv_nounlocking(pTHX_ SV *sv); +#endif PERL_CALLCONV int Perl_nothreadhook(pTHX); END_EXTERN_C