|
60 | 60 | str = globalstring_ptr!(builder, String(fmt), addrspace=2) |
61 | 61 |
|
62 | 62 | # compute argsize |
63 | | - argtypes = LLVM.StructType("os_log_args") |
64 | | - elements!(argtypes, param_types) |
| 63 | + argtypes = LLVM.StructType(param_types) |
65 | 64 | dl = datalayout(mod) |
66 | | - argsize = sizeof(dl, argtypes) |
| 65 | + arg_size = LLVM.ConstantInt(T_int64, sizeof(dl, argtypes)) |
67 | 66 |
|
68 | | - # argbuffer |
69 | 67 | alloc = alloca!(builder, T_pint8) |
70 | 68 | buffer = bitcast!(builder, alloc, T_pint8) |
71 | 69 |
|
|
80 | 78 | os_log_fty = LLVM.FunctionType(T_void, [T_pint8a2, T_pint8a2, T_int32, T_pint8a2, T_pint8, T_int64]) |
81 | 79 | os_log = LLVM.Function(mod, "air.os_log", os_log_fty) |
82 | 80 |
|
83 | | - arg_size = LLVM.ConstantInt(T_int64, Int64(argsize)) |
84 | | - |
85 | 81 | arg_ptr = load!(builder, T_pint8, alloc) |
86 | 82 |
|
87 | 83 | call!(builder, os_log_fty, os_log, [subsystem_str, category_str, log_type, str, arg_ptr, arg_size]) |
|
93 | 89 | ret!(builder) |
94 | 90 | end |
95 | 91 |
|
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...) |
109 | 93 | end |
110 | 94 | end |
111 | 95 |
|
|
0 commit comments