JDK-8257692 : Using both heap and native segments can degrade performance
  • Type: Bug
  • Component: tools
  • Sub-Component: jextract
  • Affected Version: 16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-03
  • Updated: 2020-12-11
  • Resolved: 2020-12-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-panamaFixed
Related Reports
Relates :  
Relates :  
Description
See attached benchmark.

If we run a simple sum loop benchmark using both a heap and a native segment in the same benchmark, performance degrades. But, when one of them is commented out (including the initialization), the performance of the other is fast again. This also affects the buffer_crazy case, but only one-way (when we have a native segment the buffer_crazy case degrades, but not the other way around)

The common factor between these things seems to be ScopedMemoryAccess. Perhaps some profile pollution occurs there.

As a result, various checks are not hoisted from the loop (perhaps due to Unsafe memory barriers, since the base is not known to be null/non-null)