Skip to content

2.12.10 preview #60

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 21 commits into from
Closed

2.12.10 preview #60

wants to merge 21 commits into from

Conversation

retronym
Copy link
Owner

@retronym retronym commented Aug 9, 2019

No description provided.

mkeskells and others added 21 commits July 25, 2019 23:20
jar writer can be customised ( to generate a specialsed jar writer)
Allow plugins to augment a jar manifest

Allow plugins to write additional outputs to jars or to the file system
Transparent boxing of value classes causes performance surprises,
news at 11.
I noticed this was slowing down the REPL's use of the presentation
compiler in some cases.
I noticed in profiles that filtering the the `before` set
for hard links generated a lot of garbage in compilers configured
with a large number of plugins.

This commit filters on the fly instead.
First, collapse components from hard-linked nodes ("runsRightAfter")
in a pre-processing step.

Then, perform a topological ordering of the graph with a modified
depth first search.

Finally, find the longest path from each node to the initial node
using the result of the topological search to pick the correct
edge. The length the assigns the level.

Existing code compiles the phase list ordering lexicographically by
(level, phaseName).
This shows us the places where we're depending on phase name
as a tie-breaker to decide phase order: fields/tailcalls and
delambdafy/jvm.

```
[log <no phase>] Phase assembly levels: (1,parser)
(2,namer:packageobjects:typer)
(5,patmat)
(6,superaccessors)
(7,extmethods)
(8,pickler)
(9,refchecks)
(10,uncurry)
(11,fields tailcalls:specialize)
(12,explicitouter:erasure:posterasure)
(15,lambdalift)
(16,constructors)
(17,flatten)
(18,mixin)
(19,cleanup)
(20,delambdafy jvm)
(21,terminal)
```
Don't rely on the fact that the assembly algorithm uses the phase
name as a sort key as a tie-breaker.

Before:
```
[log <no phase>] Phase assembly levels: (1,parser)
(2,namer:packageobjects:typer)
(5,patmat)
(6,superaccessors)
(7,extmethods)
(8,pickler)
(9,refchecks)
(10,uncurry)
(11,fields tailcalls:specialize)
(12,explicitouter:erasure:posterasure)
(15,lambdalift)
(16,constructors)
(17,flatten)
(18,mixin)
(19,cleanup)
(20,delambdafy jvm)
(21,terminal)
```

After:

```
[log <no phase>] Phase assembly levels: (1,parser)
(2,namer:packageobjects:typer)
(5,patmat)
(6,superaccessors)
(7,extmethods)
(8,pickler)
(9,refchecks)
(10,uncurry)
(11,fields)
(12,tailcalls:specialize)
(14,explicitouter:erasure:posterasure)
(17,lambdalift)
(18,constructors)
(19,flatten)
(20,mixin)
(21,cleanup)
(22,delambdafy)
(23,jvm)
(24,terminal)
```
This reverts commit fcd99c5.

While the shallowers ASTs are better for limiting stack usage of
scalac in post-patmat phases, the subtle change this made to the
bytecode control flow leads to drastically slower analysis of large
patterns by ASM. We use this analysis to generate the stackmap
frames during code generation and during optimization.

Perhaps a better way forward would be to explicitly generate
the stackmap frames during code generation, which AFAIK is not
computationally expensive while when we still have the AST in hand.

The challenge would be to use this as a basis for ASM to incrementally
add missing stack map frames for code that is transformed by our
optimizer phases.

`MethodWriter` has a mode that sounds promising:

```
  /**
   * Indicates that the stack map frames of type F_INSERT must be computed. The other frames are not
   * computed. They should all be of type F_NEW and should be sufficient to compute the content of
   * the F_INSERT frames, together with the bytecode instructions between a F_NEW and a F_INSERT
   * frame - and without any knowledge of the type hierarchy (by definition of F_INSERT).
   */
  static final int COMPUTE_INSERTED_FRAMES = 3;
```

https://gitlab.ow2.org/asm/asm/blob/ASM_7_1/asm/src/main/java/org/objectweb/asm/MethodWriter.java#L58-64
@retronym
Copy link
Owner Author

All merged to 2.12.x save for #59

@retronym retronym closed this Aug 16, 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.

2 participants