Skip to content

Commit

Permalink
Optimize by registering labels to the instruction that follows the label
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Guyot <[email protected]>
  • Loading branch information
pguyot committed Aug 23, 2023
1 parent fd62240 commit 75a9f1b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/libAtomVM/opcodesswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -1569,18 +1569,15 @@ HOT_FUNC int scheduler_entry_point(GlobalContext *glb)

switch (*pc++) {
case OP_LABEL: {
#ifdef IMPL_CODE_LOADER
const uint8_t* saved_pc = pc - 1;
#endif
uint32_t label;
DECODE_LITERAL(label, pc)

TRACE("label/1 label=%i\n", label);
USED_BY_TRACE(label);

#ifdef IMPL_CODE_LOADER
TRACE("Mark label %i here at %" PRIuPTR "\n", label, saved_pc - code);
module_add_label(mod, label, saved_pc);
TRACE("Mark label %i here at %" PRIuPTR "\n", label, pc - code);
module_add_label(mod, label, pc);
#endif
break;
}
Expand Down

0 comments on commit 75a9f1b

Please sign in to comment.