aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/utils
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-09-19 07:15:03 +0200
committerBjörn Gustavsson <[email protected]>2017-10-01 07:08:19 +0200
commit4e94a3dfc5cade0f8334efa1c785f44eaa55fdac (patch)
treefeabf3cbe7d629cf73bc5a63818e29b4f8881661 /erts/emulator/utils
parente64a26414428c2f9c10cd91991bbc9dd81f0d8ae (diff)
downloadotp-4e94a3dfc5cade0f8334efa1c785f44eaa55fdac.tar.gz
otp-4e94a3dfc5cade0f8334efa1c785f44eaa55fdac.tar.bz2
otp-4e94a3dfc5cade0f8334efa1c785f44eaa55fdac.zip
Eliminate unnecessary and inconsistent casts
Consider the types in the code below: BeamInstr* I; . . . BeamInstr* next; next = (BeamInstr *) *I; Goto(next); This is illogical. If 'I' points to a BeamInstr, then 'next' should be a BeamInstr, not a pointer to a BeamInstr. The Goto() macros does not require a pointer, because it will cast its argument to a void* anyway. Therefore, this code example can be simplified to: BeamInstr* I; . . . BeamInstr next; next = *I; Goto(next); Similarly, we can remove the casts in the macros when NO_JUMP_TABLE is defined.
Diffstat (limited to 'erts/emulator/utils')
-rwxr-xr-xerts/emulator/utils/beam_makeops7
1 files changed, 3 insertions, 4 deletions
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops
index a9b2c8861c..083e7eb523 100755
--- a/erts/emulator/utils/beam_makeops
+++ b/erts/emulator/utils/beam_makeops
@@ -1438,11 +1438,10 @@ sub code_gen {
"ASSERT(VALID_INSTR(*I));\n" .
"Goto(*I);";
} else {
- $var_decls .= "BeamInstr* _nextpf = " .
- "(BeamInstr *) I[$instr_offset];\n";
+ $var_decls .= "BeamInstr next_pf = I[$instr_offset];\n";
$dispatch_next = "\nI += $instr_offset;\n" .
- "ASSERT(VALID_INSTR(_nextpf));\n" .
- "Goto(_nextpf);";
+ "ASSERT(VALID_INSTR(next_pf));\n" .
+ "Goto(next_pf);";
}
#