Skip to content

Commit 1e70eda

Browse files
lrytzretronym
authored andcommitted
[asm-cherry-pick] Use MethodWriter to compute maxLocals / maxStack
Make class MethodWriter public and add accessors for maxLocals and maxStack. This is the simplest way to compute the maxs using the ASM framework. It is used in the optimizer, see scala/scala@90781e8 TODO: this should no longer be necessary since scala/scala#4811 Originally added in lrytz/scala@91810c9
1 parent f7587fa commit 1e70eda

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/scala/tools/asm/MethodWriter.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @author Eric Bruneton
3737
* @author Eugene Kuleshov
3838
*/
39-
final class MethodWriter extends MethodVisitor {
39+
public final class MethodWriter extends MethodVisitor {
4040

4141
/** Indicates that nothing must be computed. */
4242
static final int COMPUTE_NOTHING = 0;
@@ -312,9 +312,17 @@ final class MethodWriter extends MethodVisitor {
312312
/** The max_stack field of the Code attribute. */
313313
private int maxStack;
314314

315+
public int getMaxStack() {
316+
return maxStack;
317+
}
318+
315319
/** The max_locals field of the Code attribute. */
316320
private int maxLocals;
317321

322+
public int getMaxLocals() {
323+
return maxLocals;
324+
}
325+
318326
/** The 'code' field of the Code attribute. */
319327
private final ByteVector code = new ByteVector();
320328

0 commit comments

Comments
 (0)