aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_load.c
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r--erts/emulator/beam/beam_load.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 7d3a19ff86..9b8f33f576 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -4840,7 +4840,11 @@ freeze_code(LoaderState* stp)
ASSERT(this_patch < stp->ci);
next_patch = codev[this_patch];
ASSERT(next_patch < stp->ci);
- codev[this_patch] = (BeamInstr) (codev + value);
+ if (this_patch < stp->num_functions) {
+ codev[this_patch] = (BeamInstr) (codev + value);
+ } else {
+ codev[this_patch] = (BeamInstr) (codev + value - JUMP_OFFSET);
+ }
this_patch = next_patch;
}
}
@@ -4885,7 +4889,7 @@ final_touch(LoaderState* stp, struct erl_module_instance* inst_p)
while (index != 0) {
BeamInstr next = codev[index];
codev[index] = BeamOpCode(op_catch_yf);
- catches = beam_catches_cons((BeamInstr *)codev[index+2], catches);
+ catches = beam_catches_cons((BeamInstr *)codev[index+2]+JUMP_OFFSET, catches);
codev[index+2] = make_catch(catches);
index = next;
}