Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add missing concrete checks to avoid SEGVs.
tgt++ for reporting.
  • Loading branch information
jnthn committed Aug 14, 2014
1 parent 0bbedab commit f4ed491
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vm/moar/ops/perl6_ops.c
Expand Up @@ -270,7 +270,7 @@ static MVMuint8 s_p6list[] = {
};
static void p6list(MVMThreadContext *tc, MVMuint8 *cur_op) {
MVMObject *list = MVM_repr_alloc_init(tc, GET_REG(tc, 4).o);
if (MVM_6model_istype_cache_only(tc, list, List)) {
if (IS_CONCRETE(list) && MVM_6model_istype_cache_only(tc, list, List)) {
MVMROOT(tc, list, {
MVMObject *items = GET_REG(tc, 2).o;
if (!MVM_is_null(tc, items)) {
Expand All @@ -282,7 +282,7 @@ static void p6list(MVMThreadContext *tc, MVMuint8 *cur_op) {
GET_REG(tc, 0).o = list;
}
else {
MVM_exception_throw_adhoc(tc, "p6list may only be used on a List");
MVM_exception_throw_adhoc(tc, "p6list may only be used on a concrete List");
}
}

Expand All @@ -308,7 +308,7 @@ static MVMuint8 s_p6listitems[] = {
};
static void p6listitems(MVMThreadContext *tc, MVMuint8 *cur_op) {
MVMObject *list = GET_REG(tc, 2).o;
if (MVM_6model_istype_cache_only(tc, list, List)) {
if (IS_CONCRETE(list) && MVM_6model_istype_cache_only(tc, list, List)) {
MVMObject *items = ((Rakudo_List *)REAL_BODY(tc, list))->items;
if (MVM_is_null(tc, items) || !IS_CONCRETE(items) || REPR(items)->ID != MVM_REPR_ID_MVMArray) {
MVMROOT(tc, list, {
Expand All @@ -319,7 +319,7 @@ static void p6listitems(MVMThreadContext *tc, MVMuint8 *cur_op) {
GET_REG(tc, 0).o = items;
}
else {
MVM_exception_throw_adhoc(tc, "p6listitems may only be used on a List");
MVM_exception_throw_adhoc(tc, "p6listitems may only be used on a concrete List");
}
}

Expand Down

0 comments on commit f4ed491

Please sign in to comment.