venasolutions / bosk

Apache License 2.0
11 stars 4 forks source link

Backport ClassBuilder fix #117

Open prdoyle opened 4 months ago

prdoyle commented 4 months ago

From https://github.com/boskworks/bosk/commit/3d3b2b69a63b0246d27e81484094926a53ba51e7

Explanation

Previously, we were calling Map.remove in an invokedynamic bootstrap method, because once the bootstrap was complete, the map entry was no longer needed.

The problem is, under certain circumstances, the JVM is allowed to call the bootstrap method multiple times. Since we had removed the map entry, subsequent calls would fail.

It's not clear whether this caused any actual problems, or merely threw spurious exceptions. I didn't observe any test failures caused by this problem, but I thought we're better safe than sorry.

Risk

This change causes some more memory to be retained in the form of entries in the CALL_SITES_BY_NAME map. The way Vena uses bosk, I'd guesstimate this will consume an extra few kilobytes.