Skip to content

Commit

Permalink
don't even generate log entries for huge frames
Browse files Browse the repository at this point in the history
not giving a frame a correlation ID prevents any logging
from taking place, the logs are not filled with useless
data, fewer runs for the spesh worker to do.
  • Loading branch information
timo committed Oct 3, 2017
1 parent d5db848 commit d0646fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/core/frame.c
Expand Up @@ -525,7 +525,7 @@ void MVM_frame_invoke(MVMThreadContext *tc, MVMStaticFrame *static_frame,
chosen_bytecode = static_frame->body.bytecode;

/* If we should be spesh logging, set the correlation ID. */
if (tc->instance->spesh_enabled && tc->spesh_log) {
if (tc->instance->spesh_enabled && tc->spesh_log && static_frame->body.bytecode_size < MVM_SPESH_MAX_BYTECODE_SIZE) {
if (spesh->body.spesh_entries_recorded++ < MVM_SPESH_LOG_LOGGED_ENOUGH) {
MVMint32 id = ++tc->spesh_cid;
frame->spesh_correlation_id = id;
Expand Down
20 changes: 8 additions & 12 deletions src/spesh/stats.c
Expand Up @@ -313,21 +313,17 @@ void incorporate_stats(MVMThreadContext *tc, MVMSpeshSimStackFrame *simf,
switch (e->kind) {
case MVM_SPESH_LOG_TYPE:
case MVM_SPESH_LOG_RETURN: {
if (e->type.bytecode_offset < MVM_SPESH_MAX_BYTECODE_SIZE) {
MVMSpeshStatsByOffset *oss = by_offset(tc, tss,
e->type.bytecode_offset);
add_type_at_offset(tc, oss, simf->sf, e->type.type,
e->type.flags & MVM_SPESH_LOG_TYPE_FLAG_CONCRETE);
}
MVMSpeshStatsByOffset *oss = by_offset(tc, tss,
e->type.bytecode_offset);
add_type_at_offset(tc, oss, simf->sf, e->type.type,
e->type.flags & MVM_SPESH_LOG_TYPE_FLAG_CONCRETE);
break;
}
case MVM_SPESH_LOG_INVOKE: {
if (e->invoke.bytecode_offset < MVM_SPESH_MAX_BYTECODE_SIZE) {
MVMSpeshStatsByOffset *oss = by_offset(tc, tss,
e->invoke.bytecode_offset);
add_invoke_at_offset(tc, oss, simf->sf, e->invoke.sf,
e->invoke.caller_is_outer, e->invoke.was_multi);
}
MVMSpeshStatsByOffset *oss = by_offset(tc, tss,
e->invoke.bytecode_offset);
add_invoke_at_offset(tc, oss, simf->sf, e->invoke.sf,
e->invoke.caller_is_outer, e->invoke.was_multi);
break;
}
}
Expand Down

0 comments on commit d0646fa

Please sign in to comment.