On Sun, 11 Jun 2023 21:01:54 GMT, Oliver Kopp <d...@openjdk.org> wrote:

> Fix for [JDK-8240567](https://bugs.openjdk.org/browse/JDK-8240567): 
> "MethodTooLargeException thrown while creating a jlink image".
> 
> Java still has a 64kb limit: A method may not be longer than 64kb. The idea 
> of the fix is to split up the generated methods in several smaller methods
> 
> This is a follow-up to https://github.com/openjdk/jdk/pull/10704. GitHub did 
> not allow me to re-open the PR, because I did a force-push to have one commit.

TL;DR: summary of the changes

- In the other PR we missed that `dedupSetBuilder` requires local variables in 
the method for caching
  - Code comments: `// Restore all (!) sets from parameter to local variables` 
and `// Store all new sets to List`
- In this PR, these variables are transferred from method to method by a 
`ArrayList`
- `0` is `this` when a method is called. `this` is needed to call the next 
helper method, thus we moved `BUILDER_VAR` to another place.
  - Code comments: `MAX_LOCAL_VARS + 1; // we need 0 for "this"` and on 
`MAX_LOCAL_VARS`: `// Constant chosen for this generator, can be higher in 
practice`

> @koppor Is this ready for review?

Yes, it is! We especially checked it with our (rather large) desktop 
application.

> The other PR went through a dozens or so iterations before it was returned to 
> draft.

I remember 😅. Therefore, we first had this as draft, waited for the "on-site 
checks" and then opened it.

> It seems like you were still battling with verifier errors. 

We missed an important point and the other PR.

> The comment on this PR says you it was created because a force-push so I 
> can't tell if you the changes are ready or not.

I am sorry for that. I weighted the requirement to have a single commit higher 
than reviewing the changes. The "excuse" for this decision is that nearly all 
code submitted back than has changed.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14408#issuecomment-1586615579

Reply via email to