Skip to content

Commit

Permalink
Adds support for direct calls of inferred blocks
Browse files Browse the repository at this point in the history
Issue: #17
Issue: #92
  • Loading branch information
0x7CFE committed Jul 17, 2016
1 parent cf7d822 commit 9d39182
Show file tree
Hide file tree
Showing 2 changed files with 264 additions and 112 deletions.
18 changes: 12 additions & 6 deletions include/jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ class MethodCompiler {
};

struct TJITContext {
bool isBlock;

st::ParsedMethod* parsedMethod;
st::ControlGraph* controlGraph;
st::InstructionNode* currentNode;
Expand Down Expand Up @@ -237,6 +239,7 @@ class MethodCompiler {
type::InferContext& context,
bool parse = true
) :
isBlock(false),
currentNode(0),
originMethod(method),
inferContext(context),
Expand Down Expand Up @@ -272,14 +275,16 @@ class MethodCompiler {
TJITBlockContext(
MethodCompiler* compiler,
st::ParsedMethod* method,
st::ParsedBlock* block
)
: TJITContext(compiler, 0, *(type::InferContext*)(0), false), parsedBlock(block)
st::ParsedBlock* block,
st::ControlGraph* blockGraph,
type::InferContext& context
) :
TJITContext(compiler, 0, context, false),
parsedBlock(block)
{
parsedMethod = method;
originMethod = parsedMethod->getOrigin();
controlGraph = new st::ControlGraph(method, block);
controlGraph->buildGraph();
controlGraph = blockGraph;
}

~TJITBlockContext() {
Expand Down Expand Up @@ -332,7 +337,8 @@ class MethodCompiler {
void doPushConstant(TJITContext& jit);

void doPushBlock(TJITContext& jit);
llvm::Function* compileBlock(TJITContext& jit, const std::string& blockFunctionName, st::ParsedBlock* parsedBlock);
llvm::Function* compileBlock(const std::string& blockFunctionName, st::ParsedBlock* parsedBlock, type::InferContext& blockContext);
llvm::Function* compileInvokedBlock(TJITContext& jit);

void doAssignTemporary(TJITContext& jit);
void doAssignInstance(TJITContext& jit);
Expand Down
Loading

0 comments on commit 9d39182

Please sign in to comment.