aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/arith_instrs.tab
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-08-16 11:41:40 +0200
committerBjörn Gustavsson <[email protected]>2017-08-23 05:57:38 +0200
commitacad85c9831452e5865f2bd3fdd31455b493f091 (patch)
treeb0f7bb1479d99dee003c7bde5ec0187a77693193 /erts/emulator/beam/arith_instrs.tab
parenta9ea42890b6ce8fa35aeba5c6de3a45f97802b23 (diff)
downloadotp-acad85c9831452e5865f2bd3fdd31455b493f091.tar.gz
otp-acad85c9831452e5865f2bd3fdd31455b493f091.tar.bz2
otp-acad85c9831452e5865f2bd3fdd31455b493f091.zip
Improve performance for bsl/bsr
Eliminate the variable used for holding which BIF (bsl or bsr). It seems to improve performance slightly.
Diffstat (limited to 'erts/emulator/beam/arith_instrs.tab')
-rw-r--r--erts/emulator/beam/arith_instrs.tab25
1 files changed, 17 insertions, 8 deletions
diff --git a/erts/emulator/beam/arith_instrs.tab b/erts/emulator/beam/arith_instrs.tab
index b8fbd80dad..a5c84d41d6 100644
--- a/erts/emulator/beam/arith_instrs.tab
+++ b/erts/emulator/beam/arith_instrs.tab
@@ -229,13 +229,11 @@ shift.head() {
Sint ires;
Eterm* bigp;
Eterm tmp_big[2];
- Uint BIF;
}
shift.setup_bsr(Src1, Src2) {
Op1 = $Src1;
Op2 = $Src2;
- BIF = BIF_bsr_2;
shift_left_count = 0;
if (is_small(Op2)) {
shift_left_count = -signed_val(Op2);
@@ -252,7 +250,6 @@ shift.setup_bsr(Src1, Src2) {
shift.setup_bsl(Src1, Src2) {
Op1 = $Src1;
Op2 = $Src2;
- BIF = BIF_bsl_2;
shift_left_count = 0;
if (is_small(Op2)) {
shift_left_count = signed_val(Op2);
@@ -279,8 +276,7 @@ shift.execute(Fail, Live, Dst) {
ires = signed_val(Op1);
if (shift_left_count == 0 || ires == 0) {
if (is_not_integer(Op2)) {
- c_p->freason = BADARITH;
- $BIF_ERROR_ARITY_2($Fail, BIF, Op1, Op2);
+ goto shift_error;
}
if (ires == 0) {
$Dst = Op1;
@@ -309,8 +305,7 @@ shift.execute(Fail, Live, Dst) {
} else if (is_big(Op1)) {
if (shift_left_count == 0) {
if (is_not_integer(Op2)) {
- c_p->freason = BADARITH;
- $BIF_ERROR_ARITY_2($Fail, BIF, Op1, Op2);
+ goto shift_error;
}
$Dst = Op1;
$NEXT0();
@@ -367,8 +362,22 @@ shift.execute(Fail, Live, Dst) {
/*
* One or more non-integer arguments.
*/
+ shift_error:
c_p->freason = BADARITH;
- $BIF_ERROR_ARITY_2($Fail, BIF, Op1, Op2);
+ if ($Fail) {
+ $FAIL($Fail);
+ } else {
+ reg[0] = Op1;
+ reg[1] = Op2;
+ SWAPOUT;
+ if (I[0] == (BeamInstr) OpCode(i_bsl_ssjId)) {
+ I = handle_error(c_p, I, reg, &bif_export[BIF_bsl_2]->info.mfa);
+ } else {
+ ASSERT(I[0] == (BeamInstr) OpCode(i_bsr_ssjId));
+ I = handle_error(c_p, I, reg, &bif_export[BIF_bsr_2]->info.mfa);
+ }
+ goto post_error_handling;
+ }
}
i_int_bnot(Fail, Src, Live, Dst) {