aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2019-12-28 22:27:09 -0400
committerEduardo Julian2019-12-28 22:27:09 -0400
commit84ea12c2960cc7460de81087a6e53bcc6d37a3d6 (patch)
tree2a2b93dad3b4cb44aa641a0197211afb694ff7fc /stdlib/source
parentecb53b05a226d8d3d8e612f949cb3ad6ac0600ce (diff)
Optimized pattern-matching against variants.
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux10
1 files changed, 2 insertions, 8 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux
index 99a8ed79a..5968ed6c8 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux
@@ -272,7 +272,6 @@
@perfect-match! _.new-label
@tags-match! _.new-label
@maybe-nested _.new-label
- @maybe-super-nested _.new-label
@mismatch! _.new-label
#let [::tag ($_ _.compose
(..get ..variant-tag)
@@ -315,9 +314,8 @@
$variant ::tag
_.dup2 (_.if-icmpeq @tags-match!)
_.dup2 (_.if-icmpgt @maybe-nested)
- _.dup2 (_.if-icmplt @maybe-super-nested)
- ## _.pop2
- not-found
+ $last? (_.ifnull @mismatch!) ## tag, sumT
+ super-nested ## super-variant
_.areturn
(_.set-label @tags-match!) ## tag, sumT
$last? ## tag, sumT, wants-last?
@@ -331,10 +329,6 @@
## _.pop2
$variant ::value
_.areturn
- (_.set-label @maybe-super-nested) ## tag, sumT
- $last? (_.ifnull @mismatch!) ## tag, sumT
- super-nested ## super-variant
- _.areturn
(_.set-label @mismatch!) ## tag, sumT
## _.pop2
not-found