Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JNI Call to set ForceUsePreexistence #9

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions jcl/src/java.base/share/classes/com/ibm/jit/JITHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,8 @@ public int getInitialLockword(int flags, int reservedCounter, int cancelCounter)

public static native void dispatchVirtual();

public static native void setForceUsePreexistence();

private native static final void debugAgentRun(MethodAccessor ma, Object obj, Object[] args);

public static Object invoke(MethodAccessor ma, Object obj, Object[] args) throws InvocationTargetException {
Expand Down
1 change: 1 addition & 0 deletions jcl/src/java.base/share/classes/module-info.java.extra
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ exports com.ibm.oti.util to java.management, jdk.attach, jdk.jcmd, jdk.managemen
exports openj9.internal.tools.attach.target to jdk.attach, jdk.jcmd, jdk.management;
exports openj9.management.internal to java.management, openj9.jvm;
exports openj9.internal.management to java.management;
exports com.ibm.jit;
exports jdk.internal.org.objectweb.asm to openj9.dtfj, openj9.dtfjview;
// Following allows dtfj/dtfjview modules invoke module addReads & addExports programmatically via reflection APIs
exports jdk.internal.module to openj9.dtfj, openj9.dtfjview;
Expand Down
6 changes: 6 additions & 0 deletions runtime/compiler/control/DebugAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
#include <queue>
#include <set>

void
debugAgentSetForceUsePreexistence(J9VMThread* vmThread)
{
TR::Options::getCmdLineOptions()->setOption(TR_ForceUsePreexistence);
}

BOOLEAN
debugAgentStart(J9VMThread* vmThread)
{
Expand Down
3 changes: 3 additions & 0 deletions runtime/compiler/control/DebugAgent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include "j9nonbuilder.h"
#include "jni.h"

extern J9_CFUNC void
debugAgentSetForceUsePreexistence(J9VMThread* vmThread);

extern J9_CFUNC BOOLEAN
debugAgentStart(J9VMThread* vmThread);

Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/control/rossa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,7 @@ onLoadInternal(
jitConfig->debugAgentRevertToInterpreter = debugAgentRevertToInterpreter;
jitConfig->debugAgentRecompile = debugAgentRecompile;
jitConfig->debugAgentEnd = debugAgentEnd;
jitConfig->debugAgentSetForceUsePreexistence = debugAgentSetForceUsePreexistence;

jitConfig->printAOTHeaderProcessorFeatures = printAOTHeaderProcessorFeatures;

Expand Down
8 changes: 8 additions & 0 deletions runtime/jcl/common/jithelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,14 @@ Java_com_ibm_jit_JITHelpers_getClassFlagsFromJ9Class32(JNIEnv *env, jobject rcv,

#endif

void JNICALL
Java_com_ibm_jit_JITHelpers_setForceUsePreexistence(JNIEnv* env, jclass ignored)
{
J9VMThread *vmThread = (J9VMThread *)env;
J9JITConfig *jitConfig = vmThread->javaVM->jitConfig;
jitConfig->debugAgentSetForceUsePreexistence(vmThread);
}

void JNICALL
Java_com_ibm_jit_JITHelpers_debugAgentRun(JNIEnv *env, jclass ignored, jobject ma, jobject obj, jobjectArray args)
{
Expand Down
1 change: 1 addition & 0 deletions runtime/jcl/exports.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ omr_add_exports(jclse
Java_com_ibm_jit_JITHelpers_objectHeaderHasBeenHashedInClass
Java_com_ibm_jit_JITHelpers_objectHeaderHasBeenMovedInClass
Java_com_ibm_jit_JITHelpers_debugAgentRun
Java_com_ibm_jit_JITHelpers_setForceUsePreexistence
Java_com_ibm_jvm_Dump_HeapDumpImpl
Java_com_ibm_jvm_Dump_JavaDumpImpl
Java_com_ibm_jvm_Dump_SnapDumpImpl
Expand Down
1 change: 1 addition & 0 deletions runtime/jcl/uma/jithelpers_jni_exports.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@
<exclude-if condition="spec.flags.env_data64"/>
</export>
<export name="Java_com_ibm_jit_JITHelpers_debugAgentRun" />
<export name="Java_com_ibm_jit_JITHelpers_setForceUsePreexistence" />
</exports>
1 change: 1 addition & 0 deletions runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -4037,6 +4037,7 @@ typedef struct J9JITConfig {
BOOLEAN (*debugAgentRevertToInterpreter)(struct J9VMThread *vmThread, J9JITExceptionTable *jitMethod);
BOOLEAN (*debugAgentRecompile)(struct J9VMThread *vmThread, J9JITExceptionTable *jitMethod, IDATA lastOptIndex, IDATA lastOptSubIndex, BOOLEAN enableTracing);
BOOLEAN (*debugAgentEnd)(struct J9VMThread *vmThread);
void (*debugAgentSetForceUsePreexistence)(struct J9VMThread *vmThread);
#if defined(J9VM_OPT_JITSERVER)
int32_t (*startJITServer)(struct J9JITConfig *jitConfig);
int32_t (*waitJITServerTermination)(struct J9JITConfig *jitConfig);
Expand Down
1 change: 1 addition & 0 deletions runtime/oti/jclprots.h
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ jint JNICALL Java_com_ibm_jit_JITHelpers_getModifiersFromRomClass32(JNIEnv *env,
jint JNICALL Java_com_ibm_jit_JITHelpers_getClassFlagsFromJ9Class32(JNIEnv *env, jobject rcv, jint j9clazz);
#endif /* J9VM_ENV_DATA64 */
void JNICALL Java_com_ibm_jit_JITHelpers_debugAgentRun(JNIEnv *env, jclass ignored, jobject ma, jobject obj, jobjectArray args);
void JNICALL Java_com_ibm_jit_JITHelpers_setForceUsePreexistence(JNIEnv *env,jclass ignored);

/* crypto.c */
jboolean JNICALL Java_com_ibm_jit_Crypto_isAESSupportedByHardware(JNIEnv *env, jobject ignored);
Expand Down