summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2007-08-28 14:36:31 +0000
committerIulian Dragos <jaguarul@gmail.com>2007-08-28 14:36:31 +0000
commit22f1be16fb364a8ae9749c0a59f0535cbe18b561 (patch)
treef690b65c7afc77ef65e118e054052c6f154a581c /src/compiler
parent44c08fe2e46779d465fd231726b7ee01d27a8c56 (diff)
downloadscala-22f1be16fb364a8ae9749c0a59f0535cbe18b561.tar.gz
scala-22f1be16fb364a8ae9749c0a59f0535cbe18b561.tar.bz2
scala-22f1be16fb364a8ae9749c0a59f0535cbe18b561.zip
Improved boxing optimization.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 59ea8b82b9..8ea3f68ebe 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -690,8 +690,6 @@ abstract class GenICode extends SubComponent {
log("BOX : " + fun.symbol.fullNameString);
val ctx1 = genLoad(expr, ctx, toTypeKind(expr.tpe))
val nativeKind = toTypeKind(expr.tpe)
- ctx1.bb.emit(BOX(nativeKind), expr.pos)
- generatedType = toTypeKind(fun.symbol.tpe.resultType)
if (settings.Xdce.value) {
// we store this boxed value to a local, even if not really needed.
// boxing optimization might use it, and dead code elimination will
@@ -699,13 +697,15 @@ abstract class GenICode extends SubComponent {
var loc1 = new Local(ctx.method.symbol.newVariable(
tree.pos,
unit.fresh.newName("boxed"))
- .setInfo(definitions.ObjectClass.tpe)
+ .setInfo(expr.tpe)
.setFlag(Flags.SYNTHETIC),
- ANY_REF_CLASS, false)
+ nativeKind, false)
loc1 = ctx.method.addLocal(loc1)
- ctx1.bb.emit(DUP(ANY_REF_CLASS))
ctx1.bb.emit(STORE_LOCAL(loc1))
+ ctx1.bb.emit(LOAD_LOCAL(loc1))
}
+ ctx1.bb.emit(BOX(nativeKind), expr.pos)
+ generatedType = toTypeKind(fun.symbol.tpe.resultType)
ctx1
case Apply(fun @ _, List(expr)) if (definitions.isUnbox(fun.symbol)) =>