aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-08-25 14:40:50 +0200
committerBjörn Gustavsson <[email protected]>2017-08-31 15:45:32 +0200
commit50da607331bc2de990828c3c74bbf4ee7efa27f0 (patch)
treeef011bf2ba7372e4586608849b0721a7eaaa2535 /erts/emulator
parent2d21799e64f79a5bb8d81727a521093472e89fb1 (diff)
downloadotp-50da607331bc2de990828c3c74bbf4ee7efa27f0.tar.gz
otp-50da607331bc2de990828c3c74bbf4ee7efa27f0.tar.bz2
otp-50da607331bc2de990828c3c74bbf4ee7efa27f0.zip
Eliminate three arguments for the apply() helper
We don't need to pass x(0), x(1), and x(2) because they can already be found in the register array.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/beam_emu.c17
-rw-r--r--erts/emulator/beam/instrs.tab2
2 files changed, 10 insertions, 9 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 367da88cb6..8692b99c57 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -392,9 +392,8 @@ static BeamInstr* call_error_handler(Process* p, ErtsCodeMFA* mfa,
Eterm* reg, Eterm func) NOINLINE;
static BeamInstr* fixed_apply(Process* p, Eterm* reg, Uint arity,
BeamInstr *I, Uint offs) NOINLINE;
-static BeamInstr* apply(Process* p, Eterm module, Eterm function,
- Eterm args, Eterm* reg,
- BeamInstr *I, Uint offs) NOINLINE;
+static BeamInstr* apply(Process* p, Eterm* reg,
+ BeamInstr *I, Uint offs) NOINLINE;
static BeamInstr* call_fun(Process* p, int arity,
Eterm* reg, Eterm args) NOINLINE;
static BeamInstr* apply_fun(Process* p, Eterm fun,
@@ -2182,13 +2181,14 @@ apply_bif_error_adjustment(Process *p, Export *ep,
}
static BeamInstr*
-apply(
-Process* p, Eterm module, Eterm function, Eterm args, Eterm* reg,
-BeamInstr *I, Uint stack_offset)
+apply(Process* p, Eterm* reg, BeamInstr *I, Uint stack_offset)
{
int arity;
Export* ep;
Eterm tmp;
+ Eterm module = reg[0];
+ Eterm function = reg[1];
+ Eterm args = reg[2];
/*
* Check the arguments which should be of the form apply(Module,
@@ -2305,8 +2305,9 @@ fixed_apply(Process* p, Eterm* reg, Uint arity,
if (is_not_atom(module)) goto error;
/* Handle apply of apply/3... */
- if (module == am_erlang && function == am_apply && arity == 3)
- return apply(p, reg[0], reg[1], reg[2], reg, I, stack_offset);
+ if (module == am_erlang && function == am_apply && arity == 3) {
+ return apply(p, reg, I, stack_offset);
+ }
/*
* Get the index into the export table, or failing that the export
diff --git a/erts/emulator/beam/instrs.tab b/erts/emulator/beam/instrs.tab
index 58432cbbb4..19219d34bd 100644
--- a/erts/emulator/beam/instrs.tab
+++ b/erts/emulator/beam/instrs.tab
@@ -159,7 +159,7 @@ i_move_call_ext_last(Dest, StackOffset, Src) {
APPLY(I, Deallocate) {
//| -no_next
HEAVY_SWAPOUT;
- next = apply(c_p, r(0), x(1), x(2), reg, $I, $Deallocate);
+ next = apply(c_p, reg, $I, $Deallocate);
HEAVY_SWAPIN;
}