Skip to content

Commit

Permalink
Add interpreter emulator for ECS in inliner
Browse files Browse the repository at this point in the history
This change adds the infrastructure to emulate the interpreter
execution during estimate code size of target in inliner.

Also the loop looking for callsites in ECS is refactored and moved
to `findAndCreateCallsitesFromBytecodes`. ECS will be changed to call
this function in a following commit.

Signed-off-by: Yi Zhang <[email protected]>
  • Loading branch information
Yi Zhang committed Dec 4, 2019
1 parent 9d2b322 commit 2fb42c4
Show file tree
Hide file tree
Showing 8 changed files with 1,248 additions and 96 deletions.
1 change: 1 addition & 0 deletions runtime/compiler/build/files/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ JIT_PRODUCT_SOURCE_FILES+=\
compiler/optimizer/InterProceduralAnalyzer.cpp \
compiler/optimizer/J9EstimateCodeSize.cpp \
compiler/optimizer/J9Inliner.cpp \
compiler/optimizer/InterpreterEmulator.cpp \
compiler/ras/DebugExt.cpp \
compiler/ras/DebugExtSegmentProvider.cpp \
compiler/ras/HashTable.cpp \
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/optimizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ j9jit_files(
optimizer/InterProceduralAnalyzer.cpp
optimizer/J9CFGSimplifier.cpp
optimizer/J9EstimateCodeSize.cpp
optimizer/InterpreterEmulator.cpp
optimizer/J9Inliner.cpp
optimizer/J9LocalCSE.cpp
optimizer/J9OptimizationManager.cpp
Expand Down
8 changes: 0 additions & 8 deletions runtime/compiler/optimizer/EstimateCodeSize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ TR_EstimateCodeSize::release(TR_EstimateCodeSize *estimator)
comp->fej9()->releaseCodeEstimator(comp, estimator);
}


void
TR_EstimateCodeSize::markIsCold(flags8_t * flags, int32_t i)
{
_isLeaf = false;
flags[i].set(isCold);
}

bool
TR_EstimateCodeSize::calculateCodeSize(TR_CallTarget *calltarget, TR_CallStack *callStack, bool recurseDown)
{
Expand Down
8 changes: 5 additions & 3 deletions runtime/compiler/optimizer/EstimateCodeSize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ class TR_EstimateCodeSize
bool isLeaf() { return _isLeaf; }

int32_t getNumOfEstimatedCalls() { return _numOfEstimatedCalls; }
/*
* \brief
* tell whether this callsite has inlineable target
*/
bool isInlineable(TR_CallStack *, TR_CallSite *callsite);

TR::Compilation *comp() { return _inliner->comp(); }
TR_InlinerTracer *tracer() { return _tracer; }
Expand All @@ -93,9 +98,6 @@ class TR_EstimateCodeSize

virtual bool estimateCodeSize(TR_CallTarget *, TR_CallStack * , bool recurseDown = true) = 0;

bool isInlineable(TR_CallStack *, TR_CallSite *callsite);

void markIsCold(flags8_t * flags, int32_t i);

bool returnCleanup(int32_t); // common tasks requiring completion before returning from estimation

Expand Down
Loading

0 comments on commit 2fb42c4

Please sign in to comment.