This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid using space to create 2 functions just to force mathoms to be
authorNicholas Clark <nick@ccl4.org>
Sun, 29 Jan 2006 00:09:10 +0000 (00:09 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 29 Jan 2006 00:09:10 +0000 (00:09 +0000)
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

embed.fnc
embed.h
intrpvar.h
mathoms.c
perl.c
proto.h

index 9cd0ff1..4d46a2a 100644 (file)
--- 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 (file)
--- a/embed.h
+++ b/embed.h
 #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
 #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
index aa0f0c3..3d3db7a 100644 (file)
@@ -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 */
index d3713f5..2acdb42 100644 (file)
--- 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 (file)
--- 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 (file)
--- 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