aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-10-02 11:48:13 +0200
committerGitHub <[email protected]>2017-10-02 11:48:13 +0200
commit883ceaec7d5e6c84490de9d766878b1c3877e046 (patch)
treeb65db696bd93bca3bfebf52f5bd9c65bca2f6599 /erts/emulator/beam
parent8813b9ff2cc9351d174b1faaba336b2e7ad2d512 (diff)
parent9a50a5d5fc1c74d91efad74e1cb3e78f38e2b75c (diff)
downloadotp-883ceaec7d5e6c84490de9d766878b1c3877e046.tar.gz
otp-883ceaec7d5e6c84490de9d766878b1c3877e046.tar.bz2
otp-883ceaec7d5e6c84490de9d766878b1c3877e046.zip
Merge pull request #1589 from bjorng/bjorn/erts/instruction-offsets
Point out the correct line number in stack traces
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/macros.tab11
1 files changed, 10 insertions, 1 deletions
diff --git a/erts/emulator/beam/macros.tab b/erts/emulator/beam/macros.tab
index 6f9b78af6f..0d175a7ec6 100644
--- a/erts/emulator/beam/macros.tab
+++ b/erts/emulator/beam/macros.tab
@@ -28,9 +28,18 @@ REFRESH_GEN_DEST() {
dst_ptr = REG_TARGET_PTR(dst);
}
+// $Offset is relative to the start of the instruction (not to the
+// location of the failure label reference). Since combined
+// instructions may increment the instruction pointer (e.g. in
+// 'increment') for some of the instructions in the group, we actually
+// use a virtual start position common to all instructions in the
+// group. To calculate the correct virtual position, we will need to
+// add $IP_ADJUSTMENT to the offset. ($IP_ADJUSTMENT will usually be
+// zero, except in a few bit syntax instructions.)
+
SET_I_REL(Offset) {
ASSERT(VALID_INSTR(*(I + ($Offset))));
- I += $Offset;
+ I += $Offset + $IP_ADJUSTMENT;
}
SET_CP_I_ABS(Target) {