From: Hannu Niemistö Date: Fri, 12 May 2017 10:22:50 +0000 (+0300) Subject: (refs #7218) Sort labels by integer values when generating switch X-Git-Tag: v1.28.0~7 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F516%2F1;p=simantics%2Fplatform.git (refs #7218) Sort labels by integer values when generating switch Change-Id: Ic6acb6241151f3d178e4c5bdf9c4fac5424b6100 (cherry picked from commit 5d55c8c863ea9909064ee847f25163bf02e5e8f2) --- diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Switch.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Switch.java index 27f853e02..386199d83 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Switch.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Switch.java @@ -1,6 +1,7 @@ package org.simantics.scl.compiler.internal.codegen.ssa.exits; import java.util.ArrayList; +import java.util.Arrays; import org.objectweb.asm.Label; import org.simantics.scl.compiler.common.exceptions.InternalCompilerError; @@ -26,6 +27,8 @@ import org.simantics.scl.compiler.types.TVar; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; +import gnu.trove.map.hash.TIntObjectHashMap; + public class Switch extends SSAExit implements ValRefBinder { ValRef scrutinee; @@ -60,14 +63,19 @@ public class Switch extends SSAExit implements ValRefBinder { int defaultId; for(defaultId=0;defaultId labelMap = new TIntObjectHashMap