Permalink
Browse files
SI-7814 Updates the instrumented version of ScalaRuntime.
Some tests for specialization use a modified version of the standard library that count boxing, array lookups etc. These sources are updated manually with the script: % test/instrumented/mkinstrumented.sh build Looks that that wasn't done for a while, though. This commit brings it up to date, and adjusts a few braces in ScalaRuntime.scala so the srt.scala (used by that script) is shorter. We should really avoid checking in the products of that script and run it as part of the build, or, better, use the bytecode instrumentation framework instead of a modified standard library. But I have to leave that for another day.
- Loading branch information...
Showing with 70 additions and 156 deletions.
@@ -1,67 +1,10 @@ | |||
8a9,10 | |||
> /* INSTRUMENTED VERSION */ | |||
> | |||
73a76,77 | |||
68a71,72 | |||
> var arrayApplyCount = 0 | |||
> | |||
75,86c79,93 | |||
< def array_apply(xs: AnyRef, idx: Int): Any = xs match { | |||
< case x: Array[AnyRef] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Int] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Double] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Long] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Float] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Char] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Byte] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Short] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Boolean] => x(idx).asInstanceOf[Any] | |||
< case x: Array[Unit] => x(idx).asInstanceOf[Any] | |||
< case null => throw new NullPointerException | |||
--- | |||
> def array_apply(xs: AnyRef, idx: Int): Any = { | |||
70a75 | |||
> arrayApplyCount += 1 | |||
87a93 | |||
> arrayApplyCount += 1 | |||
> xs match { | |||
> case x: Array[AnyRef] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Int] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Double] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Long] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Float] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Char] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Byte] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Short] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Boolean] => x(idx).asInstanceOf[Any] | |||
> case x: Array[Unit] => x(idx).asInstanceOf[Any] | |||
> case null => throw new NullPointerException | |||
> } | |||
88a96,97 | |||
> var arrayUpdateCount = 0 | |||
> | |||
90,101c99,113 | |||
< def array_update(xs: AnyRef, idx: Int, value: Any): Unit = xs match { | |||
< case x: Array[AnyRef] => x(idx) = value.asInstanceOf[AnyRef] | |||
< case x: Array[Int] => x(idx) = value.asInstanceOf[Int] | |||
< case x: Array[Double] => x(idx) = value.asInstanceOf[Double] | |||
< case x: Array[Long] => x(idx) = value.asInstanceOf[Long] | |||
< case x: Array[Float] => x(idx) = value.asInstanceOf[Float] | |||
< case x: Array[Char] => x(idx) = value.asInstanceOf[Char] | |||
< case x: Array[Byte] => x(idx) = value.asInstanceOf[Byte] | |||
< case x: Array[Short] => x(idx) = value.asInstanceOf[Short] | |||
< case x: Array[Boolean] => x(idx) = value.asInstanceOf[Boolean] | |||
< case x: Array[Unit] => x(idx) = value.asInstanceOf[Unit] | |||
< case null => throw new NullPointerException | |||
--- | |||
> def array_update(xs: AnyRef, idx: Int, value: Any): Unit = { | |||
> arrayUpdateCount += 1 | |||
> xs match { | |||
> case x: Array[AnyRef] => x(idx) = value.asInstanceOf[AnyRef] | |||
> case x: Array[Int] => x(idx) = value.asInstanceOf[Int] | |||
> case x: Array[Double] => x(idx) = value.asInstanceOf[Double] | |||
> case x: Array[Long] => x(idx) = value.asInstanceOf[Long] | |||
> case x: Array[Float] => x(idx) = value.asInstanceOf[Float] | |||
> case x: Array[Char] => x(idx) = value.asInstanceOf[Char] | |||
> case x: Array[Byte] => x(idx) = value.asInstanceOf[Byte] | |||
> case x: Array[Short] => x(idx) = value.asInstanceOf[Short] | |||
> case x: Array[Boolean] => x(idx) = value.asInstanceOf[Boolean] | |||
> case x: Array[Unit] => x(idx) = value.asInstanceOf[Unit] | |||
> case null => throw new NullPointerException | |||
> } |
Please sign in to comment.
0 comments on commit
a19babc