asm merge requestshttps://gitlab.ow2.org/asm/asm/-/merge_requests2017-12-30T14:48:33Zhttps://gitlab.ow2.org/asm/asm/-/merge_requests/82Improve the class generation benchmark by using the JMH framework.2017-12-30T14:48:33ZEric BrunetonImprove the class generation benchmark by using the JMH framework.Results:
```
Benchmark Mode Cnt Score Error Units
GeneratorBenchmark.asm4_0 thrpt 20 753119,277 ± 1890,328 ops/s
GeneratorBenchmark.asm5_0 thrpt 20 729869,073 ± 23...Results:
```
Benchmark Mode Cnt Score Error Units
GeneratorBenchmark.asm4_0 thrpt 20 753119,277 ± 1890,328 ops/s
GeneratorBenchmark.asm5_0 thrpt 20 729869,073 ± 2328,108 ops/s
GeneratorBenchmark.asm6_0 thrpt 20 728330,694 ± 2244,506 ops/s
GeneratorBenchmark.asm6_1 thrpt 20 847886,985 ± 2767,943 ops/s
GeneratorBenchmark.aspectJBcel thrpt 20 274363,976 ± 1171,862 ops/s
GeneratorBenchmark.bcel thrpt 20 196715,573 ± 797,970 ops/s
GeneratorBenchmark.cojen thrpt 20 191329,604 ± 898,662 ops/s
GeneratorBenchmark.csgBytecode thrpt 20 325157,840 ± 1065,897 ops/s
GeneratorBenchmark.gnuByteCode thrpt 20 245634,219 ± 1061,192 ops/s
GeneratorBenchmark.jclassLib thrpt 20 280383,253 ± 973,727 ops/s
GeneratorBenchmark.jiapi thrpt 20 75012,298 ± 325,473 ops/s
GeneratorBenchmark.mozillaClassFile thrpt 20 303011,386 ± 1629,259 ops/s
```Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/81Fix the build for JDK9. Also switch to Gradle 4.4.1 and source 1.6 (retrofitt...2017-12-30T14:08:22ZEric BrunetonFix the build for JDK9. Also switch to Gradle 4.4.1 and source 1.6 (retrofitted to 1.5).Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/80Update the package Javadoc.2017-12-30T13:51:08ZEric BrunetonUpdate the package Javadoc.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/79Replace the use of 'new Integer' with 'Integer.valueOf'.2017-12-30T14:24:41ZEric BrunetonReplace the use of 'new Integer' with 'Integer.valueOf'.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/78Add a non-regression test for issue #3162042017-12-31T08:09:50ZEric BrunetonAdd a non-regression test for issue #316204Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/77Small code quality improvements, hopefully the last ones for the core package.2017-12-10T14:05:29ZEric BrunetonSmall code quality improvements, hopefully the last ones for the core package.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/76Improve the code quality of Type and add more tests.2017-12-10T13:42:03ZEric BrunetonImprove the code quality of Type and add more tests.Also optimize the implementation with a new internal sort value, to avoid some String and StringBuilder manipulations.Also optimize the implementation with a new internal sort value, to avoid some String and StringBuilder manipulations.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/75Improve the code quality of Label and add a Constants interface for internal ...2017-12-10T13:40:43ZEric BrunetonImprove the code quality of Label and add a Constants interface for internal constantsIn more details:
- add a Constants interface to avoid some magic constants in the code
- remove the INSTRUCTION_TYPES indirection in ClassReader, and use (table)switch statements on raw opcode values instead
- remove unnecessary flags BA...In more details:
- add a Constants interface to avoid some magic constants in the code
- remove the INSTRUCTION_TYPES indirection in ClassReader, and use (table)switch statements on raw opcode values instead
- remove unnecessary flags BASIC_BLOCK_CHANGED, VISITED and VISITED2 in Label (replaced with a simpler algorithm using an EMPTY_LIST sentinel), as well as the redundant STORE flag
- add an otherLineNumbers field in Label to store line numbers in a cleaner way than with nextChangedBlock
- remove the inputStackTop field in Label, which was used to store different values depending on the compute options or basic block types. Replace it with new inputStackSize and outputStackSize fields in Label, and a new (private) outputStackStart field in Frame.
- use 'short' fields when possible in Frame and Label. Object size in memory with OpenJDK 1.8.0, measured with https://www.javaworld.com/article/2077496/testing-debugging/java-tip-130--do-you-know-your-data-size-.html, decreased from 64 to 56 bytes for Label (despite the added fields), and stayed unchanged (48 bytes) for Frame (despite the added field outputStackStart).
- split the large visitMaxs method in two smaller methods.
- performance is unchanged or improved: 1.02-1.04 speedup for ClassReader, no change for ClassReader+ClassWriter, 1.11 speedup for CR+CW with compute maxs, 1.05 speedup for CR+CW with compute frames.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/74Update to be able to generate JDK 10 compatible classfile (54).2017-12-10T12:01:11ZRemi ForaxUpdate to be able to generate JDK 10 compatible classfile (54).There is no new feature, the number is just incremented so the
association between a JDK version and a classfile version is monotonic.
see http://mail.openjdk.java.net/pipermail/jdk-dev/2017-December/000309.html for more info.There is no new feature, the number is just incremented so the
association between a JDK version and a classfile version is monotonic.
see http://mail.openjdk.java.net/pipermail/jdk-dev/2017-December/000309.html for more info.Eric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/merge_requests/73Improve the code quality of ClassReader.2017-11-26T12:38:25ZEric BrunetonImprove the code quality of ClassReader.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/72Improve the code quality of Frame.2017-11-25T09:34:33ZEric BrunetonImprove the code quality of Frame.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/71Improve the code quality of MethodWriter.2017-11-25T09:09:12ZEric BrunetonImprove the code quality of MethodWriter.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/70Improve the code quality of ClassWriter.2017-11-25T07:56:49ZEric BrunetonImprove the code quality of ClassWriter.Also fix a bug in toByteArray() if(hasAsmInsns) ...: type annotations were not reset to null.Also fix a bug in toByteArray() if(hasAsmInsns) ...: type annotations were not reset to null.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/69Rename the *UnitTest classes to *Test, and merge them in existing *Test class...2017-11-14T19:45:57ZEric BrunetonRename the *UnitTest classes to *Test, and merge them in existing *Test class if needed.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/68Improve the code quality of SignatureReader and SignatureWriter.2017-11-14T18:57:50ZEric BrunetonImprove the code quality of SignatureReader and SignatureWriter.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/67Improve the code quality of ModuleWriter.2017-11-19T08:44:29ZEric BrunetonImprove the code quality of ModuleWriter.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/66Improve the code quality of Item and of related code in ClassWriter and Class...2017-11-25T07:07:40ZEric BrunetonImprove the code quality of Item and of related code in ClassWriter and ClassReader.- Item was a mutable class with many set* methods, used to set predefined Item key instances in ClassWriter, to perform lookups (while avoiding the creation of new instances for this). These preallocated keys were error prone, due to the...- Item was a mutable class with many set* methods, used to set predefined Item key instances in ClassWriter, to perform lookups (while avoiding the creation of new instances for this). These preallocated keys were error prone, due to the nested calls (a nested call could inadvertently modify the key used by a caller).
- The Javadoc was largely obsolete, refering mostly to the constant pool, while Item was also used for bootstrap methods and for the ASM specific type table.
- The number of elements in ClassWriter#items was poorly tracked, for instance bootstrap methods were not taken into account in ClassWriter#put.
- The threshold to limit hash collisions was not always respected (for instance in copyPool, items was created with a size equal to the constant pool count, without margin).
- Lookups in ClassWriter#get were not optimal: a check on hashcode could be used before calling the expensive isEqualTo method.
Now Item is replaced with Symbol, which is immutable (except for the lazily computed info field). Also the hashCode and next fields are hidden in a private subclass (they are only used inside SymbolTable).
The preallocated Item key, key2, ... fields are removed, while keeping the zero allocation property for lookups.
The number of elements in entries is now explicitely tracked with entryCount, and the threshold is correctly used.
Lookups are now optimized to do a quick hashcode comparison before slow equality tests.
All Symbol management is now done is a separate SymbolTable class, allowing a cleaner implementation for the copyPool option (more private fields, less exposure of internal details to other classes).
According to performance tests using benchmarks/read-write, this new code is slightly faster than before (e.g. ~1.05 speedup for R+W with or without copyPool).
The jar size is now 99581 bytes vs 95209 for ASM 6.0.
This is a large refactor, please review carefully.
PS: I spent several days on this, and considered several designs before choosing this one. For instance, I also considered splitting SymbolTable in 3 (e.g. ConstantPoolWriter, BootstrapMethodsWriter and TypeTable, all delegating to a shared (custom) HashSet), and/or splitting Symbol using one class per type of symbol, to get something even more clean from an Object Oriented design point of view. But I rejected this as "going too far" from the current design.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/65Fix the Javadoc errors and fail the build on Javadoc errors.2017-10-31T11:30:08ZEric BrunetonFix the Javadoc errors and fail the build on Javadoc errors.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/64Improve the code quality of FieldWriter.2017-10-31T10:37:10ZEric BrunetonImprove the code quality of FieldWriter.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/63Improve the code quality of Handler and Handle.2017-10-22T13:53:12ZEric BrunetonImprove the code quality of Handler and Handle.Remi ForaxRemi Forax