On Fri, 11 Feb 2022 13:42:01 GMT, liach <d...@openjdk.java.net> wrote:
>> ...having suggested that rearrangement, perhaps the right way to do it is to >> enable some VM.isXXX queries themselves to be constant-foldable so that >> other callers too may benefit. Like this: >> https://github.com/plevart/jdk/commit/e918ccc52bbc288f6721af5fa66d8f7a8cc880cf >> WDYT? > > I believe your patch to fold these methods is a good choice: for example, > `FileSystems.getDefault()` will be constant-foldable as a result. > For shutdown, the benefit may look negligible, but a consistency in style is > beneficial. > To make this more efficient, I recommend looking at the callers to > `VM.initLevel()` and replace with such boolean checks if possible: for > example, `ClassLoader.getSystemClassLoader` may be constant-foldable if its > default branch of switch on init level become a dedicated fast path. > > Since this change affects multiple components and beyond the reflection > factory itself, I don't think I will include it here; I will just use the > right arrangement. This belongs to another jbs ticket. Right, I wasn't suggesting to include that in the patch. Local rearrangement is OK anyway. Latest code looks good to me. ------------- PR: https://git.openjdk.java.net/jdk/pull/6889