aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-10-13 10:40:30 +0200
committerGitHub <[email protected]>2017-10-13 10:40:30 +0200
commit094e0a91fc1046462c4dd5accd48b8e2eb7a4c9c (patch)
treedc305b713f0ba3f3c615b1b39c4b345db6649831 /erts
parent805c5b9b4627eacc2fb13d234c553ae476a2c3dd (diff)
parent119713b4d9ad6649aa5f1d0bf492e2f35a0ced01 (diff)
downloadotp-094e0a91fc1046462c4dd5accd48b8e2eb7a4c9c.tar.gz
otp-094e0a91fc1046462c4dd5accd48b8e2eb7a4c9c.tar.bz2
otp-094e0a91fc1046462c4dd5accd48b8e2eb7a4c9c.zip
Merge pull request #1596 from bjorng/bjorn/enhance-try-catch
(Slightly) optimize catch and try/catch OTP-14683
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/instrs.tab18
-rw-r--r--erts/emulator/beam/ops.tab3
2 files changed, 12 insertions, 9 deletions
diff --git a/erts/emulator/beam/instrs.tab b/erts/emulator/beam/instrs.tab
index 07cc4bd527..20d356a81d 100644
--- a/erts/emulator/beam/instrs.tab
+++ b/erts/emulator/beam/instrs.tab
@@ -857,8 +857,7 @@ catch(Y, Fail) {
}
catch_end(Y) {
- c_p->catches--;
- make_blank($Y);
+ $try_end($Y);
if (is_non_value(r(0))) {
c_p->fvalue = NIL;
if (x(1) == am_throw) {
@@ -888,12 +887,15 @@ catch_end(Y) {
try_end(Y) {
c_p->catches--;
make_blank($Y);
- if (is_non_value(r(0))) {
- c_p->fvalue = NIL;
- r(0) = x(1);
- x(1) = x(2);
- x(2) = x(3);
- }
+}
+
+try_case(Y) {
+ $try_end($Y);
+ ASSERT(is_non_value(r(0)));
+ c_p->fvalue = NIL;
+ r(0) = x(1);
+ x(1) = x(2);
+ x(2) = x(3);
}
try_case_end(Src) {
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 4a915c7762..7a2c39b3a8 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -188,7 +188,8 @@ catch_end y
# Try/catch.
try Y F => catch Y F
-try_case Y => try_end Y
+
+try_case y
try_end y
%cold