JDK-8153743 : AllocateHeap() and ReallocateHeap() should use ALWAYSINLINE macro
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-04-07
  • Updated: 2016-07-14
  • Resolved: 2016-06-22
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.
JDK 9
9 b127Fixed
Related Reports
Relates :  
Relates :  
Description
For force inlining, JDK-8076212 uses always_inline attribute to them.
JDK-8151593 added ALWAYSINLINE macro for force inlining.

For consistency, and for other compiler support, AllocateHeap() and
ReallocateHeap() should use ALWAYSINLINE.

I used ALWAYSINLINE to them, but I got error message as below;
------------------------------
Building target 'images' in configuration 'linux-x86_64-normal-server-release'
In file included from /home/ysuenaga/OpenJDK/hs-rt/hotspot/src/share/vm/utilities/array.hpp:29:0,
                 from /home/ysuenaga/OpenJDK/hs-rt/hotspot/src/share/vm/memory/universe.hpp:29,
                 from /home/ysuenaga/OpenJDK/hs-rt/hotspot/src/share/vm/code/oopRecorder.hpp:28,
                 from /home/ysuenaga/OpenJDK/hs-rt/hotspot/src/share/vm/asm/codeBuffer.hpp:28,
                 from /home/ysuenaga/OpenJDK/hs-rt/hotspot/src/share/vm/asm/assembler.hpp:28,
                 from /home/ysuenaga/OpenJDK/hs-rt/hotspot/src/share/vm/precompiled/precompiled.hpp:29:
/home/ysuenaga/OpenJDK/hs-rt/hotspot/src/share/vm/memory/allocation.inline.hpp:72:20: ���������: always_inline function might not be inlinable [-Werror=attributes]
 ALWAYSINLINE char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag,
                    ^
------------------------------

According to GCC manual [1], non-static inline function is always compiled
on its own in the usual fashion.
However, we can compile as inline function with "inline" and "always_inline".
always_inline attribute does not imply inlining [2].
GCC testcase [3] uses both "inline" and "always_inline" actually.


[1] https://gcc.gnu.org/onlinedocs/gcc/Inline.html
[2] https://chromiumcodereview.appspot.com/14820003/
[3] https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c?view=markup&pathrev=178730


Comments
Review thread: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2016-May/019316.html
15-06-2016

David, can you put link to review thread? Thanks!
14-06-2016

FC Extension request Justification: Minor code cleanup contributed by the community, which just missed initial FC date Risk: Very Low, should have no affect on generated code. Due date: The patch is ready and reviewed, waiting for approval.
13-06-2016

This is a very small change that should be doable for JDK 9 so I have retargetted it to 9 to get it into the approval process.
18-05-2016