-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of orc2 based jit engine. #477
base: master
Are you sure you want to change the base?
Conversation
alright I feel I have commented everything. Feel free to let me know anything i missed. |
hmmm sees i need to find out what llvm version LLJIT was added. And then rebase to master. I'll get right on that! |
/// execution engine it came from, but adding functions after calling this | ||
/// method *may* invalidate the function pointer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is probably a cool hack to avoid this: accept &mut self
in add_*
methods and store &self
in LLJITFunction. In theory, this should prevent from calling mutable methods, while there is an immutable reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just like you can't store references to Vec
elements and push into it
@@ -184,6 +186,7 @@ impl<'ctx> Module<'ctx> { | |||
Module { | |||
module: Cell::new(module), | |||
owned_by_ee: RefCell::new(None), | |||
owned_by_lljit : RefCell::new(None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should just have one owned by field with an enum in the option?
self.add_global_mappings_impl(mappings.iter().map(|(name,addr)| (to_c_str(name),*addr))) | ||
} | ||
|
||
fn add_global_mapping_impl(&self,name:Cow<'_,CStr>, addr:usize) -> Result<(),LLVMString> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please format these changes
b7ef5f6
to
7684346
Compare
Description
It supports creating the LLJIT engine off a module (consuming said module), adding global mappings off name and global values.
Documentation needs a bit of work (thus starting this as a draft pr) but rather simple implementation and tried to mirror
JITExecutionEngine
though it is constructed differently.Related Issue
#476
How This Has Been Tested
I have tested with a local project referencing the local fork and the samples attached to
LLJITExecutionEngine::get_function
andLLJITExecutionEngine::add_global_mapping
Checklist