summaryrefslogtreecommitdiff
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/jit/arm/ops.tab8
-rw-r--r--erts/emulator/beam/jit/x86/instr_guard_bifs.cpp24
-rw-r--r--erts/emulator/beam/jit/x86/ops.tab14
3 files changed, 18 insertions, 28 deletions
diff --git a/erts/emulator/beam/jit/arm/ops.tab b/erts/emulator/beam/jit/arm/ops.tab
index cc0bfeccf0..9cfce18e58 100644
--- a/erts/emulator/beam/jit/arm/ops.tab
+++ b/erts/emulator/beam/jit/arm/ops.tab
@@ -666,18 +666,14 @@ i_perf_counter
bif0 u$bif:erlang:self/0 Dst=d => self Dst
bif0 u$bif:erlang:node/0 Dst=d => node Dst
-bif1 Fail=f Bif=u$bif:erlang:hd/1 Src=n Dst =>
- jump Fail
-bif1 Fail=f Bif=u$bif:erlang:hd/1 Src Dst =>
+bif1 Fail=f Bif=u$bif:erlang:hd/1 Src=xy Dst =>
is_nonempty_list Fail Src | get_hd Src Dst
bif1 Fail=p Bif=u$bif:erlang:hd/1 Src Dst =>
bif_hd Src Dst
bif_hd s d
-bif1 Fail=f Bif=u$bif:erlang:tl/1 Src=n Dst =>
- jump Fail
-bif1 Fail=f Bif=u$bif:erlang:tl/1 Src Dst =>
+bif1 Fail=f Bif=u$bif:erlang:tl/1 Src=xy Dst =>
is_nonempty_list Fail Src | get_tl Src Dst
bif1 Fail=p Bif=u$bif:erlang:tl/1 Src Dst =>
bif_tl Src Dst
diff --git a/erts/emulator/beam/jit/x86/instr_guard_bifs.cpp b/erts/emulator/beam/jit/x86/instr_guard_bifs.cpp
index 4dfe39cb98..26133d5ac0 100644
--- a/erts/emulator/beam/jit/x86/instr_guard_bifs.cpp
+++ b/erts/emulator/beam/jit/x86/instr_guard_bifs.cpp
@@ -60,24 +60,22 @@ void BeamGlobalAssembler::emit_handle_hd_error() {
* The code size for this specialization of hd/1 is 21 bytes,
* while the code size for the bif1 instruction is 24 bytes.
*/
-void BeamModuleAssembler::emit_bif_hd(const ArgLabel &Fail,
- const ArgSource &Src,
+void BeamModuleAssembler::emit_bif_hd(const ArgSource &Src,
const ArgRegister &Hd) {
+ Label good_cons = a.newLabel();
+
mov_arg(RET, Src);
a.test(RETb, imm(_TAG_PRIMARY_MASK - TAG_PRIMARY_LIST));
- if (Fail.get() != 0) {
- a.jne(resolve_beam_label(Fail));
- } else {
- Label next = a.newLabel();
- a.short_().je(next);
- safe_fragment_call(ga->get_handle_hd_error());
- a.bind(next);
- }
+ a.short_().je(good_cons);
+ safe_fragment_call(ga->get_handle_hd_error());
- x86::Gp boxed_ptr = emit_ptr_val(RET, RET);
- a.mov(ARG2, getCARRef(boxed_ptr));
- mov_arg(Hd, ARG2);
+ a.bind(good_cons);
+ {
+ x86::Gp boxed_ptr = emit_ptr_val(RET, RET);
+ a.mov(ARG2, getCARRef(boxed_ptr));
+ mov_arg(Hd, ARG2);
+ }
}
void BeamGlobalAssembler::emit_handle_element_error() {
diff --git a/erts/emulator/beam/jit/x86/ops.tab b/erts/emulator/beam/jit/x86/ops.tab
index 1ce0d6f9c2..5481fff2d8 100644
--- a/erts/emulator/beam/jit/x86/ops.tab
+++ b/erts/emulator/beam/jit/x86/ops.tab
@@ -660,18 +660,14 @@ i_perf_counter
bif0 u$bif:erlang:self/0 Dst=d => self Dst
bif0 u$bif:erlang:node/0 Dst=d => node Dst
-bif1 Fail=f Bif=u$bif:erlang:hd/1 Src=n Dst =>
- jump Fail
-bif1 Fail=f Bif=u$bif:erlang:hd/1 Src Dst =>
+bif1 Fail=f Bif=u$bif:erlang:hd/1 Src=xy Dst =>
is_nonempty_list Fail Src | get_hd Src Dst
-bif1 Fail Bif=u$bif:erlang:hd/1 Src Dst =>
- bif_hd Fail Src Dst
+bif1 Fail=p Bif=u$bif:erlang:hd/1 Src Dst =>
+ bif_hd Src Dst
-bif_hd j s d
+bif_hd s d
-bif1 Fail=f Bif=u$bif:erlang:tl/1 Src=n Dst =>
- jump Fail
-bif1 Fail=f Bif=u$bif:erlang:tl/1 Src Dst =>
+bif1 Fail=f Bif=u$bif:erlang:tl/1 Src=xy Dst =>
is_nonempty_list Fail Src | get_tl Src Dst
bif1 Fail Bif=u$bif:erlang:get/1 Src=s Dst=d => get(Src, Dst)