eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.28k stars 721 forks source link

Remove need for Direct-X-Buffer.java.template extension #1464

Open adamfarley opened 6 years ago

adamfarley commented 6 years ago

Summary: Direct-X-Buffer.java.template has an extension that calls Direct-Byte-Buffer-only variants of native memory allocation methods in Unsafe.java. This allows us to track native memory allocations used for DBBs, and to print that information in javacores and the oputput from the !nativememinfo DTFJ command. This allows debugging developers and service teams to identify the source of native memory leaks far quicker.

We want to remove this extension, to bring us closer to having no extensions.

Notes: vmconstantpool.xml contains constants that could be used to populate these values, however I've yet to figure out how. Since the variables in Bits.java are both static AtomicLong objects, we need to find a way to access the value of the "volatile long value" field inside them.

This gives us a link to those static objects, I think, but trial-and-error has yet to produce a way to get the values of the "value" variable inside those objects.

Here's what I have so far: https://github.com/eclipse/openj9/pull/1508

adamfarley commented 6 years ago

It turns out OMR changes the amount of native memory we are reserving in a way that changes based on the precise quantity of memory reserved by individual memory transactions.

Since all Bits has is the overall total for all transactions, we can't know what the amount we're actually reserving is. I've put together a set of arguments for modifying Bits, and I'm waiting to hear back from the OpenJDK community.

P.S. OMR adds its extra bit of native memory via the ROUNDED_BYTE_AMOUNT macro, which is defined in omrmemtag_checks.h, and used in the omrmem_allocate_memory method inside the omememtag.c file.

adamfarley commented 6 years ago

Update: Still working with the OpenJDK community to update Bits.java to make at least one of its variables accurate (to the point where it includes the VM overhead data).

The emails continue on both sides.