Make AOT Compilation generate the same code as JIT Compilation for enter/exit tracing - #17621
Conversation
|
fyi @vijaysun-omr @mstoodle tagging you guys in case you have some concerns about the slight change in functionality. |
|
Oh, and I don't think I caught why the flags needed to be expanded to 16-bit. What's causing that? |
It's because with the addition of |
|
OK, I see. It's because there are 5 flags there in addition to the 4 bits reserved for It seems to me that only one flag value is really necessary in But there is some maintainability benefit to keeping them separate, and the larger flags field shouldn't affect the size of most relocation records anyway (at least on 64-bit), so I think it's fine the way it is 👍 🙂 |
|
@jdmpapin addressed review comments; good for review again. I ran a bunch of internal tests, and it looks like there's no issues on all platforms (including 32-bit); the only exception is aarch64 which I wasn't able to run any tests on. |
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
When -Xtrace or JVMTI method enter/exit tracing is enabled, the generated code is different between a JIT and AOT compilation. This commit makes the AOT compilation generate the same code as a JIT compilation. Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
|
@jdmpapin review reminder. |
|
Jenkins test sanity.functional,sanity.openjdk all jdk8,jdk11,jdk17,jdk21 depends eclipse-omr/omr#7039 |
|
jdk11 aarch64 test failure looks to be the same as #11930 |
|
jdk 21 win64 failure seems to be infra related; no tests seem to have been launched. |
|
Jenkins test sanity.functional,sanity.openjdk win jdk21 depends eclipse-omr/omr#7039 |
|
I'm fairly certain |
|
Normally I'd just ignore known failures, but I'm restarting the builds to see them pass because this is for a coordinated merge |
|
Jenkins test sanity.openjdk alinux jdk11 depends eclipse-omr/omr#7039 |
|
Jenkins test sanity.openjdk alinux64 jdk11 depends eclipse-omr/omr#7039 |
|
Jenkins test sanity.openjdk win jdk17,jdk21 depends eclipse-omr/omr#7039 |
|
Jenkins test sanity.functional,sanity.openjdk win jdk17 depends eclipse-omr/omr#7039 |
|
Similar error on |
|
Yesterday OMR was promoted manually despite some known issues appearing in the acceptance build, including exactly this pair of timeouts (EnoughSeedTest+ApiTest in sanity.openjdk/jdk_security1_1 on Windows x86-64, JDK17), so I won't bother restarting it again |
There are two different types of method enter/exit tracing available:
-Xtrace:print=mt,methods=...JIT Implementation
If either of these types of tracing are possible, then the ILGenerator generates IL containing
TR::MethodEnterHookand/orTR::MethodExitHookop codes. Later on in the compilation,TR_J9VMBase::lowerMethodHookis invoked on these op codes.If
-Xtraceis specified on a particular method, then the compiler generates a call to the appropriate helper [1]. Otherwise, if the JVM may have to report method enter/exit hooks to a JVMTI agent, then a runtime test is generated [2].AOT Implementation
Like the JIT case, if either of these types of tracing are possible, then the ILGenerator generates IL containing
TR::MethodEnterHookand/orTR::MethodExitHookop codes, on whichTR_J9VMBase::lowerMethodHookis invoked. The difference though is that regardless of the type of tracing, the compiler generates aTR_MethodEnterExitGuard[3]. At AOT load time, if either type of tracing is possible, the guard is activated; otherwise, it is left as a NOP.[1]
openj9/runtime/compiler/env/VMJ9.cpp
Line 2980 in 45ed10a
[2]
openj9/runtime/compiler/env/VMJ9.cpp
Line 3076 in 45ed10a
[3]
openj9/runtime/compiler/env/VMJ9.cpp
Line 3000 in 45ed10a
This PR makes the code generated during an AOT compilation the same as what is generated during a JIT compilation with respect to enter/exit tracing. The main functional difference is that in the existing implementation, if tracing was not enabled on a Load run, if the code had the guard, it would be left as a NOP to not report to the VM whereas in the proposed implementation, it would continue to report to the VM (in the case of
-Xtrace) or continue to have the runtime test (in the case of the JVMTI callback) thus increasing the path length. However, I don't the added complexity of having a completely different implementation for AOT is justified to prevent this extra path length considering that it will only happen if one generates AOT with the tracing and then removes the option in a subsequent run.This PR also includes some refactoring to facilitate this change. Specifically:
_extrafield from the binary templateThe reason for this is to have additional flags in the method header as well as the inlined method relocation records. The method header flags indicate if method tracing is enabled (
-Xtrace) as well as if method enter/exit events can be hooked (JVMTI). The inlined method relocation records only need a flag to validate if method tracing is enabled; this is because the JVMTI hooks are not method specific and so it suffices to only check the AOT method header;in fact a further refactoring could move this flag to the AOT Header (which covers all methods in the SCC)- this is likely going to be needed for CRIU to allow methods that both have and don't have tracing support.Depends on eclipse-omr/omr#7039