diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-01-17 15:18:06 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-01-17 15:18:06 +0000 |
commit | 16e7ad360d1a902d6bd5c845642dbe14bcecdb9d (patch) | |
tree | a189e624a75dbb47a689a821208b41b0141e2ee0 | |
parent | be2778d50f1a73a941c6ffe6355f0ed401d6d8eb (diff) | |
download | scala-16e7ad360d1a902d6bd5c845642dbe14bcecdb9d.tar.gz scala-16e7ad360d1a902d6bd5c845642dbe14bcecdb9d.tar.bz2 scala-16e7ad360d1a902d6bd5c845642dbe14bcecdb9d.zip |
Adapted specialization tests to track number of...
Adapted specialization tests to track number of boxings.
Review by dragos
-rw-r--r-- | build.xml | 1 | ||||
-rw-r--r-- | test/files/run/spec-matrix.check | 1 | ||||
-rw-r--r-- | test/files/run/spec-overrides.check | 0 | ||||
-rw-r--r-- | test/files/specialized/spec-absfun.check | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-absfun.scala (renamed from test/files/run/spec-absfun.scala) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-ame.check (renamed from test/files/run/spec-ame.check) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-ame.scala (renamed from test/files/run/spec-ame.scala) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-constr.check (renamed from test/files/run/spec-constr.check) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-constr.scala (renamed from test/files/run/spec-constr.scala) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-early.check (renamed from test/files/run/spec-early.check) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-early.scala (renamed from test/files/run/spec-early.scala) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-init.check (renamed from test/files/run/spec-init.check) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-init.scala (renamed from test/files/run/spec-init.scala) | 2 | ||||
-rw-r--r-- | test/files/specialized/spec-matrix.check | 2 | ||||
-rw-r--r-- | test/files/specialized/spec-matrix.scala (renamed from test/files/run/spec-matrix.scala) | 2 | ||||
-rw-r--r-- | test/files/specialized/spec-overrides.check | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-overrides.scala (renamed from test/files/run/spec-overrides.scala) | 2 | ||||
-rw-r--r-- | test/files/specialized/spec-patmatch.check (renamed from test/files/run/spec-patmatch.check) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-patmatch.scala (renamed from test/files/run/spec-patmatch.scala) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-super.check (renamed from test/files/run/spec-super.check) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-super.scala (renamed from test/files/run/spec-super.scala) | 2 | ||||
-rw-r--r-- | test/files/specialized/spec-t3896.check (renamed from test/files/run/spec-t3896.check) | 1 | ||||
-rw-r--r-- | test/files/specialized/spec-t3896.scala (renamed from test/files/run/spec-t3896.scala) | 14 | ||||
-rw-r--r-- | test/files/speclib/instrumented.jar.desired.sha1 | 2 | ||||
-rw-r--r-- | test/instrumented/library/scala/runtime/BoxesRunTime.java | 14 |
25 files changed, 48 insertions, 8 deletions
@@ -1568,6 +1568,7 @@ BOOTRAPING TEST AND TEST SUITE <scalachecktests dir="${partest.dir}/${partest.srcdir}/scalacheck"> <include name="*.scala"/> </scalachecktests> + <specializedtests dir="${partest.dir}/${partest.srcdir}/specialized"/> <!-- <scripttests dir="${partest.dir}/${partest.srcdir}/script" includes="*.scala"/> --> </partest> </target> diff --git a/test/files/run/spec-matrix.check b/test/files/run/spec-matrix.check deleted file mode 100644 index 72e8ffc0db..0000000000 --- a/test/files/run/spec-matrix.check +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/test/files/run/spec-overrides.check b/test/files/run/spec-overrides.check deleted file mode 100644 index e69de29bb2..0000000000 --- a/test/files/run/spec-overrides.check +++ /dev/null diff --git a/test/files/specialized/spec-absfun.check b/test/files/specialized/spec-absfun.check new file mode 100644 index 0000000000..ffa577696d --- /dev/null +++ b/test/files/specialized/spec-absfun.check @@ -0,0 +1 @@ +4006000
\ No newline at end of file diff --git a/test/files/run/spec-absfun.scala b/test/files/specialized/spec-absfun.scala index 2b780548f5..57b54235c9 100644 --- a/test/files/run/spec-absfun.scala +++ b/test/files/specialized/spec-absfun.scala @@ -13,6 +13,7 @@ object Test { def main(args: Array[String]) { notSpecialized() specialized() + println(runtime.BoxesRunTime.integerBoxCount) } def notSpecialized() { diff --git a/test/files/run/spec-ame.check b/test/files/specialized/spec-ame.check index afa12db4df..9c1713cc8a 100644 --- a/test/files/run/spec-ame.check +++ b/test/files/specialized/spec-ame.check @@ -1,2 +1,3 @@ abc 10 +3
\ No newline at end of file diff --git a/test/files/run/spec-ame.scala b/test/files/specialized/spec-ame.scala index 86c47077f0..45e88266eb 100644 --- a/test/files/run/spec-ame.scala +++ b/test/files/specialized/spec-ame.scala @@ -13,5 +13,6 @@ object Test { def main(args: Array[String]) { println((new A("abc")).foo.value) println((new A(10)).foo.value) + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/run/spec-constr.check b/test/files/specialized/spec-constr.check index 29d70d9de8..2e3a7fdceb 100644 --- a/test/files/run/spec-constr.check +++ b/test/files/specialized/spec-constr.check @@ -1,2 +1,3 @@ hello? goodbye +0
\ No newline at end of file diff --git a/test/files/run/spec-constr.scala b/test/files/specialized/spec-constr.scala index 4c80d0954d..38ee597299 100644 --- a/test/files/run/spec-constr.scala +++ b/test/files/specialized/spec-constr.scala @@ -9,6 +9,7 @@ object Test { def main(args: Array[String]) { new E[Int] println("goodbye") + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/run/spec-early.check b/test/files/specialized/spec-early.check index 414aacc419..9c578a1af1 100644 --- a/test/files/run/spec-early.check +++ b/test/files/specialized/spec-early.check @@ -2,3 +2,4 @@ a abc 42 abc +2
\ No newline at end of file diff --git a/test/files/run/spec-early.scala b/test/files/specialized/spec-early.scala index 84a8983f8c..065dd57db5 100644 --- a/test/files/run/spec-early.scala +++ b/test/files/specialized/spec-early.scala @@ -12,4 +12,5 @@ class Foo[@specialized(Int) T](_x: T) extends { object Test extends Application { new Foo("a") new Foo(42) + println(runtime.BoxesRunTime.integerBoxCount) } diff --git a/test/files/run/spec-init.check b/test/files/specialized/spec-init.check index 7705ee2947..46c031004a 100644 --- a/test/files/run/spec-init.check +++ b/test/files/specialized/spec-init.check @@ -7,3 +7,4 @@ shouldn't see two initialized values and one uninitialized 42 ok ok +5
\ No newline at end of file diff --git a/test/files/run/spec-init.scala b/test/files/specialized/spec-init.scala index 60852245b4..94cd0ee82b 100644 --- a/test/files/run/spec-init.scala +++ b/test/files/specialized/spec-init.scala @@ -36,5 +36,7 @@ object Test { (new TouchGlobal(new Object)) Global.msg = "ok" // reset the value (new TouchGlobal(42)) + + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/specialized/spec-matrix.check b/test/files/specialized/spec-matrix.check new file mode 100644 index 0000000000..77b8d536fb --- /dev/null +++ b/test/files/specialized/spec-matrix.check @@ -0,0 +1,2 @@ +* +4080500
\ No newline at end of file diff --git a/test/files/run/spec-matrix.scala b/test/files/specialized/spec-matrix.scala index 81e3eaf212..52bd3077d7 100644 --- a/test/files/run/spec-matrix.scala +++ b/test/files/specialized/spec-matrix.scala @@ -32,6 +32,8 @@ object Test { mult(m, n) println("*") + + println(runtime.BoxesRunTime.integerBoxCount) } def randomMatrix(n: Int, m: Int) = { diff --git a/test/files/specialized/spec-overrides.check b/test/files/specialized/spec-overrides.check new file mode 100644 index 0000000000..c227083464 --- /dev/null +++ b/test/files/specialized/spec-overrides.check @@ -0,0 +1 @@ +0
\ No newline at end of file diff --git a/test/files/run/spec-overrides.scala b/test/files/specialized/spec-overrides.scala index f5d2e2f9c7..e89480984e 100644 --- a/test/files/run/spec-overrides.scala +++ b/test/files/specialized/spec-overrides.scala @@ -17,4 +17,6 @@ object Test extends Application { assert(d2.default == 1.0, d2.default) assert((d2: Base[_]).default == 1.0, (d2: Base[_]).default) assert((d2: D1).default == 1.0, (d2: D1).default) + + println(runtime.BoxesRunTime.integerBoxCount) } diff --git a/test/files/run/spec-patmatch.check b/test/files/specialized/spec-patmatch.check index a6679fa1c7..33306ab5d9 100644 --- a/test/files/run/spec-patmatch.check +++ b/test/files/specialized/spec-patmatch.check @@ -17,3 +17,4 @@ long double float default +2
\ No newline at end of file diff --git a/test/files/run/spec-patmatch.scala b/test/files/specialized/spec-patmatch.scala index 92938836d8..909629455d 100644 --- a/test/files/run/spec-patmatch.scala +++ b/test/files/specialized/spec-patmatch.scala @@ -47,6 +47,7 @@ object Test { (new Foo).test(42.0f) (new Foo).test(new Object) + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/run/spec-super.check b/test/files/specialized/spec-super.check index c04dfc9fdf..4be83ca9e6 100644 --- a/test/files/run/spec-super.check +++ b/test/files/specialized/spec-super.check @@ -1,2 +1,3 @@ s 1 +2
\ No newline at end of file diff --git a/test/files/run/spec-super.scala b/test/files/specialized/spec-super.scala index ae71d72859..056a7712f0 100644 --- a/test/files/run/spec-super.scala +++ b/test/files/specialized/spec-super.scala @@ -7,6 +7,8 @@ object Test { val i = new Extended(1) println(i.foo) //infinite loop with StackOverflowError + + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/run/spec-t3896.check b/test/files/specialized/spec-t3896.check index bb101b641b..63b0735a6f 100644 --- a/test/files/run/spec-t3896.check +++ b/test/files/specialized/spec-t3896.check @@ -1,2 +1,3 @@ true true +0
\ No newline at end of file diff --git a/test/files/run/spec-t3896.scala b/test/files/specialized/spec-t3896.scala index 4c4dadbe13..89326b4284 100644 --- a/test/files/run/spec-t3896.scala +++ b/test/files/specialized/spec-t3896.scala @@ -9,10 +9,12 @@ trait Atomic[@specialized(Boolean) T] { class AtomicBoolean(val x: Boolean) extends Atomic[Boolean] object Test { - def main(args: Array[String]): Unit = { - val e = new AtomicBoolean(false) - val x = e.f( (a : Boolean) => !a ) // ok - println( e.f( (a : Boolean) => !a ) toString ) // ok - println( e.f( (a : Boolean) => !a) ) // compiler crash - } + def main(args: Array[String]): Unit = { + val e = new AtomicBoolean(false) + val x = e.f( (a : Boolean) => !a ) // ok + println( e.f( (a : Boolean) => !a ) toString ) // ok + println( e.f( (a : Boolean) => !a) ) // compiler crash + + println(runtime.BoxesRunTime.integerBoxCount) + } } diff --git a/test/files/speclib/instrumented.jar.desired.sha1 b/test/files/speclib/instrumented.jar.desired.sha1 index b9ee989293..790c6870f2 100644 --- a/test/files/speclib/instrumented.jar.desired.sha1 +++ b/test/files/speclib/instrumented.jar.desired.sha1 @@ -1 +1 @@ -b698acc3a39cc0186bd20f25fc307ee01ef3a135 ?instrumented.jar +58b92d3ba42d4893a1a6a96e02a5b475b8954844 ?instrumented.jar diff --git a/test/instrumented/library/scala/runtime/BoxesRunTime.java b/test/instrumented/library/scala/runtime/BoxesRunTime.java index ad5a0c7e0a..8f02cf1dfb 100644 --- a/test/instrumented/library/scala/runtime/BoxesRunTime.java +++ b/test/instrumented/library/scala/runtime/BoxesRunTime.java @@ -49,6 +49,13 @@ public final class BoxesRunTime /* BOXING ... BOXING ... BOXING ... BOXING ... BOXING ... BOXING ... BOXING ... BOXING */ public static int booleanBoxCount = 0; + public static int characterBoxCount = 0; + public static int byteBoxCount = 0; + public static int shortBoxCount = 0; + public static int integerBoxCount = 0; + public static int longBoxCount = 0; + public static int floatBoxCount = 0; + public static int doubleBoxCount = 0; public static java.lang.Boolean boxToBoolean(boolean b) { booleanBoxCount++; @@ -56,30 +63,37 @@ public final class BoxesRunTime } public static java.lang.Character boxToCharacter(char c) { + characterBoxCount++; return java.lang.Character.valueOf(c); } public static java.lang.Byte boxToByte(byte b) { + byteBoxCount++; return java.lang.Byte.valueOf(b); } public static java.lang.Short boxToShort(short s) { + shortBoxCount++; return java.lang.Short.valueOf(s); } public static java.lang.Integer boxToInteger(int i) { + integerBoxCount++; return java.lang.Integer.valueOf(i); } public static java.lang.Long boxToLong(long l) { + longBoxCount++; return java.lang.Long.valueOf(l); } public static java.lang.Float boxToFloat(float f) { + floatBoxCount++; return java.lang.Float.valueOf(f); } public static java.lang.Double boxToDouble(double d) { + doubleBoxCount++; // System.out.println("box " + d); // (new Throwable()).printStackTrace(); return java.lang.Double.valueOf(d); |