Skip to content

Commit 9d0ad6c

Browse files
committed
remove wrapper
1 parent 259497d commit 9d0ad6c

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/device/intrinsics/output.jl

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ end
6060
str = globalstring_ptr!(builder, String(fmt), addrspace=2)
6161

6262
# compute argsize
63-
argtypes = LLVM.StructType("os_log_args")
64-
elements!(argtypes, param_types)
63+
argtypes = LLVM.StructType(param_types)
6564
dl = datalayout(mod)
66-
argsize = sizeof(dl, argtypes)
65+
arg_size = LLVM.ConstantInt(T_int64, sizeof(dl, argtypes))
6766

68-
# argbuffer
6967
alloc = alloca!(builder, T_pint8)
7068
buffer = bitcast!(builder, alloc, T_pint8)
7169

@@ -80,8 +78,6 @@ end
8078
os_log_fty = LLVM.FunctionType(T_void, [T_pint8a2, T_pint8a2, T_int32, T_pint8a2, T_pint8, T_int64])
8179
os_log = LLVM.Function(mod, "air.os_log", os_log_fty)
8280

83-
arg_size = LLVM.ConstantInt(T_int64, Int64(argsize))
84-
8581
arg_ptr = load!(builder, T_pint8, alloc)
8682

8783
call!(builder, os_log_fty, os_log, [subsystem_str, category_str, log_type, str, arg_ptr, arg_size])
@@ -93,19 +89,7 @@ end
9389
ret!(builder)
9490
end
9591

96-
97-
wrapper_f, wrapper_ft = create_function(T_void, param_types)
98-
99-
@dispose builder=IRBuilder() begin
100-
entry = BasicBlock(wrapper_f, "entry")
101-
position!(builder, entry)
102-
103-
call!(builder, llvm_ft, llvm_f, collect(parameters(wrapper_f)))
104-
105-
ret!(builder)
106-
end
107-
108-
call_function(wrapper_f, Nothing, Tuple{arg_types...}, arg_exprs...)
92+
call_function(llvm_f, Nothing, Tuple{arg_types...}, arg_exprs...)
10993
end
11094
end
11195

0 commit comments

Comments
 (0)