diff options
author | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-10-28 20:08:09 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-12-02 21:38:36 +0100 |
commit | d99b7f4e1c848bb749206f36b4bbaa17f24fa2e4 (patch) | |
tree | 87022492935750f784d87ae1d3879b63ba94be2d /src | |
parent | f16f4ab157293ac6860d4b00578b983c90b8fc62 (diff) | |
download | scala-d99b7f4e1c848bb749206f36b4bbaa17f24fa2e4.tar.gz scala-d99b7f4e1c848bb749206f36b4bbaa17f24fa2e4.tar.bz2 scala-d99b7f4e1c848bb749206f36b4bbaa17f24fa2e4.zip |
SI-6547: elide box unbox pair only when primitives match
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala index bb14c3dce0..23f932b5b4 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala @@ -147,18 +147,18 @@ abstract class ClosureElimination extends SubComponent { case _ => } - case UNBOX(_) => + case UNBOX(boxType) => info.stack match { case Deref(LocalVar(loc1)) :: _ if info.bindings isDefinedAt LocalVar(loc1) => val value = info.getBinding(loc1) value match { - case Boxed(LocalVar(loc2)) => + case Boxed(LocalVar(loc2)) if loc2.kind == boxType => bb.replaceInstruction(i, DROP(icodes.ObjectReference) :: valueToInstruction(info.getBinding(loc2)) :: Nil) debuglog("replaced " + i + " with " + info.getBinding(loc2)) case _ => () } - case Boxed(LocalVar(loc1)) :: _ => + case Boxed(LocalVar(loc1)) :: _ if loc1.kind == boxType => val loc2 = info.getAlias(loc1) bb.replaceInstruction(i, DROP(icodes.ObjectReference) :: valueToInstruction(Deref(LocalVar(loc2))) :: Nil) debuglog("replaced " + i + " with " + LocalVar(loc2)) |