asm merge requestshttps://gitlab.ow2.org/asm/asm/-/merge_requests2019-01-13T23:39:08Zhttps://gitlab.ow2.org/asm/asm/-/merge_requests/220when testing, do not load classes that are tagged as preview2019-01-13T23:39:08ZRemi Foraxwhen testing, do not load classes that are tagged as previewclassfiles tagged as preview (with the minor version set to 65535/-1) can not be loaded by a VM unless the VM is started with the flag --enable-preview so this patch disable the loading of preview classes during the testclassfiles tagged as preview (with the minor version set to 65535/-1) can not be loaded by a VM unless the VM is started with the flag --enable-preview so this patch disable the loading of preview classes during the testEric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/merge_requests/190WIP: Unknown signatur with Groovy-Eclipse compiler2018-07-26T08:09:53ZTobias GruetzmacherWIP: Unknown signatur with Groovy-Eclipse compilerThis shows a problem where the Groovy-Eclipse compiler creates a type
signature of `!+Ljava/lang/Object;`, which asm cannot parse.
I'm not sure (and wasn't able to find information) about this problem (except reports where people have t...This shows a problem where the Groovy-Eclipse compiler creates a type
signature of `!+Ljava/lang/Object;`, which asm cannot parse.
I'm not sure (and wasn't able to find information) about this problem (except reports where people have the same problem: https://github.com/johnrengelman/shadow/issues/379) or even about what those signatures (`!+`) are supposed to be.
Background: I encountered this problem with the [maven-dependency-plugin](https://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html) while analysing a project compiled with the Groovy-Eclipse compiler, which contained this particular Lambda...
Any help would be appreciated.
PS: I submitted this as a merge request (and not an issue) to show the problem with a test case I built - If you need an additional issue, I can open one, too.https://gitlab.ow2.org/asm/asm/-/merge_requests/188Avoid double-compilation of :asm2018-12-01T12:36:10ZNikita SkvortcovAvoid double-compilation of :asmReuse production classes of ":asm" project. Postpone retrofitting until a jar of production classes is required (e.g., for publishing). Use raw production classes as dependencies of tools, required to produce the jar.
This also allows th...Reuse production classes of ":asm" project. Postpone retrofitting until a jar of production classes is required (e.g., for publishing). Use raw production classes as dependencies of tools, required to produce the jar.
This also allows the project to be correctly imported by Intellij IDEAhttps://gitlab.ow2.org/asm/asm/-/merge_requests/183WIP: Make ClassWriter reusable2018-06-27T01:50:57ZJason ZauggWIP: Make ClassWriter reusableAdds a `clear()` method to `ClassWriter` to allow the user to
reuse it to write another class without needing to allocate
new buffers for the constant pool, etc.
Furthermore, add a mode that enabled internal reuse of of
buffers class wr...Adds a `clear()` method to `ClassWriter` to allow the user to
reuse it to write another class without needing to allocate
new buffers for the constant pool, etc.
Furthermore, add a mode that enabled internal reuse of of
buffers class writing.
Exposes an overload of `toByteArray` that does not require
a copy of the internal buffer, but rather returns the `ByteVector`
directly. `ByteVector` has been updated to expose its contents
in a read-only manner as a `ByteBuffer` or a `ByteArrayInputStream`.
I've made an initial attempt to include this in the benchmark
framework.
```
# VM version: JDK 1.8.0_162, VM 25.162-b12
Benchmark Mode Cnt Score Error Units
GeneratorBenchmark.asm6_1 thrpt 20 874896.336 ± 10360.316 ops/s
GeneratorBenchmark.asm6_1:+memory.used thrpt 20 ≈ 0 bytes
GeneratorBenchmark.asm6_1:·gc.alloc.rate thrpt 20 2777.524 ± 31.962 MB/sec
GeneratorBenchmark.asm6_1:·gc.alloc.rate.norm thrpt 20 5000.001 ± 0.003 B/op
GeneratorBenchmark.asm6_1:·gc.churn.PS_Eden_Space thrpt 20 2689.738 ± 71.334 MB/sec
GeneratorBenchmark.asm6_1:·gc.churn.PS_Eden_Space.norm thrpt 20 4841.558 ± 101.258 B/op
GeneratorBenchmark.asm6_1:·gc.churn.PS_Survivor_Space thrpt 20 0.162 ± 0.044 MB/sec
GeneratorBenchmark.asm6_1:·gc.churn.PS_Survivor_Space.norm thrpt 20 0.291 ± 0.079 B/op
GeneratorBenchmark.asm6_1:·gc.count thrpt 20 264.000 counts
GeneratorBenchmark.asm6_1:·gc.time thrpt 20 176.000 ms
GeneratorBenchmark.asm6_1_reuse thrpt 20 1053280.540 ± 38925.306 ops/s
GeneratorBenchmark.asm6_1_reuse:+memory.used thrpt 20 ≈ 0 bytes
GeneratorBenchmark.asm6_1_reuse:·gc.alloc.rate thrpt 20 1525.059 ± 56.375 MB/sec
GeneratorBenchmark.asm6_1_reuse:·gc.alloc.rate.norm thrpt 20 2280.001 ± 0.002 B/op
GeneratorBenchmark.asm6_1_reuse:·gc.churn.PS_Eden_Space thrpt 20 1455.204 ± 57.245 MB/sec
GeneratorBenchmark.asm6_1_reuse:·gc.churn.PS_Eden_Space.norm thrpt 20 2175.987 ± 47.373 B/op
GeneratorBenchmark.asm6_1_reuse:·gc.churn.PS_Survivor_Space thrpt 20 0.171 ± 0.046 MB/sec
GeneratorBenchmark.asm6_1_reuse:·gc.churn.PS_Survivor_Space.norm thrpt 20 0.257 ± 0.070 B/op
GeneratorBenchmark.asm6_1_reuse:·gc.count thrpt 20 248.000 counts
GeneratorBenchmark.asm6_1_reuse:·gc.time thrpt 20 166.000 ms
```
```
# VM version: JDK 10.0.1, VM 10.0.1+10
Benchmark Mode Cnt Score Error Units
GeneratorBenchmark.asm6_1 thrpt 20 808490.379 ± 9597.741 ops/s
GeneratorBenchmark.asm6_1:·gc.alloc.rate thrpt 20 2567.604 ± 30.110 MB/sec
GeneratorBenchmark.asm6_1:·gc.alloc.rate.norm thrpt 20 5000.001 ± 0.002 B/op
GeneratorBenchmark.asm6_1:·gc.churn.CodeHeap_'non-profiled_nmethods' thrpt 20 0.008 ± 0.002 MB/sec
GeneratorBenchmark.asm6_1:·gc.churn.CodeHeap_'non-profiled_nmethods'.norm thrpt 20 0.016 ± 0.004 B/op
GeneratorBenchmark.asm6_1:·gc.churn.G1_Old_Gen thrpt 20 2574.135 ± 84.224 MB/sec
GeneratorBenchmark.asm6_1:·gc.churn.G1_Old_Gen.norm thrpt 20 5012.769 ± 155.361 B/op
GeneratorBenchmark.asm6_1:·gc.count thrpt 20 235.000 counts
GeneratorBenchmark.asm6_1:·gc.time thrpt 20 250.000 ms
GeneratorBenchmark.asm6_1_reuse thrpt 20 874917.363 ± 2517.632 ops/s
GeneratorBenchmark.asm6_1_reuse:·gc.alloc.rate thrpt 20 1266.731 ± 4.102 MB/sec
GeneratorBenchmark.asm6_1_reuse:·gc.alloc.rate.norm thrpt 20 2280.001 ± 0.002 B/op
GeneratorBenchmark.asm6_1_reuse:·gc.churn.CodeHeap_'non-profiled_nmethods' thrpt 20 0.004 ± 0.002 MB/sec
GeneratorBenchmark.asm6_1_reuse:·gc.churn.CodeHeap_'non-profiled_nmethods'.norm thrpt 20 0.008 ± 0.004 B/op
GeneratorBenchmark.asm6_1_reuse:·gc.churn.G1_Old_Gen thrpt 20 1266.407 ± 62.495 MB/sec
GeneratorBenchmark.asm6_1_reuse:·gc.churn.G1_Old_Gen.norm thrpt 20 2279.504 ± 113.687 B/op
GeneratorBenchmark.asm6_1_reuse:·gc.count thrpt 20 144.000 counts
GeneratorBenchmark.asm6_1_reuse:·gc.time thrpt 20 147.000 ms
```https://gitlab.ow2.org/asm/asm/-/merge_requests/180Call interpreter.copyOperation consistently2018-06-15T17:00:33ZJason ZauggCall interpreter.copyOperation consistentlyBefore this change, `Frame.execute` did not invoke the interpreter's
`copyOperation` method for all values that are pushed on the frame's
when executing some copying instructions.
For example, in the case of `SWAP`, `copyOperation` is i...Before this change, `Frame.execute` did not invoke the interpreter's
`copyOperation` method for all values that are pushed on the frame's
when executing some copying instructions.
For example, in the case of `SWAP`, `copyOperation` is invoked:
value2 = pop();
value1 = pop();
push(interpreter.copyOperation(insn, value2));
push(interpreter.copyOperation(insn, value1));
For `DUP` on the other hand, the original value is pushed onto the
stack without notifying the interpreter:
value1 = pop();
push(value1);
push(interpreter.copyOperation(insn, value1));
This leads to a problem for the `SourceInterpreter`, which collects
for every value a set of potential producer instructions. Given the
bytecode sequence
NEW java/lang/Object
DUP
INVOKESPECIAL java/lang/Object.<init> ()V
In the frame of the `INVOKESPECIAL` instruction, the value on the stack
lists as its producer the `NEW` operation instead of the `DUP`, which
not expected.https://gitlab.ow2.org/asm/asm/-/merge_requests/143Make it easier for ASM users to work with EA releases of the JDK2018-09-24T07:29:33ZraphwMake it easier for ASM users to work with EA releases of the JDKAllow disabling class file version check in class reader to better allow ASM users to work with EA releases of the JVM after version numbers are increased.
Makes a formerly package-private constructor accessible. As many ASM users sha...Allow disabling class file version check in class reader to better allow ASM users to work with EA releases of the JVM after version numbers are increased.
Makes a formerly package-private constructor accessible. As many ASM users shade ASM, it is already easily possible to use this constructor by creating a subclass in the org.objectweb.asm package that invokes this constructor with the appropriate access rights but it would be nicer to get a more official way to access the constructor.https://gitlab.ow2.org/asm/asm/-/merge_requests/95Resolve "Ability to call Type#getElementType with specific number of dimensions"2018-01-13T07:39:32ZEric BrunetonResolve "Ability to call Type#getElementType with specific number of dimensions"Closes #317798Closes #317798Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/46Don't insert frames when expanding ASM pseudo instructions if EXPAND_FRAMES i...2017-10-19T18:43:41ZEric BrunetonDon't insert frames when expanding ASM pseudo instructions if EXPAND_FRAMES is not set.ASM pseudo instructions are used when jump instructions need to be resized in large methods. To convert them to normal instructions, a new ClassReader->ClassWriter roundtrip is performed, with the EXPAND_ASM_INSNS flag and with the EXPAN...ASM pseudo instructions are used when jump instructions need to be resized in large methods. To convert them to normal instructions, a new ClassReader->ClassWriter roundtrip is performed, with the EXPAND_ASM_INSNS flag and with the EXPAND_FRAMES flag if the class already had frames (see ClassWriter#toByteArray). If EXPAND_FRAMES is false this means the class had initially no frames, despite the fact that it has jump instructions (otherwise there could not be any ASM pseudo insns to replace). Therefore, in this case, we should not attempt to insert frames in ClassReader.
Closes #317800Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/44Remove the workaround introduced for synthetic parameters.2017-11-07T19:34:31ZEric BrunetonRemove the workaround introduced for synthetic parameters.A workaround was added in https://gitlab.ow2.org/asm/asm/commit/4accca37fbf28623afeb46148cdaeec2ad97a6be for issue #307392. The root cause of the bug was that, via a ClassReader->ClassWriter transform, the number of parameter annotations...A workaround was added in https://gitlab.ow2.org/asm/asm/commit/4accca37fbf28623afeb46148cdaeec2ad97a6be for issue #307392. The root cause of the bug was that, via a ClassReader->ClassWriter transform, the number of parameter annotations was not preserved (the number read in ClassReader was ignored, and it was recomputed from the descriptor in MethodWriter).
The workaround added at this time was fixing that, and it was also attempting to report parameter indices corresponding to the source parameters, assuming that the implicit parameters were at added at the begining. However, synthetic parameters can also be added at the end (see issue #317788), so the second part of the above workaround does not work.
This change removes this workaround, and replaces it with a method to preserve the num_parameters value read in ClassReader (via a sentinel annotation). In other words, this change still fixes the root cause of #307392, but no longer attempts to map bytecode parameter indices to source level parameter indices. We believe there is no universal method for doing that, but users can implement their own method, if desired, on top of the ASM API. Indeed, the JVMS spec states that (https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18):
> The i'th entry in the parameter_annotations table may, but is not required to, correspond to the i'th parameter descriptor in the method descriptor (§4.3.3).
>
> For example, a compiler may choose to create entries in the table corresponding only to those parameter descriptors which represent explicitly declared parameters in source code. In the Java programming language, a constructor of an inner class is specified to have an implicitly declared parameter before its explicitly declared parameters (JLS §8.8.1), so the corresponding <init> method in a class file has a parameter descriptor representing the implicitly declared parameter before any parameter descriptors representing explicitly declared parameters. If the first explicitly declared parameter is annotated in source code, then a compiler may create parameter_annotations[0] to store annotations corresponding to the second parameter descriptor.
Closes #317788Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/301Allows classes extending ClassReader to decide if visit MethodParameters2020-12-20T08:02:29ZGuillermo VarelaAllows classes extending ClassReader to decide if visit MethodParametersWith https://gitlab.ow2.org/asm/asm/-/merge_requests/278 MethodParameters attribute is skipped when using SKIP_DEBUG. That's stopping us from upgrading to a newer ASM version.
Having the decision being made in a protected method we coul...With https://gitlab.ow2.org/asm/asm/-/merge_requests/278 MethodParameters attribute is skipped when using SKIP_DEBUG. That's stopping us from upgrading to a newer ASM version.
Having the decision being made in a protected method we could override it and start using a new version of ASM.
For clarity, not using the SKIP_DEBUG flag would not work for our case as that would include too much of extra things. Having a customizable condition for MethodParameters was the cleanest change I could came up with.Remi ForaxRemi Forax