xo-jit: + primitive wrapper (accept+ignore envptr as 1st argument)
This commit is contained in:
parent
d7192c1d97
commit
4c8289336d
4 changed files with 138 additions and 20 deletions
|
|
@ -111,6 +111,16 @@ namespace xo {
|
|||
llvm::Type * codegen_type(TypeDescr td);
|
||||
llvm::Value * codegen_constant(ref::brw<xo::ast::ConstantInterface> expr);
|
||||
llvm::Function * codegen_primitive(ref::brw<xo::ast::PrimitiveInterface> expr);
|
||||
|
||||
/** like @ref codegen_primitive , but create wrapper function that accepts (and discards)
|
||||
* environment pointer as first argument.
|
||||
*
|
||||
* Implementation consists of tail call to natural primitive, that skips the unused
|
||||
* environment pointer
|
||||
**/
|
||||
llvm::Function * codegen_primitive_wrapper(ref::brw<xo::ast::PrimitiveInterface> expr,
|
||||
llvm::IRBuilder<> & ir_builder);
|
||||
|
||||
llvm::Value * codegen_apply(ref::brw<xo::ast::Apply> expr, llvm::IRBuilder<> & ir_builder);
|
||||
/* NOTE: codegen_lambda() needs to be reentrant too.
|
||||
* for example can have a lambda in apply position.
|
||||
|
|
|
|||
|
|
@ -29,9 +29,17 @@ namespace xo {
|
|||
|
||||
/** establish llvm representation for a function type
|
||||
* described by @p fn_td
|
||||
*
|
||||
* @param wrapper_flag If true, create function type for a wrapper
|
||||
* to be associated with a closure.
|
||||
* The wrapper accepts (and ignores) an envapi pointer as first argument.
|
||||
* Necessary to (for example) support function pointers that may refer
|
||||
* to either {primitive functions, functions-requiring-closures},
|
||||
* with choice deferred until runtime
|
||||
**/
|
||||
static llvm::FunctionType * function_td_to_llvm_type(xo::ref::brw<LlvmContext> llvm_cx,
|
||||
TypeDescr fn_td);
|
||||
TypeDescr fn_td,
|
||||
bool wrapper_flag = false);
|
||||
|
||||
/** establish llvm concrete representation for a particular lambda's
|
||||
* runtime local environment:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue