Skip to content

Merge of the PRs we intend to upstream to asm #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from

Conversation

retronym
Copy link
Owner

@retronym retronym commented Jun 11, 2018

Compendium of #1 #2 #3 #4 #5 #6

Refers to scala/scala-asm#9

Publish locally with:

$ subl build.gradle

$ git diff head
diff --git a/build.gradle b/build.gradle
index b2d75d8c..68d3052c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -43,7 +43,7 @@ subprojects {
   apply plugin: 'jacoco'
   def snapshotSuffix = rootProject.hasProperty('release') ? '' : '-SNAPSHOT'
   group = 'org.ow2.asm'
-  version = '6.2' + snapshotSuffix
+  version = '6.2-bin-510c813' + snapshotSuffix
   sourceCompatibility = '1.6'
   targetCompatibility = '1.6'
   test { useJUnitPlatform() }

$ gradle -i install

$ find ~/.m2/repository/org/ow2/asm/ | grep SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm/6.2-bin-510c813-SNAPSHOT/asm-6.2-bin-510c813-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm/6.2-SNAPSHOT/asm-6.2-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-analysis/6.2-bin-510c813-SNAPSHOT/asm-analysis-6.2-bin-510c813-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-analysis/6.2-SNAPSHOT/asm-analysis-6.2-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-commons/6.2-bin-510c813-SNAPSHOT/asm-commons-6.2-bin-510c813-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-commons/6.2-SNAPSHOT/asm-commons-6.2-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-test/6.2-bin-510c813-SNAPSHOT/asm-test-6.2-bin-510c813-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-test/6.2-SNAPSHOT/asm-test-6.2-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-tree/6.2-bin-510c813-SNAPSHOT/asm-tree-6.2-bin-510c813-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-tree/6.2-SNAPSHOT/asm-tree-6.2-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-util/6.2-bin-510c813-SNAPSHOT/asm-util-6.2-bin-510c813-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-util/6.2-SNAPSHOT/asm-util-6.2-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-xml/6.2-bin-510c813-SNAPSHOT/asm-xml-6.2-bin-510c813-SNAPSHOT.jar
/Users/jz/.m2/repository/org/ow2/asm//asm-xml/6.2-SNAPSHOT/asm-xml-6.2-SNAPSHOT.jar

Then go over to scala/scala#6766 and run:

$ sbt

> set resolvers in ThisBuild += Resolver.mavenLocal
[info] Defining {.}/*:resolvers
[info] The new value will be used by bench/*:externalResolvers, bootstrap/*:externalResolvers and 19 others.
[info] 	Run `last` for details.
[info] Reapplying settings...

> junit/test
...
[info] Passed: Total 1684, Failed 0, Errors 0, Passed 1677, Skipped 7
[success] Total time: 102 s, completed 11/06/2018 1:46:37 PM

lrytz and others added 15 commits June 9, 2018 22:18
Fail early when adding an instruction that already belongs to a
different instruction list.
Adds a method `setStack` to analysis.Frame which allows setting the
dataflow value of a stack slot.

Could be used in nullness analysis. After, for example, an instance call,
aliases of the receiver can be set to NotNull, both in locals and on the
stack.
Introduces a number of methods that are called when initializing or
updating abstract values in an analyzer frame.

Before this commit, Analyzer.analyze and Frame.execute would always
call Interpreter.newValue for initializing or updating frame values.

Having multiple methods allows users to return more precise values
for the individual cases. For example, in a nullness analysis, the
initial value for the `this` parameter of an instance method can be
set to not-null.
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.
retronym added a commit to retronym/scala that referenced this pull request Jun 11, 2018
@retronym retronym changed the title Unfork/omnibus Collection of changes to ASM we intend to propose upstream Jun 11, 2018
@retronym retronym changed the title Collection of changes to ASM we intend to propose upstream Merge of the PRs we intend to upstream to asm Jun 11, 2018
@retronym retronym self-assigned this Jun 11, 2018
ebruneton and others added 7 commits June 12, 2018 20:16
Minor Javadoc improvements

See merge request asm/asm!182
… reformat the source files. Due to bug sherter/google-java-format-gradle-plugin#25 the formatting was only checked on the :asm project, and not on the other subprojects. Version 0.7 of the plugin solves this issue.
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
```
retronym added a commit to retronym/scala that referenced this pull request Jun 20, 2018
@retronym retronym closed this Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants