Skip to content

Commit

Permalink
Pass port library to compilertest JIT initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Spencer Comin <spencer.comin@ibm.com>
  • Loading branch information
Spencer-Comin committed Feb 7, 2024
1 parent dffe559 commit d75a9a0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
10 changes: 8 additions & 2 deletions fvtest/compilertest/Jit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/

#ifndef FVTEST_COMPILERTEST_JIT_INCL
#define FVTEST_COMPILERTEST_JIT_INCL

#include <stdint.h>
#include "omrport.h"

namespace TR { class MethodBuilder; }
class TR_Memory;

extern "C" bool initializeJit();
extern "C" bool initializeJitWithOptions(char * options);
extern "C" bool initializeJit(OMRPortLibrary *omrPortLib = NULL);
extern "C" bool initializeJitWithOptions(char * options, OMRPortLibrary *omrPortLib = NULL);
extern "C" uint32_t compileMethodBuilder(TR::MethodBuilder *m, uint8_t **entry);
extern "C" void shutdownJit();

#endif
12 changes: 6 additions & 6 deletions fvtest/compilertest/control/TestJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ initializeCodeCache(TR::CodeCacheManager & codeCacheManager)
// options is any JIT option string passed in to globally influence compilation
extern "C"
bool
initializeTestJit(TR_RuntimeHelper *helperIDs, void **helperAddresses, int32_t numHelpers, char *options)
initializeTestJit(TR_RuntimeHelper *helperIDs, void **helperAddresses, int32_t numHelpers, char *options, OMRPortLibrary *portLib)
{
// Force enable tree verifier
std::string optionsWithVerifier = options;
Expand All @@ -155,7 +155,7 @@ initializeTestJit(TR_RuntimeHelper *helperIDs, void **helperAddresses, int32_t n
{
// Allocate the host environment structure
//
TR::Compiler = new (rawAllocator) TR::CompilerEnv(rawAllocator, TR::PersistentAllocatorKit(rawAllocator));
TR::Compiler = new (rawAllocator) TR::CompilerEnv(rawAllocator, TR::PersistentAllocatorKit(rawAllocator), portLib);
}
catch (const std::bad_alloc&)
{
Expand All @@ -180,16 +180,16 @@ initializeTestJit(TR_RuntimeHelper *helperIDs, void **helperAddresses, int32_t n

extern "C"
bool
initializeJitWithOptions(char *options)
initializeJitWithOptions(char *options, OMRPortLibrary *portLib)
{
return initializeTestJit(0, 0, 0, options);
return initializeTestJit(0, 0, 0, options, portLib);
}

extern "C"
bool
initializeJit()
initializeJit(OMRPortLibrary *portLib)
{
return initializeTestJit(0, 0, 0, (char *)"-Xjit:useILValidator");
return initializeTestJit(0, 0, 0, (char *)"-Xjit:useILValidator", portLib);
}

extern "C"
Expand Down
2 changes: 1 addition & 1 deletion fvtest/compilertriltest/JitTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class JitTest : public TestWithPortLib

JitTest()
{
auto initSuccess = initializeJitWithOptions((char*)"-Xjit:acceptHugeMethods,enableBasicBlockHoisting,omitFramePointer,useILValidator,paranoidoptcheck");
auto initSuccess = initializeJitWithOptions((char*)"-Xjit:acceptHugeMethods,enableBasicBlockHoisting,omitFramePointer,useILValidator,paranoidoptcheck", privateOmrPortLibrary);
if (!initSuccess)
throw std::runtime_error("Failed to initialize jit");
}
Expand Down
3 changes: 2 additions & 1 deletion fvtest/tril/test/JitTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
#include <gtest/gtest.h>
#include "ilgen/MethodBuilder.hpp"
#include "Jit.hpp"
#include "omrport.h"

bool initializeJit();
bool initializeJit(OMRPortLibrary *omrPortLib);
int32_t compileMethodBuilder(TR::MethodBuilder * methodBuilder, void ** entryPoint);
void shutdownJit();

Expand Down

0 comments on commit d75a9a0

Please sign in to comment.