Skip to content

Commit 72d2e66

Browse files
Fixed a couple correctness issues
1 parent a3bb809 commit 72d2e66

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/execution_engine.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl ExecutionEngine {
9191
///
9292
/// assert_eq!(result, 128.);
9393
/// ```
94-
pub fn add_global_mapping(&self, value: &AnyValue, addr: usize) {
94+
pub fn add_global_mapping(&mut self, value: &AnyValue, addr: usize) {
9595
unsafe {
9696
LLVMAddGlobalMapping(*self.execution_engine, value.as_value_ref(), addr as *mut _)
9797
}
@@ -114,7 +114,7 @@ impl ExecutionEngine {
114114
///
115115
/// assert!(ee.add_module(&module).is_err());
116116
/// ```
117-
pub fn add_module(&self, module: &Module) -> Result<(), ()> {
117+
pub fn add_module(&mut self, module: &Module) -> Result<(), ()> {
118118
unsafe {
119119
LLVMAddModule(*self.execution_engine, module.module.get())
120120
}
@@ -128,7 +128,7 @@ impl ExecutionEngine {
128128
Ok(())
129129
}
130130

131-
pub fn remove_module(&self, module: &Module) -> Result<(), String> {
131+
pub fn remove_module(&mut self, module: &Module) -> Result<(), String> {
132132
match *module.owned_by_ee.borrow() {
133133
Some(ref ee) if *ee.execution_engine != *self.execution_engine => return Err("Module is not owned by this Execution Engine".into()),
134134
None => return Err("Module is not owned by an Execution Engine".into()),
@@ -169,7 +169,7 @@ impl ExecutionEngine {
169169
/// "C"` functions can be retrieved via the `get_function()` method. If you
170170
/// get funny type errors then it's probably because you have specified the
171171
/// wrong calling convention or forgotten to specify the retrieved function
172-
/// is `unsafe`.
172+
/// as `unsafe`.
173173
///
174174
/// # Examples
175175
///
@@ -287,10 +287,10 @@ impl ExecutionEngine {
287287

288288
pub fn run_function_as_main(&self, function: &FunctionValue) {
289289
let args = vec![]; // TODO: Support argc, argv
290-
let env_p = vec![]; // REVIEW: No clue what this is
290+
let environment_variables = vec![];
291291

292292
unsafe {
293-
LLVMRunFunctionAsMain(*self.execution_engine, function.as_value_ref(), args.len() as u32, args.as_ptr(), env_p.as_ptr()); // REVIEW: usize to u32 cast ok??
293+
LLVMRunFunctionAsMain(*self.execution_engine, function.as_value_ref(), args.len() as u32, args.as_ptr(), environment_variables.as_ptr()); // REVIEW: usize to u32 cast ok??
294294
}
295295
}
296296

0 commit comments

Comments
 (0)