Closed p5pRT closed 21 years ago
I've built a threaded _63 on NeXTstep. The patch below fixes all but one of the issues I encountered:
1. Threaded malloc.c assumes the existence of two new macros MUTEX_LOCK_NOCONTEXT and MUTEX_UNLOCK_NOCONTEXT. They were not provided in the Mach threads section of thread.h
2. The THR macro must contain a cast to struct perl_thread *; there was not such cast in the Mach version.
3. dl_next.xs calls form(); that function is now called Perl_form_nocontext(). There's a macro in embed.h to make this work\, but XSLoader disables it by adding -DPERL_CORE to its CCFLAGS. An alternative fix would be to replace all occurrences of form() in dl_next.xs by Perl_form_nocontext().
4. A similar porblem exists in SDBM_File: it tries to call memcmp(). Unfortunately the memcmp() provided by NeXT is buggy. Furtunately\, perl comes with a drop-in replacement called Perl_my_memcmp(). Unfortunately\, the threaded version of Perl_my_memcmp() takes an extra argument\, so its no longer a valid replacement for memcmp(). The result is that SDBM_File calls Perl_my_memcmp() with the wrong number of arguments. I could fix this by writing a function Perl_my_memcmp_nocontext() with the same prototype as ANSI memcmp()\, but AFAIK Perl_my_memcmp() serves no other purpose than as a drop-in replacement for memcmp() on platforms where the latter is missing or defective\, so I think the proper fix is to remove the extra argument. I think the same goes for memset()\, bcopy() and bzero().
-- HansM
--- thread.h.orig Wed Oct 6 02:58:56 1999 *** thread.h Thu Dec 30 00:26:38 1999 @@ -73\,7 +73\,9 @@ } STMT_END
#define MUTEX_LOCK(m) mutex_lock(*m) +#define MUTEX_LOCK_NOCONTEXT(m) mutex_lock(*m) #define MUTEX_UNLOCK(m) mutex_unlock(*m) +#define MUTEX_UNLOCK_NOCONTEXT(m) mutex_unlock(*m) #define MUTEX_DESTROY(m) \ STMT_START { \ mutex_free(*m); \ @@ -109\,7 +111\,7 @@ #define JOIN(t\, avp) (*(avp) = (AV *)cthread_join(t->self))
#define SET_THR(thr) cthread_set_data(cthread_self()\, thr) -#define THR cthread_data(cthread_self()) +#define THR ((struct perl_thread *)cthread_data(cthread_self()))
#define INIT_THREADS cthread_init() #define YIELD cthread_yield() --- ext/DynaLoader/Makefile.PL.orig Wed Dec 29 16:39:12 1999 *** ext/DynaLoader/Makefile.PL Thu Dec 30 19:34:15 1999 @@ -3\,7 +3\,7 @@ WriteMakefile( NAME => 'DynaLoader'\, LINKTYPE => 'static'\, - DEFINE => '-DPERL_CORE -DLIBC="$(LIBC)"'\, + DEFINE => '-DLIBC="$(LIBC)"'\, MAN3PODS => {}\, # Pods will be built by installman. SKIP => [qw(dynamic dynamic_lib dynamic_bs)]\, XSPROTOARG => '-noprototypes'\, # XXX remove later?
Site configuration information for perl 5.00563:
Configured by hansm at Wed Dec 29 19:04:12 MET 1999.
Summary of my perl5 (revision 5.0 version 5 subversion 63) configuration: Platform: osname=next\, osvers=4_2\, archname=OPENSTEP-Mach-thread uname='bombadil ' config_args='-des -Dcf_email=hansmu@xs4all.nl -Dusethreads -Doptimize=-g -O' hint=recommended\, useposix=undef\, d_sigaction=undef usethreads=define useperlio=undef d_sfio=undef use64bits=undef usemultiplicity=undef Compiler: cc='cc'\, optimize='-g -O'\, gccversion=NeXT DevKit-based CPP 4.0 cppflags='-dynamic -fno-common -DUSE_NEXT_CTYPE -DUSE_PERL_SBRK -arch m68k -DDEBUGGING -I/usr/local/include' ccflags ='-dynamic -fno-common -DUSE_NEXT_CTYPE -DUSE_PERL_SBRK -arch m68k -arch i386 -DDEBUGGING -I/usr/local/include' stdchar='char'\, d_stdstdio=define\, usevfork=false intsize=4\, longsize=4\, ptrsize=4\, doublesize=8 d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12 alignbytes=8\, usemymalloc=y\, prototype=define Linker and Libraries: ld='cc'\, ldflags =' -dynamic -prebind -arch m68k -arch i386 -L/usr/local/lib' libpth=/lib /usr/lib /usr/local/lib libs= libc=/NextLibrary/Frameworks/System.framework/System\, so=dylib\, useshrplib=true\, libperl=libperl.5.dylib Dynamic Linking: dlsrc=dl_next.xs\, dlext=bundle\, d_dlsymun=undef\, ccdlflags=' ' cccdlflags=' '\, lddlflags=' -dynamic -bundle -undefined suppress -arch m68k -arch i386 -L/usr/local/lib'
Locally applied patches:
@INC for perl 5.00563: lib /Users/hansm/lib/perl /usr/local/OPENSTEP/lib/perl5/5.00563/OPENSTEP-Mach-thread /usr/local/OPENSTEP/lib/perl5/5.00563 /usr/local/OPENSTEP/lib/site_perl/5.00563/OPENSTEP-Mach-thread /usr/local/OPENSTEP/lib/site_perl .
Environment for perl 5.00563: DYLD_LIBRARY_PATH=/Users/hansm/src/perl/build/perl-5.006/perl5.005_63t HOME=/Users/hansm LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/Users/hansm/bin:/usr/local/bin:/usr/games:/usr/ucb:/bin:/usr/bin:/usr/etc:/Users/hansm/bin/cookies:/LocalApps/Opener.app:. PERL5LIB=/Users/hansm/lib/perl PERL_BADLANG (unset) SHELL=/usr/bin/zsh
On Fri\, 31 Dec 1999 02:15:47 +0100\, Hans Mulder wrote:
I've built a threaded _63 on NeXTstep. The patch below fixes all but one of the issues I encountered:
1. Threaded malloc.c assumes the existence of two new macros MUTEX_LOCK_NOCONTEXT and MUTEX_UNLOCK_NOCONTEXT. They were not provided in the Mach threads section of thread.h
2. The THR macro must contain a cast to struct perl_thread *; there was not such cast in the Mach version.
3. dl_next.xs calls form(); that function is now called Perl_form_nocontext(). There's a macro in embed.h to make this work\, but XSLoader disables it by adding -DPERL_CORE to its CCFLAGS. An alternative fix would be to replace all occurrences of form() in dl_next.xs by Perl_form_nocontext().
4. A similar porblem exists in SDBM_File: it tries to call memcmp(). Unfortunately the memcmp() provided by NeXT is buggy. Furtunately\, perl comes with a drop-in replacement called Perl_my_memcmp(). Unfortunately\, the threaded version of Perl_my_memcmp() takes an extra argument\, so its no longer a valid replacement for memcmp(). The result is that SDBM_File calls Perl_my_memcmp() with the wrong number of arguments. I could fix this by writing a function Perl_my_memcmp_nocontext() with the same prototype as ANSI memcmp()\, but AFAIK Perl_my_memcmp() serves no other purpose than as a drop-in replacement for memcmp() on platforms where the latter is missing or defective\, so I think the proper fix is to remove the extra argument. I think the same goes for memset()\, bcopy() and bzero().
Thanks for the patch. Here's what I've put in.
Sarathy gsar@ActiveState.com
Migrated from rt.perl.org#1961 (status was 'resolved')
Searchable as RT1961$