cvsuser 04/10/08 00:08:39
Modified: . MANIFEST
config/gen/config_h config_h.in
config/gen/config_pm myconfig.in
config/gen/makefiles dynclasses.in dynclasses_pl.in
dynoplibs.in m4.in root.in
config/init data.pl
config/init/hints cygwin.pl darwin.pl linux.pl mswin32.pl
dynclasses README
lib/Parrot Pmc2c.pm
src dynext.c
t/library parrotlib.t
Added: dynclasses dynmatch.pasm dyntcl.pasm
Log:
Improve the building of loadable modules. Tested on Darwin and
Linux/gcc only. Separates out shared library building from loadable
module building. Also, some changes to the dynclasses building to
suppress abstract base class initialization.
mswin32 is guaranteed not to work with this (it includes a symbol
definition table for parrot in every dynamic link.) Hopefully I didn't
make it too much worse than it already was.
Note that this patch does NOT address dynamic oplibs. They are still
egregiously unportable for now.
Revision Changes Path
1.748 +2 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.747
retrieving revision 1.748
diff -u -w -r1.747 -r1.748
--- MANIFEST 7 Oct 2004 13:36:47 -0000 1.747
+++ MANIFEST 8 Oct 2004 07:08:28 -0000 1.748
@@ -330,6 +330,8 @@
docs/vtables.pod [main]doc
dynclasses/README [devel]
dynclasses/dynfoo.pasm [devel]
+dynclasses/dynmatch.pasm [devel]
+dynclasses/dyntcl.pasm [devel]
dynclasses/ext.imc [devel]
dynclasses/foo.pmc [devel]
dynclasses/main.pasm [devel]
1.26 +2 -1 parrot/config/gen/config_h/config_h.in
Index: config_h.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/config_h/config_h.in,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -w -r1.25 -r1.26
--- config_h.in 15 Aug 2004 18:05:06 -0000 1.25
+++ config_h.in 8 Oct 2004 07:08:29 -0000 1.26
@@ -20,7 +20,8 @@
#define PARROT_ARCHNAME "${jitarchname}"
#define PARROT_JIT_CAPABLE ${jitcapable}
#define PARROT_EXEC_CAPABLE ${execcapable}
-#define PARROT_DLL_EXTENSION "${so}"
+#define PARROT_SHARE_EXT "${share_ext}"
+#define PARROT_LOAD_EXT "${load_ext}"
typedef ${iv} Parrot_Int;
typedef unsigned ${iv} Parrot_UInt;
1.2 +2 -2 parrot/config/gen/config_pm/myconfig.in
Index: myconfig.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/config_pm/myconfig.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- myconfig.in 7 Mar 2004 01:37:13 -0000 1.1
+++ myconfig.in 8 Oct 2004 07:08:30 -0000 1.2
@@ -13,8 +13,8 @@
cc_ldflags='${cc_ldflags}',
libs='${libs}'
Dynamic Linking:
- so='${so}', ld_shared='${ld_shared}',
- ld_shared_flags='${ld_shared_flags}'
+ share_ext='${share_ext}', ld_share_flags='${ld_share_flags}',
+ load_ext='${load_ext}', ld_load_flags='${ld_load_flags}'
Types:
iv=${iv}, intvalsize=${intvalsize}, intsize=${intsize}, opcode_t=${opcode_t},
opcode_t_size=${opcode_t_size},
ptrsize=${ptrsize}, ptr_alignment=${ptr_alignment} byteorder=${byteorder},
1.7 +4 -3 parrot/config/gen/makefiles/dynclasses.in
Index: dynclasses.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/dynclasses.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- dynclasses.in 8 Sep 2004 05:25:18 -0000 1.6
+++ dynclasses.in 8 Oct 2004 07:08:31 -0000 1.7
@@ -1,6 +1,7 @@
PERL = ${perl}
RM_F = ${rm_f}
-SO = ${so}
+LOAD_EXT = ${load_ext}
+DESTDIR = ${build_dir}${slash}runtime${slash}parrot${slash}dynext
# add your dynamic pmcs here
@@ -15,10 +16,10 @@
$(BUILD) generate $(PMCS)
$(BUILD) compile $(PMCS)
$(BUILD) linklibs $(PMCS)
- $(BUILD) copy --destination=../runtime/parrot/dynext $(PMCS)
+ $(BUILD) copy --destination=$(DESTDIR) $(PMCS)
clean :
- $(RM_F) *.c *.h *$(SO) *.dump lib-*
+ $(RM_F) *.c *.h *$(LOAD_EXT) *.dump lib-*
realclean: clean
$(RM_F) Makefile build.pl
1.2 +16 -17 parrot/config/gen/makefiles/dynclasses_pl.in
Index: dynclasses_pl.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/dynclasses_pl.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- dynclasses_pl.in 13 Sep 2004 05:25:52 -0000 1.1
+++ dynclasses_pl.in 8 Oct 2004 07:08:31 -0000 1.2
@@ -4,22 +4,20 @@
# Config stuff
our $CC = "${cc} -c";
our $LD = "${ld}";
-our $LD_SHARED = "${ld_shared}";
-our $LD_SHARED_FLAGS = "${ld_shared_flags}";
our $LDFLAGS = "${ldflags}";
+our $LD_LOAD_FLAGS = "${ld_load_flags}";
our $PERL = "${perl}";
-our $SO = "${so}";
+our $LOAD_EXT = "${load_ext}";
our $O = "${o}";
our $CFLAGS = "${ccflags} ${cc_debug} ${ccwarn} ${cc_hasjit} ${cg_flag} ${gc_flag}";
our $PMC2C = "$PERL ${build_dir}${slash}classes${slash}pmc2c2.pl";
# Actual commands
-sub compile_shared_cmd {
+sub compile_loadable_cmd {
my ($target, $source) = @_;
- "$LD $CFLAGS $LD_SHARED $LD_SHARED_FLAGS $LDFLAGS " .
+ "$LD $CFLAGS $LDFLAGS $LD_LOAD_FLAGS " .
"${cc_o_out}" . $target . " " .
"-I${build_dir}${slash}include -I${build_dir}${slash}classes " .
- "-L${build_dir}${slash}blib${slash}lib -lparrot " .
$source;
};
@@ -33,7 +31,7 @@
sub partial_link_cmd {
my ($target, @sources) = @_;
- "$LD $CFLAGS $LD_SHARED $LD_SHARED_FLAGS $LDFLAGS ".
+ "$LD $CFLAGS $LDFLAGS $LD_LOAD_FLAGS ".
"${cc_o_out}" . $target . " " .
join(" ", @sources);
}
@@ -64,7 +62,7 @@
my @ungrouped_pmcs = grep { ! exists $pmc_group->{$_} } @pmcs;
# Convert X.c -> X.so for all non-grouped X.c
- compile_shared($_) foreach (@ungrouped_pmcs);
+ compile_loadable($_) foreach (@ungrouped_pmcs);
# Convert X.c -> X.o for all grouped X.c
compile($_) foreach (@grouped_pmcs);
@@ -90,9 +88,10 @@
my $dest = $1;
my ($group_files, $pmc_group) = gather_groups(@pmcs);
+ my @ungrouped_pmcs = grep { ! exists $pmc_group->{$_} } @pmcs;
- foreach (@pmcs, keys %$group_files) {
- copy("$_$SO", $dest) or die "Copy $_$SO failed ($?)\n";
+ foreach (@ungrouped_pmcs, keys %$group_files) {
+ copy("$_$LOAD_EXT", $dest) or die "Copy $_$LOAD_EXT failed ($?)\n";
}
} else {
die "invalid command '$mode'\nmust be one of generate, compile, linklibs, or
copy\n";
@@ -167,22 +166,22 @@
}
}
-sub compile_shared {
+sub compile_loadable {
my ($src_stem, $dest_stem) = @_;
$dest_stem ||= $src_stem;
- if (needs_build("$dest_stem$SO", "$src_stem.c")) {
- run(compile_shared_cmd("$dest_stem$SO", "$src_stem.c"))
+ if (needs_build("$dest_stem$LOAD_EXT", "$src_stem.c")) {
+ run(compile_loadable_cmd("$dest_stem$LOAD_EXT", "$src_stem.c"))
or die "compile $src_stem.c failed ($?)\n";
} else {
- print "$dest_stem$SO is up to date\n";
+ print "$dest_stem$LOAD_EXT is up to date\n";
}
}
sub partial_link {
my ($group, @stems) = @_;
my @sources = map { "$_$O" } @stems;
- if (needs_build("$group$SO", @sources)) {
- run(partial_link_cmd("$group$SO", @sources))
- or die "partial link $group$SO failed ($?)\n";
+ if (needs_build("$group$LOAD_EXT", @sources)) {
+ run(partial_link_cmd("$group$LOAD_EXT", @sources))
+ or die "partial link $group$LOAD_EXT failed ($?)\n";
}
}
1.8 +10 -10 parrot/config/gen/makefiles/dynoplibs.in
Index: dynoplibs.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/dynoplibs.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- dynoplibs.in 25 Apr 2004 10:47:41 -0000 1.7
+++ dynoplibs.in 8 Oct 2004 07:08:31 -0000 1.8
@@ -2,23 +2,23 @@
# sample Makefile
#
LD = ${ld}
-LD_SHARED = ${ld_shared}
+LD_LOAD_FLAGS = ${ld_load_flags}
PERL = ${perl}
RM_F = ${rm_f}
-SO = ${so}
+LOAD_EXT = ${load_ext}
OPS2C = -I..${slash}lib ..${slash}build_tools${slash}ops2c.pl
CFLAGS = ${ccflags} ${cc_debug} ${ccwarn} ${cc_hasjit} ${cg_flag} ${gc_flag}
# add your dynamic oplibs here
-all: myops_ops$(SO) myops_ops_cg$(SO) myops_ops_cgp$(SO) \
- myops_ops_prederef$(SO) myops_ops_switch$(SO) \
+all: myops_ops$(LOAD_EXT) myops_ops_cg$(LOAD_EXT) myops_ops_cgp$(LOAD_EXT) \
+ myops_ops_prederef$(LOAD_EXT) myops_ops_switch$(LOAD_EXT) \
\
- dan_ops$(SO) dan_ops_cg$(SO) dan_ops_cgp$(SO) \
- dan_ops_prederef$(SO) dan_ops_switch$(SO)
+ dan_ops$(LOAD_EXT) dan_ops_cg$(LOAD_EXT) dan_ops_cgp$(LOAD_EXT) \
+ dan_ops_prederef$(LOAD_EXT) dan_ops_switch$(LOAD_EXT)
-.SUFFIXES: .ops .c $(SO)
+.SUFFIXES: .ops .c $(LOAD_EXT)
# preserve .c if needed
.PRECIOUS: %_ops.c %_ops_cgp.c %_ops_cg.c %_ops_prederef.c %_ops_switch.c
@@ -38,15 +38,15 @@
%_ops_switch.c : %.ops
$(PERL) $(OPS2C) CSwitch --dynamic $<
-%$(SO) : %.c
- $(LD) $(CFLAGS) $(LD_SHARED) $(LD_SHARED_FLAGS) $(LDFLAGS) \
+.c$(LOAD_EXT) :
+ $(LD) $(CFLAGS) $(LD_LOAD_FLAGS) $(LDFLAGS) \
${cc_o_out}$@ \
-I..${slash}include \
-L..${slash}blib${slash}lib -lparrot $<
$(PERL) -MFile::Copy=cp -e ${PQ}cp q|$@|, q|../runtime/parrot/dynext/$@|${PQ}
clean :
- $(RM_F) *.c *.h *$(SO)
+ $(RM_F) *.c *.h *$(LOAD_EXT)
realclean: clean
$(RM_F) Makefile
1.8 +4 -3 parrot/config/gen/makefiles/m4.in
Index: m4.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/m4.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- m4.in 23 Sep 2004 09:27:45 -0000 1.7
+++ m4.in 8 Oct 2004 07:08:31 -0000 1.8
@@ -1,4 +1,4 @@
-# $Id: m4.in,v 1.7 2004/09/23 09:27:45 leo Exp $
+# $Id: m4.in,v 1.8 2004/10/08 07:08:31 sfink Exp $
# Setup of some commands
LN_SF = ln -s -f
@@ -20,7 +20,8 @@
# Shared-library building
LD = ${ld}
LDFLAGS = ${ldflags}
-LD_SHARED = ${ld_shared} # e.g. -shared
+LD_SHARE_FLAGS = ${ld_share_flags} # e.g. -shared
+LD_LOAD_FLAGS = ${ld_load_flags}
# some constants
M4_EVAL_COMPILER_SO = ../../runtime/parrot/dynext/m4_eval_compiler.so
@@ -61,7 +62,7 @@
$(M4_EVAL_COMPILER_SO): src/eval.c
$(CC) $(CFLAGS) $(CC_SHARED) $(DEBUG) $(WARN) -c src/eval.c
- $(LD) $(LD_SHARED) $(LDFLAGS) -o $@ eval.o
+ $(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) -o $@ eval.o
src/m4.imc: src/builtin.imc src/freeze.imc src/input.imc src/macro.imc
1.249 +12 -47 parrot/config/gen/makefiles/root.in
Index: root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.248
retrieving revision 1.249
diff -u -w -r1.248 -r1.249
--- root.in 7 Oct 2004 09:31:13 -0000 1.248
+++ root.in 8 Oct 2004 07:08:31 -0000 1.249
@@ -1,4 +1,4 @@
-# $Id: root.in,v 1.248 2004/10/07 09:31:13 jrieks Exp $
+# $Id: root.in,v 1.249 2004/10/08 07:08:31 sfink Exp $
###############################################################################
#
@@ -59,17 +59,18 @@
RANLIB = ${ranlib}
LINK = ${link}
LD = ${ld}
-LD_SHARED = ${ld_shared}
TOUCH = $(PERL) -e ${PQ}open(A,qq{>>$$_}) or die foreach @ARGV${PQ}
YACC = ${yacc}
LEX = ${lex}
# file extensions and util flags
O = ${o}
-SO = ${so}
+SHARE_EXT = ${share_ext}
+LOAD_EXT = ${load_ext}
A = ${a}
LD_OUT = ${ld_out}
-LD_SHARED_FLAGS = ${ld_shared_flags}
+LD_SHARE_FLAGS = ${ld_share_flags}
+LD_LOAD_FLAGS = ${ld_load_flags}
INC=./${inc}
@@ -431,7 +432,7 @@
# dynamic extensions
DYNEXT_DIR = runtime/parrot/dynext
-LIBNCI_SO = $(DYNEXT_DIR)/libnci$(SO)
+LIBNCI_SO = $(DYNEXT_DIR)/libnci$(SHARE_EXT)
###############################################################################
#
@@ -612,7 +613,7 @@
#
###############################################################################
-shared : $(GEN_HEADERS) blib/lib/libparrot$(SO) $(LIBPARROT)
+shared : $(GEN_HEADERS) blib/lib/libparrot$(SHARE_EXT) $(LIBPARROT)
static : $(GEN_HEADERS) $(LIBPARROT)
# XXX changes don't always propagate into libparrot
@@ -626,49 +627,13 @@
$(AR_CR) ${ar_out}$@ ${ar_extra} $(O_FILES)
$(RANLIB) $@
-blib/lib/libparrot$(SO) : $(O_FILES)
+blib/lib/libparrot$(SHARE_EXT) : $(O_FILES)
$(MKDIR) blib blib/lib
- $(LD) $(LD_SHARED) $(LD_SHARED_FLAGS) $(LDFLAGS)
$(LD_OUT)blib/lib/libparrot$(SO) $(O_FILES) $(C_LIBS) $(LIBICUCORE) $(LIBICUDATA)
+ $(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) $(LD_OUT)blib/lib/libparrot$(SHARE_EXT)
$(O_FILES) $(C_LIBS) $(LIBICUCORE) $(LIBICUDATA)
-$(TEST_PROG_SO) : $(PARROT_MAIN)$(O) blib/lib/libparrot$(SO)
lib/Parrot/OpLib/core.pm
+$(TEST_PROG_SO) : $(PARROT_MAIN)$(O) blib/lib/libparrot$(SHARE_EXT)
lib/Parrot/OpLib/core.pm
$(LINK) $(LINKFLAGS) $(LD_OUT)$(TEST_PROG) $(PARROT_MAIN)$(O) $(LIBPARROT)
$(C_LIBS)
-# XXX The dependancies on SO.MAJOR.MINOR and SO.VERSION are removed
-# because those should be done at "make install" and not "make shared"
-# It also makes the task of getting this working on win32 much easier. :)
-#
-#blib/lib/libparrot$(SO).${VERSION} : $(O_FILES)
-# $(MKDIR) blib blib/lib
-# $(LD) $(LD_SHARED) -Wl,-soname,libparrot$(SO).${MAJOR} $(LDFLAGS)
$(LD_OUT)blib/lib/libparrot$(SO).${VERSION} $(O_FILES)
-#
-#blib/lib/libparrot$(SO).${MAJOR}.${MINOR} : blib/lib/libparrot$(SO).${VERSION}
-# $(RM_F) $@
-# cd blib/lib; ln -s libparrot$(SO).${VERSION} libparrot$(SO).${MAJOR}.${MINOR}
-#
-#blib/lib/libparrot$(SO).${MAJOR} : blib/lib/libparrot$(SO).${MAJOR}.${MINOR}
-# $(RM_F) $@
-# cd blib/lib; ln -s libparrot$(SO).${MAJOR}.${MINOR} libparrot$(SO).${MAJOR}
-#
-#blib/lib/libparrot$(SO) : blib/lib/libparrot$(SO).${MAJOR}
-# $(RM_F) $@
-# cd blib/lib; ln -s libparrot$(SO).${MAJOR} libparrot$(SO)
-#
-#blib/lib/libcore_prederef$(SO).${VERSION} : core_ops_prederef$(O)
-# $(LD) $(LD_SHARED) -Wl,-soname,libparrot$(SO).${MAJOR} $(LDFLAGS)
$(LD_OUT)blib/lib/libcore_prederef$(SO).${VERSION} core_ops_prederef$(O)
-#
-#blib/lib/libcore_prederef$(SO).${MAJOR}.${MINOR} :
blib/lib/libcore_prederef$(SO).${VERSION}
-# $(RM_F) $@
-# cd blib/lib; ln -s libcore_prederef$(SO).${VERSION}
libcore_prederef$(SO).${MAJOR}.${MINOR}
-#
-#blib/lib/libcore_prederef$(SO).${MAJOR} :
blib/lib/libcore_prederef$(SO).${MAJOR}.${MINOR}
-# $(RM_F) $@
-# cd blib/lib; ln -s libcore_prederef$(SO).${MAJOR}.${MINOR}
libcore_prederef$(SO).${MAJOR}
-#
-#blib/lib/libcore_prederef$(SO) : blib/lib/libcore_prederef$(SO).${MAJOR}
-# $(RM_F) $@
-# cd blib/lib; ln -s libcore_prederef$(SO).${MAJOR} libcore_prederef$(SO)
-
-
#
# Parrot Debugger
#
@@ -1279,14 +1244,14 @@
exec : $(SRC)/exec_start$(O) $(LIBPARROT)
$(LINK) ${ld_out}$(EXEC) $(LINKFLAGS) $(EXEC)$(O) $(SRC)/exec_start$(O)
$(ALL_PARROT_LIBS)
-exec_so : $(SRC)/exec_start$(O) blib/lib/libparrot$(SO)
+exec_so : $(SRC)/exec_start$(O) blib/lib/libparrot$(SHARE_EXT)
$(LINK) ${ld_out}$(EXEC) $(LINKFLAGS) $(EXEC)$(O) $(SRC)/exec_start$(O)
-lparrot $(C_LIBS)
###### OS depend targets ##########
# libnci.so used by t/pmc/nci.t
$(LIBNCI_SO): $(SRC)/nci_test$(O)
- $(LD) $(LD_SHARED) ${ncilib_link_extra} $(LDFLAGS) \
+ $(LD) $(LD_SHARE_FLAGS) ${ncilib_link_extra} $(LDFLAGS) \
$(LD_OUT)$@ $(SRC)/nci_test$(O)
# vim ctags
1.35 +12 -7 parrot/config/init/data.pl
Index: data.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/data.pl,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -w -r1.34 -r1.35
--- data.pl 2 Oct 2004 12:43:58 -0000 1.34
+++ data.pl 8 Oct 2004 07:08:32 -0000 1.35
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: data.pl,v 1.34 2004/10/02 12:43:58 nicholas Exp $
+# $Id: data.pl,v 1.35 2004/10/08 07:08:32 sfink Exp $
=head1 NAME
@@ -69,11 +69,18 @@
link => $Config{cc},
linkflags => $Config{ldflags},
- # ld: Tool used to build dynamically loadable libraries. Often
- # $cc on Unix-ish systems, but apparently sometimes it's ld.
+ # ld: Tool used to build shared libraries and dynamically loadable
+ # modules. Often $cc on Unix-ish systems, but apparently sometimes
+ # it's ld.
ld => $Config{ld},
ldflags => $Config{ldflags},
+ # Shared libraries
+ ld_share_flags => $Config{lddlflags},
+
+ # Dynamically loadable modules
+ ld_load_flags => $Config{lddlflags},
+
libs => $Config{libs},
cc_inc => "-I./include",
@@ -81,7 +88,8 @@
link_debug => '',
o => '.o', # object files extension
- so => '.so', # dynamic link library or shared object
extension
+ share_ext => '.so', # shared library extension
+ load_ext => '.so', # dynamically loadable module extension
a => '.a', # library or archive extension
exe => $Config{_exe}, # executable files extension
cc_o_out => '-o ', # cc object output file
@@ -91,9 +99,6 @@
ld_out => '-o ', # ld output file
ld_debug => '-g ', # include debug info in executable
- ld_shared => $Config{lddlflags},
- ld_shared_flags=> '', # What is this, exactly? For GNU ld, it was
- # '-Wl,-soname,libparrot$(SO)'
# should we have a dependancy upon arc to generate .a's?
blib_lib_libparrot_a => 'blib/lib/libparrot$(A)',
1.8 +3 -2 parrot/config/init/hints/cygwin.pl
Index: cygwin.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/cygwin.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- cygwin.pl 27 Mar 2004 01:38:05 -0000 1.7
+++ cygwin.pl 8 Oct 2004 07:08:33 -0000 1.8
@@ -11,7 +11,8 @@
# A. Dougherty 9/9/2002
Configure::Data->set(
ld => 'gcc',
- ld_shared => '-shared',
+ ld_share_flags => '-shared',
+ ld_load_flags => '-shared',
libs => $libs,
);
1.12 +3 -0 parrot/config/init/hints/darwin.pl
Index: darwin.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/darwin.pl,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- darwin.pl 9 Apr 2004 20:32:06 -0000 1.11
+++ darwin.pl 8 Oct 2004 07:08:33 -0000 1.12
@@ -20,5 +20,8 @@
ccwarn => "-Wno-shadow",
libs => $libs,
so => '.dylib',
+ dynmod => '.so',
link => 'c++',
+ ld_share_flags => '-dynamiclib',
+ ld_load_flags => '-bundle -undefined suppress',
);
1.10 +8 -7 parrot/config/init/hints/linux.pl
Index: linux.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/linux.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- linux.pl 29 Jul 2004 06:56:20 -0000 1.9
+++ linux.pl 8 Oct 2004 07:08:33 -0000 1.10
@@ -7,9 +7,9 @@
if ($libs !~ /-lpthread/) {
$libs .= ' -lpthread';
}
-my $ld_shared = Configure::Data->get('ld_shared');
-if ( $ld_shared !~ /-fPIC/ ) {
- $ld_shared .= ' -fPIC';
+my $ld_share_flags = Configure::Data->get('ld_share_flags');
+if ( $ld_share_flags !~ /-fPIC/ ) {
+ $ld_share_flags .= ' -fPIC';
}
if ( $cc =~ /icc/ ) {
@@ -24,7 +24,8 @@
Configure::Data->set(
ccflags => $cflags,
libs => $libs,
- ld_shared => $ld_shared,
+ ld_share_flags => $ld_share_flags,
+ ld_load_flags => $ld_share_flags,
i_lib_pthread => 1, # XXX fake a header entry
linkflags => $linkflags,
link => $link,
1.22 +6 -5 parrot/config/init/hints/mswin32.pl
Index: mswin32.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/mswin32.pl,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -w -r1.21 -r1.22
--- mswin32.pl 10 Jun 2004 14:56:38 -0000 1.21
+++ mswin32.pl 8 Oct 2004 07:08:33 -0000 1.22
@@ -42,8 +42,8 @@
cc_ldflags => '/link',
cc_debug => '-Zi', #ZI messes with __LINE__
ld_debug => '-debug',
- ld_shared => '-dll',
- ld_shared_flags=> '-def:libparrot.def',
+ ld_share_flags => '-dll -def:libparrot.def',
+ ld_load_flags => '-dll -def:libparrot.def',
ld_out => '-out:',
ldflags => '-nologo',
blib_lib_libparrot_a => 'blib/lib/libparrot_s$(A)',
@@ -77,8 +77,8 @@
libs => "$libs libircmt.lib",
ld => 'xilink',
ld_debug => '-debug',
- ld_shared => '-dll',
- ld_shared_flags=> '-def:libparrot.def',
+ ld_share_flags => '-dll -def:libparrot.def',
+ ld_load_flags => '-dll -def:libparrot.def',
ld_out => '-out:',
ldflags => '-nologo',
blib_lib_libparrot_a => 'blib/lib/libparrot_s$(A)',
@@ -117,7 +117,8 @@
ld_out => '-e',
cc_ldflags => '',
ld_debug => '-v',
- ld_shared => '-WD',
+ ld_share_flags => '-WD',
+ ld_load_flags => '-WD',
libs => 'import32.lib cw32.lib',
link => ${cc},
1.6 +4 -1 parrot/dynclasses/README
Index: README
===================================================================
RCS file: /cvs/public/parrot/dynclasses/README,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- README 8 Sep 2004 05:25:21 -0000 1.5
+++ README 8 Oct 2004 07:08:35 -0000 1.6
@@ -53,7 +53,6 @@
edit C<../config/gen/makefiles/dynclasses.in> and append your PMC(s) to
the build target.
- $ export LD_LIBRARY_PATH=.:blib/lib
$ make
$ make shared
$ cd dynclasses; make
@@ -71,6 +70,10 @@
=item 4
+There are two other similar test files: dynmatch.pasm and dyntcl.pasm.
+They do pretty much the same thing as dynfoo, but they load in PMC
+group libraries instead of a standalone PMC library.
+
If anything changes inside parrot, be sure to:
$ cd dynclasses; make clean
1.1 parrot/dynclasses/dynmatch.pasm
Index: dynmatch.pasm
===================================================================
null P0
loadlib P1, "match_group"
print "ok 1\n"
find_type I0, "Match"
print I0
print "\n"
new P0, I0
print "ok 2\n"
find_type I0, "PerlString"
new P1, I0
set P1, "value"
set P0["slot"], P1
set S0, P0["slot"]
print S0
print "\n"
end
1.1 parrot/dynclasses/dyntcl.pasm
Index: dyntcl.pasm
===================================================================
null P0
loadlib P1, "tclgroup"
print "ok 1\n"
find_type I0, "TclInt"
print I0
print "\n"
new P0, I0
print "ok 2\n"
set P0, 7
print P0
print "\n"
end
1.41 +16 -13 parrot/lib/Parrot/Pmc2c.pm
Index: Pmc2c.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Pmc2c.pm,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -w -r1.40 -r1.41
--- Pmc2c.pm 9 Sep 2004 18:45:43 -0000 1.40
+++ Pmc2c.pm 8 Oct 2004 07:08:36 -0000 1.41
@@ -1,5 +1,5 @@
# Copyright: 2004 The Perl Foundation. All Rights Reserved.
-# $Id: Pmc2c.pm,v 1.40 2004/09/09 18:45:43 dan Exp $
+# $Id: Pmc2c.pm,v 1.41 2004/10/08 07:08:36 sfink Exp $
=head1 NAME
@@ -105,19 +105,19 @@
$nclass;
}
-=item C<dynext_load_code($library_name, @classes)>
+=item C<dynext_load_code($library_name, %classes)>
C<$library_name> is the name of the dynamic library to be created.
-C<@classes> are the names of the PMCs for which initialization
-code is to be generated.
+C<%classes> is a map from the PMC names for which code is to be generated,
+to dump info (PMC metadata).
This function is exported.
=cut
sub dynext_load_code {
- my ($libname, @classes ) = @_;
+ my ($libname, %classes ) = @_;
my $lc_libname = lc $libname;
my $cout;
@@ -131,7 +131,7 @@
#include "parrot/dynext.h"
EOC
- foreach my $class (@classes) {
+ for my $class (keys %classes) {
my $lc_class = lc $class;
$cout .= <<"EOC";
#include "pmc_${lc_class}.h"
@@ -139,13 +139,14 @@
}
$cout .= <<"EOC";
-Parrot_PMC Parrot_lib_${lc_libname}_load(Parrot_INTERP interpreter); /* don't warn
*/
+extern Parrot_PMC Parrot_lib_${lc_libname}_load(Parrot_INTERP interpreter); /*
don't warn */
Parrot_PMC Parrot_lib_${lc_libname}_load(Parrot_INTERP interpreter)
{
Parrot_STRING whoami;
Parrot_PMC pmc;
EOC
- foreach my $class (@classes) {
+ while (my ($class, $info) = each %classes) {
+ next if $info->{flags}->{noinit};
$cout .= <<"EOC";
Parrot_Int type${class};
EOC
@@ -165,10 +166,11 @@
* for all PMCs we want to register:
*/
EOC
- foreach my $class (@classes) {
+ while (my ($class, $info) = each %classes) {
+ my $lhs = $info->{flags}->{noinit} ? "" : "type$class = ";
$cout .= <<"EOC";
whoami = string_from_cstring(interpreter, "$class", 0);
- type${class} = pmc_register(interpreter, whoami);
+ ${lhs}pmc_register(interpreter, whoami);
EOC
}
$cout .= <<"EOC";
@@ -176,7 +178,8 @@
/* do class_init code */
for (pass = 0; pass <= 1; ++pass) {
EOC
- foreach my $class (@classes) {
+ while (my ($class, $info) = each %classes) {
+ next if $info->{flags}->{noinit};
my $lc_class = lc $class;
$cout .= <<"EOC";
Parrot_${class}_class_init(interpreter, type$class, pass);
@@ -531,7 +534,7 @@
sub lib_load_code() {
my $self = shift;
my $classname = $self->{class};
- return dynext_load_code($classname, $classname);
+ return dynext_load_code($classname, $classname => {});
}
=item C<pmc_is_dynpmc>
@@ -1523,7 +1526,7 @@
my $cout = Parrot::Pmc2c->dont_edit('various files');
$cout .= Parrot::Pmc2c::dynext_load_code($self->{opt}{library},
- map { $_->{class} }
+ map { $_->{class} => $_ }
values %{$self->{pmcs}} );
return $cout;
1.33 +3 -3 parrot/src/dynext.c
Index: dynext.c
===================================================================
RCS file: /cvs/public/parrot/src/dynext.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -w -r1.32 -r1.33
--- dynext.c 7 Oct 2004 14:48:15 -0000 1.32
+++ dynext.c 8 Oct 2004 07:08:37 -0000 1.33
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: dynext.c,v 1.32 2004/10/07 14:48:15 leo Exp $
+$Id: dynext.c,v 1.33 2004/10/08 07:08:37 sfink Exp $
=head1 NAME
@@ -144,9 +144,9 @@
file_name = string_to_cstring(interpreter, lib);
if (!strchr(file_name, '.')) {
file_w_ext = malloc(strlen(file_name) +
- strlen(PARROT_DLL_EXTENSION) + 1);
+ strlen(PARROT_LOAD_EXT) + 1);
strcpy(file_w_ext, file_name);
- strcat(file_w_ext, PARROT_DLL_EXTENSION);
+ strcat(file_w_ext, PARROT_LOAD_EXT);
full_name = Parrot_locate_runtime_file(interpreter, file_w_ext,
PARROT_RUNTIME_FT_DYNEXT);
if (full_name) {
1.4 +6 -6 parrot/t/library/parrotlib.t
Index: parrotlib.t
===================================================================
RCS file: /cvs/public/parrot/t/library/parrotlib.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- parrotlib.t 1 Oct 2004 21:16:46 -0000 1.3
+++ parrotlib.t 8 Oct 2004 07:08:39 -0000 1.4
@@ -1,5 +1,5 @@
# Copyright (C) 2001-2004 The Perl Foundation. All rights reserved.
-# $Id: parrotlib.t,v 1.3 2004/10/01 21:16:46 jrieks Exp $
+# $Id: parrotlib.t,v 1.4 2004/10/08 07:08:39 sfink Exp $
=head1 NAME
@@ -11,8 +11,8 @@
=head1 DESCRIPTION
-This test program test wether the library 'parrotlib.imc' returns the expected
-absolut filenames.
+This test program test whether the library 'parrotlib.imc' returns the
+expected absolute filenames.
=cut
@@ -89,16 +89,16 @@
output_is( << "END_CODE", << "END_OUT", 'dynext_location' );
$template_top
location_sub = find_global "_parrotlib", "dynext_location"
- location = location_sub( 'libnci', '$PConfig{so}' )
+ location = location_sub( 'libnci', '$PConfig{load_ext}' )
$template_bottom
END_CODE
-runtime/parrot/dynext/libnci$PConfig{so}
+runtime/parrot/dynext/libnci$PConfig{load_ext}
END_OUT
output_is( << "END_CODE", << 'END_OUT', 'dynext_location, non-existent' );
$template_top
location_sub = find_global "_parrotlib", "imcc_compile_file_location"
- location = location_sub( 'nonexistent', '$PConfig{so}' )
+ location = location_sub( 'nonexistent', '$PConfig{load_ext}' )
$template_bottom
END_CODE