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

Initialize port lib properly for tril tests #7252

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/env/CompilerEnv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace TR
class OMR_EXTENSIBLE CompilerEnv : public OMR::CompilerEnvConnector
{
public:
CompilerEnv(TR::RawAllocator raw, const TR::PersistentAllocatorKit &persistentAllocatorKit) :
OMR::CompilerEnvConnector(raw, persistentAllocatorKit)
CompilerEnv(TR::RawAllocator raw, const TR::PersistentAllocatorKit &persistentAllocatorKit, OMRPortLibrary *omrPortLib = NULL) :
OMR::CompilerEnvConnector(raw, persistentAllocatorKit, omrPortLib)
{}
};

Expand Down
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