Skip to content

Commit

Permalink
bump nqp rev and fix more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Nov 9, 2014
1 parent b1abc87 commit 72703bf
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 24 deletions.
46 changes: 27 additions & 19 deletions src/vm/parrot/guts/bind.c
Expand Up @@ -106,6 +106,8 @@ create_box(PARROT_INTERP, Rakudo_BindVal bv) {
case BIND_VAL_STR:
REPR(boxed)->box_funcs->set_str(interp, STABLE(boxed), OBJECT_BODY(boxed), bv.val.s);
break;
default:
break;
}
return boxed;
}
Expand Down Expand Up @@ -303,6 +305,7 @@ Rakudo_binding_assign_attributive(PARROT_INTERP, PMC *lexpad, Rakudo_Parameter *

/* Returns an appropriate failure mode (junction fail or normal fail). */
static INTVAL junc_or_fail(PARROT_INTERP, PMC *value) {
UNUSED(interp);
if (value->vtable->base_type == smo_id && STABLE(value)->WHAT == Rakudo_types_junction_get())
return BIND_RESULT_JUNCTION;
else
Expand All @@ -319,6 +322,7 @@ Rakudo_binding_bind_one_param(PARROT_INTERP, PMC *lexpad, Rakudo_Signature *sign
PMC *decont_value = NULL;
INTVAL desired_native;
Rakudo_BindVal bv;
UNUSED(signature);

/* Check if boxed/unboxed expections are met. */
desired_native = param->flags & SIG_ELEM_NATIVE_VALUE;
Expand All @@ -338,7 +342,7 @@ Rakudo_binding_bind_one_param(PARROT_INTERP, PMC *lexpad, Rakudo_Signature *sign
else if (orig_bv.val.o->vtable->base_type == smo_id) {
storage_spec spec;
decont_value = Rakudo_cont_decontainerize(interp, orig_bv.val.o);
spec = REPR(decont_value)->get_storage_spec(interp, STABLE(decont_value));
REPR(decont_value)->get_storage_spec(interp, STABLE(decont_value), &spec);
switch (desired_native) {
case SIG_ELEM_NATIVE_INT_VALUE:
if (spec.can_box & STORAGE_SPEC_CAN_BOX_INT) {
Expand Down Expand Up @@ -561,6 +565,8 @@ Rakudo_binding_bind_one_param(PARROT_INTERP, PMC *lexpad, Rakudo_Signature *sign
case BIND_VAL_STR:
VTABLE_set_string_keyed_str(interp, lexpad, param->variable_name, bv.val.s);
break;
default:
break;
}
}

Expand Down Expand Up @@ -644,6 +650,8 @@ Rakudo_binding_bind_one_param(PARROT_INTERP, PMC *lexpad, Rakudo_Signature *sign
case BIND_VAL_STR:
VTABLE_push_string(interp, cappy, bv.val.s);
break;
default:
break;
}
Parrot_pcc_invoke_from_sig_object(interp, accepts_meth, cappy);
cappy = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
Expand Down Expand Up @@ -713,6 +721,7 @@ Rakudo_binding_bind_one_param(PARROT_INTERP, PMC *lexpad, Rakudo_Signature *sign
static PMC *
Rakudo_binding_handle_optional(PARROT_INTERP, Rakudo_Parameter *param, PMC *lexpad) {
PMC *cur_lex;
UNUSED(lexpad);

/* Is the "get default from outer" flag set? */
if (param->flags & SIG_ELEM_DEFAULT_FROM_OUTER) {
Expand Down Expand Up @@ -753,33 +762,31 @@ Rakudo_binding_handle_optional(PARROT_INTERP, Rakudo_Parameter *param, PMC *lexp


/* Extracts bind value information for a positional parameter. */
static Rakudo_BindVal
get_positional_bind_val(PARROT_INTERP, struct Pcc_cell *pc_positionals, PMC *capture, INTVAL cur_pos_arg) {
Rakudo_BindVal cur_bv;
static void
get_positional_bind_val(PARROT_INTERP, struct Pcc_cell *pc_positionals, PMC *capture, INTVAL cur_pos_arg, Rakudo_BindVal *cur_bv) {
if (pc_positionals) {
switch (pc_positionals[cur_pos_arg].type) {
case BIND_VAL_INT:
cur_bv.type = BIND_VAL_INT;
cur_bv.val.i = pc_positionals[cur_pos_arg].u.i;
cur_bv->type = BIND_VAL_INT;
cur_bv->val.i = pc_positionals[cur_pos_arg].u.i;
break;
case BIND_VAL_NUM:
cur_bv.type = BIND_VAL_NUM;
cur_bv.val.n = pc_positionals[cur_pos_arg].u.n;
cur_bv->type = BIND_VAL_NUM;
cur_bv->val.n = pc_positionals[cur_pos_arg].u.n;
break;
case BIND_VAL_STR:
cur_bv.type = BIND_VAL_STR;
cur_bv.val.s = pc_positionals[cur_pos_arg].u.s;
cur_bv->type = BIND_VAL_STR;
cur_bv->val.s = pc_positionals[cur_pos_arg].u.s;
break;
default:
cur_bv.type = BIND_VAL_OBJ;
cur_bv.val.o = pc_positionals[cur_pos_arg].u.p;
cur_bv->type = BIND_VAL_OBJ;
cur_bv->val.o = pc_positionals[cur_pos_arg].u.p;
}
}
else {
cur_bv.type = BIND_VAL_OBJ;
cur_bv.val.o = VTABLE_get_pmc_keyed_int(interp, capture, cur_pos_arg);
cur_bv->type = BIND_VAL_OBJ;
cur_bv->val.o = VTABLE_get_pmc_keyed_int(interp, capture, cur_pos_arg);
}
return cur_bv;
}


Expand Down Expand Up @@ -880,7 +887,7 @@ Rakudo_binding_bind(PARROT_INTERP, PMC *lexpad, PMC *sig_pmc, PMC *capture,
VTABLE_set_attr_keyed(interp, capsnap, captype, LIST_str, pos_args);
VTABLE_set_attr_keyed(interp, capsnap, captype, HASH_str, named_args);
for (k = cur_pos_arg; k < num_pos_args; k++) {
cur_bv = get_positional_bind_val(interp, pc_positionals, capture, k);
get_positional_bind_val(interp, pc_positionals, capture, k, &cur_bv);
VTABLE_push_pmc(interp, pos_args, cur_bv.type == BIND_VAL_OBJ ?
cur_bv.val.o :
create_box(interp, cur_bv));
Expand Down Expand Up @@ -944,7 +951,7 @@ Rakudo_binding_bind(PARROT_INTERP, PMC *lexpad, PMC *sig_pmc, PMC *capture,
* store it. */
PMC *temp = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
while (cur_pos_arg < num_pos_args) {
cur_bv = get_positional_bind_val(interp, pc_positionals, capture, cur_pos_arg);
get_positional_bind_val(interp, pc_positionals, capture, cur_pos_arg, &cur_bv);
VTABLE_push_pmc(interp, temp, cur_bv.type == BIND_VAL_OBJ ?
cur_bv.val.o :
create_box(interp, cur_bv));
Expand All @@ -967,7 +974,7 @@ Rakudo_binding_bind(PARROT_INTERP, PMC *lexpad, PMC *sig_pmc, PMC *capture,
/* Do we have a value?. */
if (cur_pos_arg < num_pos_args) {
/* Easy - just bind that. */
cur_bv = get_positional_bind_val(interp, pc_positionals, capture, cur_pos_arg);
get_positional_bind_val(interp, pc_positionals, capture, cur_pos_arg, &cur_bv);
bind_fail = Rakudo_binding_bind_one_param(interp, lexpad, sig, param,
cur_bv, no_nom_type_check, error);
if (bind_fail)
Expand Down Expand Up @@ -1144,7 +1151,8 @@ INTVAL Rakudo_binding_trial_bind(PARROT_INTERP, PMC *sig_pmc, PMC *capture) {
/* We got an object; if we aren't sure we can unbox, we can't
* be sure about the dispatch. */
PMC *arg = pc_positionals[cur_pos_arg].u.p;
storage_spec spec = REPR(arg)->get_storage_spec(interp, STABLE(arg));
storage_spec spec;
REPR(arg)->get_storage_spec(interp, STABLE(arg), &spec);
switch (param->flags & SIG_ELEM_NATIVE_VALUE) {
case SIG_ELEM_NATIVE_INT_VALUE:
if (!(spec.can_box & STORAGE_SPEC_CAN_BOX_INT))
Expand Down
20 changes: 18 additions & 2 deletions src/vm/parrot/guts/container.c
Expand Up @@ -25,6 +25,7 @@ static STRING * type_name(PARROT_INTERP, PMC *obj) {
}

static PMC * rakudo_scalar_fetch(PARROT_INTERP, PMC *cont) {
UNUSED(interp);
return ((Rakudo_Scalar *)PMC_data(cont))->value;
}

Expand Down Expand Up @@ -90,37 +91,51 @@ static void rakudo_scalar_store_unchecked(PARROT_INTERP, PMC *cont, PMC *value)
}

static void rakudo_scalar_gc_mark_data(PARROT_INTERP, STable *st) {
UNUSED(interp);
UNUSED(st);
/* No data to mark. */
}

static void rakudo_scalar_gc_free_data(PARROT_INTERP, STable *st) {
UNUSED(interp);
UNUSED(st);
/* No data to free. */
}

static void rakudo_scalar_serialize(PARROT_INTERP, STable *st, SerializationWriter *writer) {
UNUSED(interp);
UNUSED(st);
UNUSED(writer);
/* No data to serialize. */
}

static void rakudo_scalar_deserialize(PARROT_INTERP, STable *st, SerializationReader *reader) {
UNUSED(interp);
UNUSED(st);
UNUSED(reader);
/* No data to deserialize. */
}

static ContainerSpec *rakudo_scalar_spec = NULL;

static void rakudo_scalar_set_container_spec(PARROT_INTERP, STable *st) {
UNUSED(interp);
st->container_data = NULL;
st->container_spec = rakudo_scalar_spec;
}

static void rakudo_scalar_configure_container_spec(PARROT_INTERP, STable *st, PMC *config) {
UNUSED(interp);
UNUSED(st);
UNUSED(config);
/* Nothing to configure here. */
}

/* Sets up the container specification for Rakudo's container handling. */
void Rakudo_cont_register(PARROT_INTERP) {
ContainerConfigurer *cc = mem_sys_allocate(sizeof(ContainerConfigurer));
ContainerConfigurer *cc = (ContainerConfigurer *)mem_sys_allocate(sizeof(ContainerConfigurer));

rakudo_scalar_spec = mem_sys_allocate(sizeof(ContainerSpec));
rakudo_scalar_spec = (ContainerSpec *)mem_sys_allocate(sizeof(ContainerSpec));
rakudo_scalar_spec->name = Parrot_str_new_constant(interp, "rakudo_scalar");
rakudo_scalar_spec->fetch = rakudo_scalar_fetch;
rakudo_scalar_spec->store = rakudo_scalar_store;
Expand Down Expand Up @@ -184,6 +199,7 @@ void Rakudo_cont_store(PARROT_INTERP, PMC *cont, PMC *value,

/* Checks if the thing we have is a rw scalar. */
INTVAL Rakudo_cont_is_rw_scalar(PARROT_INTERP, PMC *check) {
UNUSED(interp);
if (IS_CONCRETE(check) && STABLE(check)->WHAT == scalar_type) {
Rakudo_Scalar *scalar = (Rakudo_Scalar *)PMC_data(check);
if (!PMC_IS_NULL(scalar->descriptor))
Expand Down
2 changes: 1 addition & 1 deletion src/vm/parrot/guts/sixmodelobject.h
Expand Up @@ -383,7 +383,7 @@ struct SixModel_REPROps {
INTVAL (*elems) (PARROT_INTERP, STable *st, void *data);

/* Gets the storage specification for this representation. */
storage_spec (*get_storage_spec) (PARROT_INTERP, STable *st);
void (*get_storage_spec) (PARROT_INTERP, STable *st, storage_spec *spec);

/* Handles an object changing its type. The representation is responsible
* for doing any changes to the underlying data structure, and may reject
Expand Down
4 changes: 3 additions & 1 deletion src/vm/parrot/ops/perl6.ops
Expand Up @@ -32,6 +32,7 @@ static PMC *build_sig_object(PARROT_INTERP, ARGIN_NULLOK(PMC *signature), ARGIN(
{
PMC *sig_obj;
va_list args;
UNUSED(signature);

va_start(args, sig);
/* sigh, Parrot_pcc_build_sig_object_from_varargs does not have a signature arg */
Expand Down Expand Up @@ -970,7 +971,8 @@ inline op perl6_type_check_return_value(invar PMC, invar PMC) :base_core {
if (!STABLE(decont_value)->type_check(interp, decont_value, rtype)) {
/* Straight type check failed, but it's possible we're returning
* an Int that can unbox into an int or similar. */
storage_spec spec = REPR(rtype)->get_storage_spec(interp, STABLE(rtype));
storage_spec spec;
REPR(rtype)->get_storage_spec(interp, STABLE(rtype), &spec);
if (!spec.inlineable ||
!STABLE(rtype)->type_check(interp, rtype, STABLE(decont_value)->WHAT)) {
PMC * const thrower = Rakudo_get_thrower(interp, "X::TypeCheck::Return");
Expand Down
2 changes: 1 addition & 1 deletion tools/build/NQP_REVISION
@@ -1 +1 @@
2014.10-14-gd74d5c5
2014.10-16-gee2ca3a

0 comments on commit 72703bf

Please sign in to comment.