aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nfunc_sched.h
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-09-18 14:03:24 +0200
committerBjörn Gustavsson <[email protected]>2017-10-01 07:08:19 +0200
commite64a26414428c2f9c10cd91991bbc9dd81f0d8ae (patch)
tree832524e71355e98aac8b871952f451735b047f1d /erts/emulator/beam/erl_nfunc_sched.h
parent13956599d609156bd2c054213d8a5ed0a1ae7087 (diff)
downloadotp-e64a26414428c2f9c10cd91991bbc9dd81f0d8ae.tar.gz
otp-e64a26414428c2f9c10cd91991bbc9dd81f0d8ae.tar.bz2
otp-e64a26414428c2f9c10cd91991bbc9dd81f0d8ae.zip
Refactor macros for accessing Beam instructions
The BeamOp() macro in erl_vm.h is clumsy to use. All users cast the return value to BeamInstr. Define new macros that are easier to use. In the future, we might want to pack an operand into the same word as the pointer to the instruction, so we will define two macros. BeamIsOpCode() is used to rewrite code like this: if (Instr == (BeamInstr) BeamOp(op_i_func_info_IaaI) { ... } to: if (BeamIsOpCode(Instr, op_i_func_info_IaaI)) { ... } BeamOpCodeAddr(op_apply_bif) is used when we need the address for an instruction. Also elimiminate the global variables em_* in beam_emu.c. They are not really needed. Use the BeamOpCodeAddr() macro instead.
Diffstat (limited to 'erts/emulator/beam/erl_nfunc_sched.h')
-rw-r--r--erts/emulator/beam/erl_nfunc_sched.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_nfunc_sched.h b/erts/emulator/beam/erl_nfunc_sched.h
index 9be0e6f7c7..b8a4e4ebc3 100644
--- a/erts/emulator/beam/erl_nfunc_sched.h
+++ b/erts/emulator/beam/erl_nfunc_sched.h
@@ -211,8 +211,8 @@ erts_proc_shadow2real(Process *c_p)
#define ERTS_NFUNC_SCHED_INTERNALS__
#define ERTS_I_BEAM_OP_TO_NIF_EXPORT(I) \
- (ASSERT(BeamOp(op_apply_bif) == (BeamInstr *) (*(I)) \
- || BeamOp(op_call_nif) == (BeamInstr *) (*(I))), \
+ (ASSERT(BeamIsOpCode(*(I), op_apply_bif) || \
+ BeamIsOpCode(*(I), op_call_nif)), \
((NifExport *) (((char *) (I)) - offsetof(NifExport, exp.beam[0]))))