diff --git a/runtime/compiler/control/HookedByTheJit.cpp b/runtime/compiler/control/HookedByTheJit.cpp index 5806a6afb7..7de047b47d 100644 --- a/runtime/compiler/control/HookedByTheJit.cpp +++ b/runtime/compiler/control/HookedByTheJit.cpp @@ -2482,16 +2482,26 @@ void jitMethodBreakpointed(J9VMThread * vmThread, J9Method *j9method) */ void jitIllegalFinalFieldModification(J9VMThread *currentThread, J9Class *fieldClass) { + J9JITConfig * jitConfig = currentThread->javaVM->jitConfig; + TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig); + +#if defined(J9VM_OPT_JITSERVER) + if (compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::SERVER) + { + // Don't execute this hook at the jitserver side + // This piece of code will be removed once all JIT hooks is disabled at the jitserver side + fieldClass->classFlags |= J9ClassHasIllegalFinalFieldModifications; + return; + } +#endif // Set the bit so that VM doesn't report the modification next time fieldClass->classFlags |= J9ClassHasIllegalFinalFieldModifications; - J9JITConfig * jitConfig = currentThread->javaVM->jitConfig; TR_J9VMBase * fe = TR_J9VMBase::get(jitConfig, currentThread); int32_t length; char *className = fe->getClassNameChars((TR_OpaqueClassBlock*)fieldClass, length); reportHook(currentThread, "jitIllegalFinalFieldModification", "class %p %.*s", fieldClass, length, className); - TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig); TR_RuntimeAssumptionTable * rat = compInfo->getPersistentInfo()->getRuntimeAssumptionTable(); if (rat) { @@ -2893,12 +2903,13 @@ static bool updateCHTable(J9VMThread * vmThread, J9Class * cl) TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig); +#if defined(J9VM_OPT_JITSERVER) + TR_ASSERT_FATAL(compInfo->getPersistentInfo()->getRemoteCompilationMode() != JITServer::SERVER, "updateCHTable() should not be called on JITServer!\n"); +#endif + TR_PersistentCHTable * table = 0; if (TR::Options::getCmdLineOptions()->allowRecompilation() && !TR::Options::getCmdLineOptions()->getOption(TR_DisableCHOpts) -#if defined(J9VM_OPT_JITSERVER) - && compInfo->getPersistentInfo()->getRemoteCompilationMode() != JITServer::SERVER -#endif ) table = compInfo->getPersistentInfo()->getPersistentCHTable(); @@ -3613,30 +3624,32 @@ static void jitHookClassPreinitialize(J9HookInterface * * hookInterface, UDATA e jitAcquireClassTableMutex(vmThread); - if (TR::Options::getCmdLineOptions()->allowRecompilation() - && !TR::Options::getCmdLineOptions()->getOption(TR_DisableCHOpts) #if defined(J9VM_OPT_JITSERVER) - && compInfo->getPersistentInfo()->getRemoteCompilationMode() != JITServer::SERVER + if (compInfo->getPersistentInfo()->getRemoteCompilationMode() != JITServer::SERVER) #endif - ) { - if (!initFailed && !compInfo->getPersistentInfo()->getPersistentCHTable()->classGotInitialized(vm, compInfo->persistentMemory(), clazz)) - initFailed = true; + if (TR::Options::getCmdLineOptions()->allowRecompilation() + && !TR::Options::getCmdLineOptions()->getOption(TR_DisableCHOpts) + ) + { + if (!initFailed && !compInfo->getPersistentInfo()->getPersistentCHTable()->classGotInitialized(vm, compInfo->persistentMemory(), clazz)) + initFailed = true; - if (!initFailed && - !vm->isInterfaceClass(clazz)) - updateCHTable(vmThread, cl); - } - else - { - if (!initFailed && !updateCHTable(vmThread, cl)) - initFailed = true; - } + if (!initFailed && + !vm->isInterfaceClass(clazz)) + updateCHTable(vmThread, cl); + } + else + { + if (!initFailed && !updateCHTable(vmThread, cl)) + initFailed = true; + } - if (initFailed) - { - TR_PersistentClassInfo *info = compInfo->getPersistentInfo()->getPersistentCHTable()->findClassInfo(clazz); - compInfo->getPersistentInfo()->getPersistentCHTable()->removeClass(vm, clazz, info, false); + if (initFailed) + { + TR_PersistentClassInfo *info = compInfo->getPersistentInfo()->getPersistentCHTable()->findClassInfo(clazz); + compInfo->getPersistentInfo()->getPersistentCHTable()->removeClass(vm, clazz, info, false); + } } classPreinitializeEvent->failed = initFailed; @@ -6550,7 +6563,11 @@ int32_t setUpHooks(J9JavaVM * javaVM, J9JITConfig * jitConfig, TR_FrontEnd * vm) } j9thread_monitor_exit(javaVM->vmThreadListMutex); - if (!vmj9->isAOT_DEPRECATED_DO_NOT_USE()) + if (!vmj9->isAOT_DEPRECATED_DO_NOT_USE() +#if defined(J9VM_OPT_JITSERVER) + && compInfo->getPersistentInfo()->getRemoteCompilationMode() != JITServer::SERVER +#endif + ) { if ((*vmHooks)->J9HookRegisterWithCallSite(vmHooks, J9HOOK_VM_JNI_NATIVE_REGISTERED, jitHookJNINativeRegistered, OMR_GET_CALLSITE(), NULL)) { diff --git a/runtime/compiler/control/rossa.cpp b/runtime/compiler/control/rossa.cpp index 4b8abd062f..f2a9f86132 100644 --- a/runtime/compiler/control/rossa.cpp +++ b/runtime/compiler/control/rossa.cpp @@ -1312,8 +1312,14 @@ onLoadInternal( numCodeCachesToCreateAtStartup = 4; #endif - if (!persistentMemory->getPersistentInfo()->getRuntimeAssumptionTable()->init()) - return -1; + +#if defined(J9VM_OPT_JITSERVER) + if (persistentMemory->getPersistentInfo()->getRemoteCompilationMode() != JITServer::SERVER) +#endif + { + if (!persistentMemory->getPersistentInfo()->getRuntimeAssumptionTable()->init()) + return -1; + } TR_PersistentClassLoaderTable *loaderTable = new (PERSISTENT_NEW) TR_PersistentClassLoaderTable(persistentMemory); if (loaderTable == NULL)