aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_bp.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-10-09 11:31:48 +0200
committerBjörn Gustavsson <[email protected]>2017-10-09 11:31:48 +0200
commite38c688d3961bedcd85f842fd052836cb345a902 (patch)
tree05b1bbdbb0e17ab368e9ec016e24e46c02e4d6d4 /erts/emulator/beam/beam_bp.c
parent52449634868e38087d0c93a0145fcfd9d2de394b (diff)
parentc2e746117b24235b8f2c508ef8f90e35ad422bf2 (diff)
downloadotp-e38c688d3961bedcd85f842fd052836cb345a902.tar.gz
otp-e38c688d3961bedcd85f842fd052836cb345a902.tar.bz2
otp-e38c688d3961bedcd85f842fd052836cb345a902.zip
Merge branch 'bjorn/erts/pack-with-opcode/OTP-14325'
OTP-14327 OTP-14340 * bjorn/erts/pack-with-opcode/OTP-14325: Pack operands for combined instructions into the instruction word beam_makeops: Use named arguments for the code generation functions Optimize packing for "optional use" operands beam_makeops: Print the instruction name for fatal packing errors Introduce a syntax for marking operands as "optional use" beam_makeops: Refactor parsing of specific instructions Optimize instruction prefetch Pack operands into the instruction word Use 32-bits pointers to C code Move LD flags for hipe from Makefile.in to configure.in beam_disasm: Correct printing of y registers ops.tab: Slightly optimize badmatch on a Y register macros.tab: Fix assertion in SET_I_REL()
Diffstat (limited to 'erts/emulator/beam/beam_bp.c')
-rw-r--r--erts/emulator/beam/beam_bp.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/erts/emulator/beam/beam_bp.c b/erts/emulator/beam/beam_bp.c
index c81380c14d..871670e8c3 100644
--- a/erts/emulator/beam/beam_bp.c
+++ b/erts/emulator/beam/beam_bp.c
@@ -419,9 +419,11 @@ erts_install_breakpoints(BpFunctions* f)
for (i = 0; i < n; i++) {
ErtsCodeInfo* ci = f->matching[i].ci;
- BeamInstr *pc = erts_codeinfo_to_code(ci);
GenericBp* g = ci->u.gen_bp;
- if (*pc != br && g) {
+ BeamInstr volatile *pc = erts_codeinfo_to_code(ci);
+ BeamInstr instr = *pc;
+
+ if (!BeamIsOpCode(instr, op_i_generic_breakpoint) && g) {
Module* modp = f->matching[i].mod;
/*
@@ -435,11 +437,16 @@ erts_install_breakpoints(BpFunctions* f)
/*
* The following write is not protected by any lock. We
* assume that the hardware guarantees that a write of an
- * aligned word-size (or half-word) writes is atomic
- * (i.e. that other processes executing this code will not
- * see a half pointer).
+ * aligned word-size writes is atomic (i.e. that other
+ * processes executing this code will not see a half
+ * pointer).
+ *
+ * The contents of *pc is marked 'volatile' to ensure that
+ * the compiler will do a single full-word write, and not
+ * try any fancy optimizations to write a half word.
*/
- *pc = br;
+ instr = BeamSetCodeAddr(instr, br);
+ *pc = instr;
modp->curr.num_breakpoints++;
}
}