Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Aug 12, 2024
1 parent 1070519 commit 296ee8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compiler/crystal/codegen/codegen.cr
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ module Crystal

result = uninitialized T
LLVM::JITCompiler.new(llvm_mod) do |jit|
func_ptr = LibLLVM.get_function_address(jit, "__evaluate_wrapper")
func = Proc(T*, Nil).new(Pointer(Void).new(func_ptr), Pointer(Void).null)
func_ptr = jit.function_address("__evaluate_wrapper")
func = Proc(T*, Nil).new(func_ptr, Pointer(Void).null)
func.call(pointerof(result))
end
result
Expand Down
4 changes: 4 additions & 0 deletions src/llvm/jit_compiler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class LLVM::JITCompiler
LibLLVM.get_pointer_to_global(self, value)
end

def function_address(name : String) : Void*
Pointer(Void).new(LibLLVM.get_function_address(self, name.check_no_null_byte))
end

def to_unsafe
@unwrap
end
Expand Down

0 comments on commit 296ee8f

Please sign in to comment.