Skip to content

Commit

Permalink
Re-arrange things to try and fix/simplify build. Also should get some…
Browse files Browse the repository at this point in the history
… very, very minor performance win.
  • Loading branch information
jnthn committed Oct 18, 2009
1 parent dc9e98e commit ca65997
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 40 deletions.
26 changes: 9 additions & 17 deletions build/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ LD_LOAD_FLAGS = @ld_load_flags@
LIBPARROT = @inst_libparrot_ldflags@
O = @o@
LOAD_EXT = @load_ext@
AR = @ar@
PERL = @perl@
CP = @cp@
MV = @mv@
Expand Down Expand Up @@ -209,11 +208,6 @@ CLEANUPS = \
$(OPS_DIR)/*$(O) \
$(OPS_DIR)/*$(LOAD_EXT) \
binder/*$(O) \
binder/*$(LOAD_EXT) \
binder/*.lib \
binder/*.ilk \
binder/*.pdb \
binder/*.exp \

# NOTE: eventually, we should remove --keep-exit-code and --fudge
# as the goal is that all tests must pass without fudge
Expand All @@ -231,7 +225,6 @@ install: all
$(CP) lib/*.pm $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(MKPATH) $(DESTDIR)$(PARROT_LIB_DIR)/dynext
$(CP) $(DYNPMC) $(DYNOPS) $(DESTDIR)$(PARROT_LIB_DIR)/dynext
$(CP) src/binder/bind$(LOAD_EXT) $(DESTDIR)$(PARROT_LIB_DIR)/dynext
$(MKPATH) $(DESTDIR)$(PARROT_BIN_DIR)
$(CP) $(PERL6EXE) $(DESTDIR)$(PARROT_BIN_DIR)
$(CHMOD) 755 $(DESTDIR)$(PARROT_BIN_DIR)/$(PERL6EXE)
Expand Down Expand Up @@ -420,33 +413,32 @@ release: manifest
tar -zcv -T - -f rakudo-$(VERSION).tar.gz
rm rakudo-$(VERSION)

$(DYNEXT_TARGET): $(DYNPMC) $(DYNOPS) src/binder/bind$(LOAD_EXT)
$(CP) $(DYNPMC) $(DYNOPS) src/binder/bind$(LOAD_EXT) $(DYNEXT_DIR)
$(DYNEXT_TARGET): $(DYNPMC) $(DYNOPS)
$(CP) $(DYNPMC) $(DYNOPS) $(DYNEXT_DIR)

# (at)cc_o_out(at) and (at)ld_out(at) below cannot be assigned to
# makefile macros, because some make utilities drop the trailing
# spaces and some compilers/linkers forbid a (forced) space.
# See RT #66558 and TT #700.

src/binder/bind$(LOAD_EXT): src/binder/bind.c src/binder/bind.h
src/binder/bind$(O): src/binder/bind.c src/binder/bind.h
cd src/binder && $(CC) -c @cc_o_out@bind$(O) -I$(PMC_DIR) $(CINCLUDES) $(CFLAGS) bind.c
cd src/binder && $(LD) @ld_out@bind$(LOAD_EXT) bind$(O) $(LINKARGS)

$(DYNPMC): $(PMC_SOURCES) src/binder/bind$(LOAD_EXT)
$(DYNPMC): $(PMC_SOURCES) src/binder/bind$(O)
$(PMC2C) --no-lines --dump $(PMC2C_INCLUDES) src/pmc/objectref.pmc
$(PMC2C) --no-lines --dump $(PMC2C_INCLUDES) $(PMC_SOURCES)
$(PMC2C) --no-lines --c $(PMC2C_INCLUDES) $(PMC_SOURCES)
$(PMC2C) --no-lines --library $(GROUP) --c $(PMC_SOURCES)
$(CC) -c @cc_o_out@$(GROUP)$(O) -I$(PMC_DIR) $(CINCLUDES) $(CFLAGS) $(GROUP).c
cd $(PMC_DIR) && $(CC) -c $(CINCLUDES) $(CFLAGS) *.c
$(LD) @ld_out@$(DYNPMC) $(GROUP)$(O) src/pmc/*$(O) src/binder/bind.$(AR) $(LINKARGS)
$(LD) @ld_out@$(DYNPMC) $(GROUP)$(O) src/pmc/*$(O) src/binder/bind$(O) $(LINKARGS)

$(OPS_DIR)/$(OPS)$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE) src/binder/bind$(LOAD_EXT)
$(OPS_DIR)/$(OPS)$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE) src/binder/bind.h
cd $(OPS_DIR) && $(OPS2C) C --dynamic $(OPS_SOURCE)
cd $(OPS_DIR) && $(CC) -c @cc_o_out@$(OPS)$(O) $(CINCLUDES) $(CFLAGS) $(OPS).c
cd $(OPS_DIR) && $(LD) @ld_out@$(OPS)$(LOAD_EXT) $(OPS)$(O) ../binder/bind.$(AR) $(LINKARGS)
cd $(OPS_DIR) && $(LD) @ld_out@$(OPS)$(LOAD_EXT) $(OPS)$(O) $(LINKARGS)

$(OPS_DIR)/$(OPS)_switch$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE) src/binder/bind$(LOAD_EXT)
$(OPS_DIR)/$(OPS)_switch$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE) src/binder/bind.h
cd $(OPS_DIR) && $(OPS2C) CSwitch --dynamic $(OPS_SOURCE)
cd $(OPS_DIR) && $(CC) -c @cc_o_out@$(OPS)_switch$(O) $(CINCLUDES) $(CFLAGS) $(OPS)_switch.c
cd $(OPS_DIR) && $(LD) @ld_out@$(OPS)_switch$(LOAD_EXT) $(OPS)_switch$(O) ../binder/bind.$(AR) $(LINKARGS)
cd $(OPS_DIR) && $(LD) @ld_out@$(OPS)_switch$(LOAD_EXT) $(OPS)_switch$(O) $(LINKARGS)
3 changes: 3 additions & 0 deletions perl6.pir
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ This is the base file for the Rakudo Perl 6 compiler.
exit 1
startup_ok:

# Do dynop initialization tasks.
rakudo_dynop_setup

.local pmc p6meta
load_bytecode 'PCT.pbc'
$P0 = get_root_global ['parrot'], 'P6metaclass'
Expand Down
1 change: 0 additions & 1 deletion src/binder/bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ Rakudo_binding_handle_optional(PARROT_INTERP, llsig_element *sig_info, PMC *lexp
* is a failure and BIND_RESULT_JUNCTION if the failure was because of a
* Junction being passed (meaning we need to auto-thread). */
INTVAL
PARROT_DYNEXT_EXPORT
Rakudo_binding_bind_signature(PARROT_INTERP, PMC *lexpad,
llsig_element **elements, INTVAL num_elements,
PMC *pos_args, PMC *named_args,
Expand Down
2 changes: 0 additions & 2 deletions src/binder/bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ typedef struct llsig_element {


/* A function we want to share to provide the interface to the binder. */
PARROT_EXPORT
INTVAL
PARROT_DYNEXT_EXPORT
Rakudo_binding_bind_signature(PARROT_INTERP, PMC *lexpad,
llsig_element **elements, INTVAL num_elements,
PMC *pos_args, PMC *named_args,
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Routine.pir
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ wrappable executable objects.
.sub '!wrap_clholder_helper' :anon
.param pmc pos_args :slurpy
.param pmc named_args :slurpy :named

say "!wrap_clholder_helper"
# Slot for candidate list.
.lex '__CANDIDATE_LIST__', $P0

Expand Down
50 changes: 31 additions & 19 deletions src/ops/perl6.ops
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,38 @@ static INTVAL p6s_id = 0;
static INTVAL or_id = 0;
static INTVAL lls_id = 0;

/* Plus a function pointer to the binder. */
static INTVAL (*bind_signature_func) (PARROT_INTERP, PMC *lexpad,
llsig_element **elements, INTVAL num_elements,
PMC *pos_args, PMC *named_args,
INTVAL no_nom_type_check, STRING **error) = NULL;

END_OPS_PREAMBLE


/*

=item rakudo_dynop_setup()

Does various setup tasks on behalf of all of the other dynops.

=cut

*/
inline op rakudo_dynop_setup() :base_core {
/* Look up some type IDs. */
p6s_id = pmc_type(interp, string_from_literal(interp, "Perl6Scalar"));
or_id = pmc_type(interp, string_from_literal(interp, "ObjectRef"));
lls_id = pmc_type(interp, string_from_literal(interp, "P6LowLevelSig"));

/* Create dummy low level sig op and use it's get_pointer to get a pointer
* to the signature binder. */
bind_signature_func = VTABLE_get_pointer(interp, pmc_new(interp, lls_id));

goto NEXT();
}


/*

=item rebless_subclass(in PMC, in PMC)
Expand Down Expand Up @@ -345,10 +375,6 @@ a Perl6Scalar).
*/
inline op deobjectref(out PMC, in PMC) :base_core {
PMC * ref;
if (!p6s_id) {
p6s_id = pmc_type(interp, string_from_literal(interp, "Perl6Scalar"));
or_id = pmc_type(interp, string_from_literal(interp, "ObjectRef"));
}
ref = $2;
while (ref->vtable->base_type == or_id)
ref = VTABLE_get_pmc(interp, ref);
Expand All @@ -369,10 +395,6 @@ underlying value.
*/
inline op descalarref(out PMC, in PMC) :base_core {
PMC * ref;
if (!p6s_id) {
p6s_id = pmc_type(interp, string_from_literal(interp, "Perl6Scalar"));
or_id = pmc_type(interp, string_from_literal(interp, "ObjectRef"));
}
ref = $2;
while (ref->vtable->base_type == or_id || ref->vtable->base_type == p6s_id)
ref = VTABLE_get_pmc(interp, ref);
Expand All @@ -395,8 +417,6 @@ inline op allocate_signature(out PMC, in INT) :base_core {
INTVAL i;

/* Create new low level signature PMC. */
if (!lls_id)
lls_id = pmc_type(interp, string_from_literal(interp, "P6LowLevelSig"));
$1 = pmc_new(interp, lls_id);

/* Allocate required amount of structs. */
Expand Down Expand Up @@ -424,8 +444,6 @@ Sets $1 to be the number of elements the P6LowLevelSig $2 has.

*/
inline op get_signature_size(out INT, in PMC) :base_core {
if (!lls_id)
lls_id = pmc_type(interp, string_from_literal(interp, "P6LowLevelSig"));
if ($2->vtable->base_type == lls_id) {
INTVAL num_elements;
GETATTR_P6LowLevelSig_num_elements(interp, $2, num_elements);
Expand Down Expand Up @@ -460,8 +478,6 @@ index $2 as follows:

*/
inline op set_signature_elem(in PMC, in INT, in STR, in INT, inout PMC, inout PMC, inout PMC, inout PMC, inout PMC, inout PMC) :base_core {
if (!lls_id)
lls_id = pmc_type(interp, string_from_literal(interp, "P6LowLevelSig"));
if ($1->vtable->base_type == lls_id) {
struct llsig_element **elements;
INTVAL num_elements;
Expand Down Expand Up @@ -536,8 +552,6 @@ signature element with index $2 as follows:

*/
inline op get_signature_elem(in PMC, in INT, out STR, out INT, out PMC, out PMC, out PMC, out PMC, out PMC, out PMC) :base_core {
if (!lls_id)
lls_id = pmc_type(interp, string_from_literal(interp, "P6LowLevelSig"));
if ($1->vtable->base_type == lls_id) {
struct llsig_element **elements;
INTVAL num_elements;
Expand Down Expand Up @@ -597,8 +611,6 @@ inline op bind_signature(in PMC, in PMC) :base_core {
INTVAL num_elements, bind_error;

/* Ensure Signature is fine. */
if (!lls_id)
lls_id = pmc_type(interp, string_from_literal(interp, "P6LowLevelSig"));
if (signature->vtable->base_type != lls_id) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_INVALID_OPERATION, "bind_signature could not find signature for sub");
Expand All @@ -608,7 +620,7 @@ inline op bind_signature(in PMC, in PMC) :base_core {
/* Extract bits from the signature and invoke the binder. */
GETATTR_P6LowLevelSig_elements(interp, signature, elements);
GETATTR_P6LowLevelSig_num_elements(interp, signature, num_elements);
bind_error = Rakudo_binding_bind_signature(interp, lexpad, elements, num_elements, $1, $2, noms_checked, &error);
bind_error = bind_signature_func(interp, lexpad, elements, num_elements, $1, $2, noms_checked, &error);
if (!bind_error) {
goto NEXT();
}
Expand Down
13 changes: 13 additions & 0 deletions src/pmc/p6lowlevelsig.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ Marks anything we're referencing.
Parrot_gc_mark_PMC_alive(interp, elements[i]->sub_signature);
}
}

/*

=item C<void *get_pointer()>

Returns a pointer to the signautre binder.
=cut

*/

VTABLE void *get_pointer() {
return &Rakudo_binding_bind_signature;
}
}

/*
Expand Down

0 comments on commit ca65997

Please sign in to comment.