diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-11-09 22:58:47 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-12-19 23:18:26 -0800 |
commit | b6dd2d2e14aa88ea42622ac6a6092bba8ddb300a (patch) | |
tree | ab9e82096e325b8847066f319afd03b88640ea08 /src/partest/scala/tools/partest/javaagent/ProfilerVisitor.java | |
parent | ba6a3d6f87c0007196a4a82aaef58a290f87b864 (diff) | |
download | scala-b6dd2d2e14aa88ea42622ac6a6092bba8ddb300a.tar.gz scala-b6dd2d2e14aa88ea42622ac6a6092bba8ddb300a.tar.bz2 scala-b6dd2d2e14aa88ea42622ac6a6092bba8ddb300a.zip |
Do not recompute stack frames when instrumenting bytecode.
It turns out that we do not need to do that. See comment in
`ProfilerVisitor.java`. Also, since recomputing stack frame
map was the only reason we needed to implement
`getCommonSuperClass` we can now remove its implementation
that was causing problems on Java 7 due to a cyclic dependency
involving class loader because we would try to load a class
we are currently transforming and transformer is triggered just
before classloading.
//cc @namin who worked on this code with me.
Diffstat (limited to 'src/partest/scala/tools/partest/javaagent/ProfilerVisitor.java')
-rw-r--r-- | src/partest/scala/tools/partest/javaagent/ProfilerVisitor.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/partest/scala/tools/partest/javaagent/ProfilerVisitor.java b/src/partest/scala/tools/partest/javaagent/ProfilerVisitor.java index ac83f66506..8306327b14 100644 --- a/src/partest/scala/tools/partest/javaagent/ProfilerVisitor.java +++ b/src/partest/scala/tools/partest/javaagent/ProfilerVisitor.java @@ -33,6 +33,19 @@ public class ProfilerVisitor extends ClassVisitor implements Opcodes { // only instrument non-abstract methods if((access & ACC_ABSTRACT) == 0) { assert(className != null); + /* The following instructions do not modify compressed stack frame map so + * we don't need to worry about recalculating stack frame map. Specifically, + * let's quote "ASM 4.0, A Java bytecode engineering library" guide (p. 40): + * + * In order to save space, a compiled method does not contain one frame per + * instruction: in fact it contains only the frames for the instructions + * that correspond to jump targets or exception handlers, or that follow + * unconditional jump instructions. Indeed the other frames can be easily + * and quickly inferred from these ones. + * + * Instructions below are just loading constants and calling a method so according + * to definition above they do not contribute to compressed stack frame map. + */ mv.visitLdcInsn(className); mv.visitLdcInsn(name); mv.visitLdcInsn(desc); |