From 84ea12c2960cc7460de81087a6e53bcc6d37a3d6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Dec 2019 22:27:09 -0400 Subject: Optimized pattern-matching against variants. --- .../source/lux/tool/compiler/phase/generation/jvm/runtime.lux | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'stdlib') 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 -- cgit v1.2.3