Skip to content

Commit

Permalink
Provide System linkage implementations of entry point APIs
Browse files Browse the repository at this point in the history
Implement `entryPointFromCompiledMethod` and `entryPointFromInterpretedMethod`
for System linkage classes on RISC-V.

Signed-off-by: Daryl Maier <maier@ca.ibm.com>
  • Loading branch information
0xdaryl committed Oct 8, 2020
1 parent 4535ff3 commit 1cfbdb8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
10 changes: 10 additions & 0 deletions compiler/riscv/codegen/RVSystemLinkage.cpp
Expand Up @@ -879,3 +879,13 @@ TR::Register *TR::RVSystemLinkage::buildDispatch(TR::Node *callNode)
return retReg;
}

intptr_t TR::RVSystemLinkage::entryPointFromCompiledMethod()
{
return reinterpret_cast<intptr_t>(cg()->getCodeStart());
}

intptr_t TR::RVSystemLinkage::entryPointFromInterpretedMethod()
{
return reinterpret_cast<intptr_t>(cg()->getCodeStart());
}

28 changes: 28 additions & 0 deletions compiler/riscv/codegen/RVSystemLinkage.hpp
Expand Up @@ -130,6 +130,34 @@ class RVSystemLinkage : public TR::Linkage
return buildDispatch(callNode);
}

/**
* @brief Provides the entry point in a method to use when that method is invoked
* from a method compiled with the same linkage.
*
* @details
* When asked on the method currently being compiled, this API will return 0 if
* asked before code memory has been allocated.
*
* The compiled method entry point may be the same as the interpreter entry point.
*
* @return The entry point for compiled methods to use; 0 if the entry point is unknown
*/
virtual intptr_t entryPointFromCompiledMethod();

/**
* @brief Provides the entry point in a method to use when that method is invoked
* from an interpreter using the same linkage.
*
* @details
* When asked on the method currently being compiled, this API will return 0 if
* asked before code memory has been allocated.
*
* The compiled method entry point may be the same as the interpreter entry point.
*
* @return The entry point for interpreted methods to use; 0 if the entry point is unknown
*/
virtual intptr_t entryPointFromInterpretedMethod();

};

}
Expand Down

0 comments on commit 1cfbdb8

Please sign in to comment.