Openj9: Solve the 'inline' consternation

Created on 15 Sep 2017  ·  8Comments  ·  Source: eclipse/openj9

The definition of JITINLINE, as well potentially other places in the code, causes consternation. Specifically, if you compile C files with newer C compilers, JITINLINE doesn't emit a symbol, causing compilation failures such as

../tr.source/trj9/runtime/MethodMetaData.h:366:18: error: inline function ‘getByteCodeInfoFromStackMap’ declared but never defined [-Werror]

This has been worked around previously by forcing newer C compilers to use the old standard, but this really should be resolved once and for all, and likely, across the whole codebase.

jit

Most helpful comment

I think we definitely need to set up single define for OPENJ9_INLINE so that all components do the same thing unless the explicitly need to do something different. Currently I see at least 3 different components defining an inline attribute and they are all subtly different.

All 8 comments

If you look at Line 200 it fails to set JITINLINE to inline __attribute((always_inline)) if J9VM_GC_REALTIME is enabled. The J9VM_GC_REALTIME flag will be enabled for ALL OpenJ9 specs. This was likely supposed to be for the RTSJ flag when it was supported.

(I should add, this might be a larger epic, as we probably need a broader conversation about inlining, how to do it, what to force, and what to allow the compiler to do)

Also it is fairly pointless in my opinion to mark a function as inline or inline __attribute((always_inline)) in the header if the code for the function is also not in the header. Some of the MethodMetaDeta.h functions that are marked as JITINLINE are implemented in MethodMetaDeta.c and ONLY used within MethodMetaDeta.c. To me it would make more sense to just create them as private functions and in the MethodMetaDeta.c mark it as inline.

I think we definitely need to set up single define for OPENJ9_INLINE so that all components do the same thing unless the explicitly need to do something different. Currently I see at least 3 different components defining an inline attribute and they are all subtly different.

I completely agree with just one inline definition across all components.
Related to the the presence of JITINLINE in MethodMetaData.* I vaguely recollect that it was needed to speedup stack walking. The person that did the investigation and came up with the solution no longer works on the JIT compiler.

Hey, @mgaudet - are you able to recommend the workaround you are mentioning in your original comment? My toolchain is gcc 7.2.0 and although I could rebuild it to use 4.9.2 (would it be "old" enough), maybe you can help me with a quick fix? Thanks!

IIRC the 'workaround' was adding -fgnu89-inline to the compiler build flags.

Does this still need to be open? I don't find JITINLINE anywhere in the codebase

Was this page helpful?
0 / 5 - 0 ratings