Skip to content

Commit

Permalink
Merge pull request #1821 from mstoodle/remove_old_jb_replay
Browse files Browse the repository at this point in the history
Eliminate early jitbuilder replay support
  • Loading branch information
0xdaryl authored Oct 19, 2017
2 parents 956eacc + 1c2e806 commit a9c1f85
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 309 deletions.
134 changes: 3 additions & 131 deletions compiler/ilgen/IlBuilder.cpp

Large diffs are not rendered by default.

27 changes: 2 additions & 25 deletions compiler/ilgen/IlBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ class IlBuilder : public TR::IlInjector
_partOfSequence(false),
_connectedTrees(false),
_comesBack(true),
_isHandler(false),
_haveReplayName(false),
_rpILCpp(0)
_isHandler(false)
{
}
IlBuilder(TR::IlBuilder *source);
Expand All @@ -120,7 +118,7 @@ class IlBuilder : public TR::IlInjector

virtual bool isBytecodeBuilder() { return false; }

char *getName();
//char *getName();

void print(const char *title, bool recurse=false);
void printBlock(TR::Block *block);
Expand Down Expand Up @@ -414,27 +412,6 @@ class IlBuilder : public TR::IlInjector
*/
bool _isHandler;

/**
* @brief part of experimental "replay" support; returns true if replay is enabled
*/
bool _haveReplayName;

/**
* @brief part of experimental "replay" support; the fstream where replay commands will be directed to
*/
std::fstream * _rpILCpp;

/**
* @brief part of experimental "replay" support; the name of the replay file name
*/
char _replayName[21];

/**
* @brief part of experimental "replay" support: character array used to assemble each line of output
*/
char _rpLine[256];


virtual bool buildIL() { return true; }

TR::SymbolReference *lookupSymbol(const char *name);
Expand Down
73 changes: 0 additions & 73 deletions compiler/ilgen/MethodBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@
#define TraceEnabled (comp()->getOption(TR_TraceILGen))
#define TraceIL(m, ...) {if (TraceEnabled) {traceMsg(comp(), m, ##__VA_ARGS__);}}

// replay always on for now
//#define REPLAY(x) { x; }
#define REPLAY(x) { }
#define MB_REPLAY(...) { REPLAY({sprintf(_rpLine, ##__VA_ARGS__); (*_rpCpp) << "\t" << _rpLine << std::endl;}) }
#define MB_REPLAY_NONL(...) { REPLAY({sprintf(_rpLine, ##__VA_ARGS__); (*_rpCpp) << "\t" << _rpLine;}) }
#define REPLAY_TYPE(t) ((t)->getName())

#define REPLAY_USE_NAMES_FOR_POINTERS
#if defined(REPLAY_USE_NAMES_FOR_POINTERS)
#define REPLAY_POINTER_FMT "&%s"
#define REPLAY_POINTER(p,n) n
#else
#define REPLAY_POINTER_FMT "%p"
#define REPLAY_POINTER(p,n) p
#endif

// MethodBuilder is an IlBuilder object representing an entire method /
// function, so it conceptually has an entry point (though multiple entry
Expand Down Expand Up @@ -123,32 +108,6 @@ MethodBuilder::MethodBuilder(TR::TypeDictionary *types, OMR::VirtualMachineState
{

_definingLine[0] = '\0';

REPLAY({
std::fstream rpHpp("ReplayMethod.hpp",std::fstream::out);
rpHpp << "#include \"ilgen/MethodBuilder.hpp\"" << std::endl;
rpHpp << "class ReplayMethod : public TR::MethodBuilder {" << std::endl;
rpHpp << "\tReplayMethod(TR::TypeDictionary *types);" << std::endl;
rpHpp << "\tvirtual bool buildIL();" << std::endl;
rpHpp << "};" << std::endl;
rpHpp.close();

_rpCpp = new std::fstream("ReplayMethodConstructor.cpp",std::fstream::out);
(*_rpCpp) << "#include \"ilgen/TypeDictionary.hpp\"" << std::endl << std::endl;
(*_rpCpp) << "#include \"ReplayMethod.hpp\"" << std::endl << std::endl;
(*_rpCpp) << "ReplayMethod::ReplayMethod(TR::TypeDictionary *types)" << std::endl;
(*_rpCpp) << "\t: TR::MethodBuilder(types) {" << std::endl;
// } to match open one in string in prev line so editors can match properly

_rpILCpp = new std::fstream("ReplayMethodBuildIL.cpp",std::fstream::out);
(*_rpILCpp) << "#include \"ilgen/TypeDictionary.hpp\"" << std::endl << std::endl;
(*_rpILCpp) << "#include \"ReplayMethod.hpp\"" << std::endl << std::endl;
(*_rpILCpp) << "bool ReplayMethod::buildIL() {" << std::endl;
// } to match open one in string in prev line so editors can match properly

strcpy(_replayName, "this");
_haveReplayName = true;
})
}

MethodBuilder::~MethodBuilder()
Expand Down Expand Up @@ -201,13 +160,6 @@ bool
MethodBuilder::injectIL()
{
bool rc = IlBuilder::injectIL();
REPLAY({
(*_rpCpp) << "}" << std::endl;
_rpCpp->close();

(*_rpILCpp) << "}" << std::endl;
_rpILCpp->close();
})
return rc;
}

Expand Down Expand Up @@ -441,8 +393,6 @@ MethodBuilder::isSymbolAnArray(const char *name)
TR::BytecodeBuilder *
MethodBuilder::OrphanBytecodeBuilder(int32_t bcIndex, char *name)
{
MB_REPLAY("OrphanBytecodeBuilder(%d, \"%s\");", bcIndex, name);

TR::BytecodeBuilder *orphan = new (comp()->trHeapMemory()) TR::BytecodeBuilder(_methodBuilder, bcIndex, name);
orphan->initialize(_details, _methodSymbol, _fe, _symRefTab);
orphan->setupForBuildIL();
Expand All @@ -461,24 +411,19 @@ MethodBuilder::AppendBuilder(TR::BytecodeBuilder *bb)
void
MethodBuilder::DefineName(const char *name)
{
MB_REPLAY("DefineName(\"%s\");", name);
_methodName = name;
}

void
MethodBuilder::DefineLocal(const char *name, TR::IlType *dt)
{
MB_REPLAY("DefineLocal(\"%s\", %s);", name, REPLAY_TYPE(dt));

TR_ASSERT_FATAL(_symbolTypes.find(name) == _symbolTypes.end(), "Symbol '%s' already defined", name);
_symbolTypes.insert(std::make_pair(name, dt));
}

void
MethodBuilder::DefineMemory(const char *name, TR::IlType *dt, void *location)
{
MB_REPLAY("DefineMemory(\"%s\", %s, " REPLAY_POINTER_FMT ");", name, REPLAY_TYPE(dt), REPLAY_POINTER(location, name));

TR_ASSERT_FATAL(_memoryLocations.find(name) == _memoryLocations.end(), "Memory '%s' already defined", name);

_symbolTypes.insert(std::make_pair(name, dt));
Expand All @@ -488,8 +433,6 @@ MethodBuilder::DefineMemory(const char *name, TR::IlType *dt, void *location)
void
MethodBuilder::DefineParameter(const char *name, TR::IlType *dt)
{
MB_REPLAY("DefineParameter(\"%s\", %s);", name, REPLAY_TYPE(dt));

TR_ASSERT_FATAL(_parameterSlot.find(name) == _parameterSlot.end(), "Parameter '%s' already defined", name);

_parameterSlot.insert(std::make_pair(name, _numParameters));
Expand All @@ -502,7 +445,6 @@ MethodBuilder::DefineParameter(const char *name, TR::IlType *dt)
void
MethodBuilder::DefineArrayParameter(const char *name, TR::IlType *elementType)
{
MB_REPLAY("DefineArrayParameter(\"%s\", %s);", name, REPLAY_TYPE(elementType));
DefineParameter(name, elementType);

_symbolIsArray.insert(name);
Expand All @@ -511,7 +453,6 @@ MethodBuilder::DefineArrayParameter(const char *name, TR::IlType *elementType)
void
MethodBuilder::DefineReturnType(TR::IlType *dt)
{
MB_REPLAY("DefineReturnType(%s);", REPLAY_TYPE(dt));
_returnType = dt;
}

Expand Down Expand Up @@ -545,21 +486,7 @@ MethodBuilder::DefineFunction(const char* const name,
int32_t numParms,
TR::IlType ** parmTypes)
{
MB_REPLAY("DefineFunction((const char* const)\"%s\",", name);
MB_REPLAY(" (const char* const)\"%s\",", fileName);
MB_REPLAY(" (const char* const)\"%s\",", lineNumber);
MB_REPLAY(" " REPLAY_POINTER_FMT ",", REPLAY_POINTER(entryPoint, name));
MB_REPLAY(" %s,", REPLAY_TYPE(returnType));
MB_REPLAY_NONL(" %d", numParms);

TR_ASSERT_FATAL(_functions.find(name) == _functions.end(), "Function '%s' already defined", name);

for (int32_t p=0;p < numParms;p++)
{
MB_REPLAY_NONL(",\n %s", REPLAY_TYPE(parmTypes[p]));
}
MB_REPLAY(");");

TR::ResolvedMethod *method = new (*_memoryRegion) TR::ResolvedMethod((char*)fileName,
(char*)lineNumber,
(char*)name,
Expand Down
2 changes: 0 additions & 2 deletions compiler/ilgen/MethodBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ class MethodBuilder : public TR::IlBuilder

TR_BitVector * _bytecodeWorklist;
TR_BitVector * _bytecodeHasBeenInWorklist;

std::fstream * _rpCpp;
};

} // namespace OMR
Expand Down
15 changes: 0 additions & 15 deletions jitbuilder/release/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ CXXFLAGS=-g -std=c++0x -O2 -c -fno-rtti -fPIC -I./include/compiler -I./include

.SUFFIXES: .cpp .o

# NOTE: replay purposefully left out of these lists

# These tests may not work on all platforms
ALL_TESTS = \
atomicoperations \
Expand Down Expand Up @@ -246,19 +244,6 @@ RecursiveFib.o: src/RecursiveFib.cpp src/RecursiveFib.hpp
$(CXX) -o $@ $(CXXFLAGS) $<


replay: libjitbuilder.a ReplayMethod.o ReplayMethodConstructor.o ReplayMethodBuildIL.o
$(CXX) -g -fno-rtti -o $@ ReplayMethod.o ReplayMethodConstructor.o ReplayMethodBuilderIL.o -L. -ljitbuilder -ldl

ReplayMethod.o: ReplayMethod.cpp ReplayMethod.hpp
$(CXX) -o $@ $(CXXFLAGS) $<

ReplayMethodConstructor.o: ReplayMethodConstructor.cpp ReplayMethod.hpp
$(CXX) -o $@ $(CXXFLAGS) $<

ReplayMethodBuildIL.o: ReplayMethodBuildIL.cpp ReplayMethod.hpp
$(CXX) -o $@ $(CXXFLAGS) $<


simple : libjitbuilder.a Simple.o
$(CXX) -g -fno-rtti -o $@ Simple.o -L. -ljitbuilder -ldl

Expand Down
63 changes: 0 additions & 63 deletions jitbuilder/release/ReplayMethod.cpp

This file was deleted.

0 comments on commit a9c1f85

Please sign in to comment.