Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MoarVM/MoarVM into macos-toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
vrurg committed Mar 11, 2019
2 parents 8c63ea5 + 81284a0 commit e5f8a2a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/6model/reprs/ConcBlockingQueue.c
Expand Up @@ -56,6 +56,12 @@ static void gc_mark(MVMThreadContext *tc, MVMSTable *st, void *data, MVMGCWorkli
}
}

static MVMuint64 unmanaged_size(MVMThreadContext *tc, MVMSTable *st, void *data) {
MVMConcBlockingQueueBody *cbq = *(MVMConcBlockingQueueBody **)data;
MVMuint64 total = MVM_load(&cbq->elems) * sizeof(MVMConcBlockingQueueNode);
return total;
}

/* Called by the VM in order to free memory associated with this object. */
static void gc_free(MVMThreadContext *tc, MVMObject *obj) {
MVMConcBlockingQueue *cbq = (MVMConcBlockingQueue *)obj;
Expand Down Expand Up @@ -309,8 +315,8 @@ static const MVMREPROps ConcBlockingQueue_this_repr = {
NULL, /* spesh */
"ConcBlockingQueue", /* name */
MVM_REPR_ID_ConcBlockingQueue,
NULL, /* unmanaged_size */
NULL, /* describe_refs */
unmanaged_size,
NULL /* describe_refs */
};

MVMObject * MVM_concblockingqueue_jit_poll(MVMThreadContext *tc, MVMObject *queue) {
Expand Down
42 changes: 41 additions & 1 deletion src/6model/reprs/MVMSpeshLog.c
Expand Up @@ -59,6 +59,46 @@ static void gc_mark(MVMThreadContext *tc, MVMSTable *st, void *data, MVMGCWorkli
}
}

static void describe_refs (MVMThreadContext *tc, MVMHeapSnapshotState *ss, MVMSTable *st, void *data) {
MVMSpeshLogBody *body = (MVMSpeshLogBody *)data;
MVMuint64 i = 0;

if (!body->entries)
return;
for (i = 0; i < body->used; i++) {
switch (body->entries[i].kind) {
case MVM_SPESH_LOG_ENTRY:
MVM_profile_heap_add_collectable_rel_const_cstr(tc, ss,
(MVMCollectable *)body->entries[i].entry.sf, "Spesh log entry");
break;
case MVM_SPESH_LOG_PARAMETER:
MVM_profile_heap_add_collectable_rel_const_cstr(tc, ss,
(MVMCollectable *)body->entries[i].param.type, "Parameter entry");
break;
case MVM_SPESH_LOG_PARAMETER_DECONT:
MVM_profile_heap_add_collectable_rel_const_cstr(tc, ss,
(MVMCollectable *)body->entries[i].param.type, "Deconted parameter entry");
break;
case MVM_SPESH_LOG_TYPE:
MVM_profile_heap_add_collectable_rel_const_cstr(tc, ss,
(MVMCollectable *)body->entries[i].type.type, "Type entry");
break;
case MVM_SPESH_LOG_RETURN:
MVM_profile_heap_add_collectable_rel_const_cstr(tc, ss,
(MVMCollectable *)body->entries[i].type.type, "Return entry");
break;
case MVM_SPESH_LOG_STATIC:
MVM_profile_heap_add_collectable_rel_const_cstr(tc, ss,
(MVMCollectable *)body->entries[i].value.value, "Static value entry");
break;
case MVM_SPESH_LOG_INVOKE:
MVM_profile_heap_add_collectable_rel_const_cstr(tc, ss,
(MVMCollectable *)body->entries[i].invoke.sf, "Invoked staticframe entry");
break;
}
}
}

/* Called by the VM in order to free memory associated with this object. */
static void gc_free(MVMThreadContext *tc, MVMObject *obj) {
MVMSpeshLog *log = (MVMSpeshLog *)obj;
Expand Down Expand Up @@ -135,5 +175,5 @@ static const MVMREPROps SpeshLog_this_repr = {
"MVMSpeshLog", /* name */
MVM_REPR_ID_MVMSpeshLog,
unmanaged_size,
NULL, /* describe_refs */
describe_refs
};
2 changes: 1 addition & 1 deletion src/jit/graph.c
Expand Up @@ -2472,7 +2472,7 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
MVMSpeshFacts *facts = MVM_spesh_get_facts(tc, jg->sg, ins->operands[3]);
if (facts->flags & MVM_SPESH_FACT_KNOWN_VALUE) {
if ((facts->value.i & 3) != MVM_SWITCHENDIAN) {
unsigned char const size = 1 << (facts->value.i >> ((facts->value.i & 1) ? 2 : 1));
unsigned char const size = 1 << (facts->value.i >> 2);

MVMSpeshFacts *type_facts = MVM_spesh_get_facts(tc, jg->sg, ins->operands[0]);
if (type_facts && type_facts->flags & MVM_SPESH_FACT_KNOWN_TYPE && type_facts->type &&
Expand Down

0 comments on commit e5f8a2a

Please sign in to comment.