cStubs.scala 115 KB
Newer Older
Kunshan Wang's avatar
Kunshan Wang committed
1 2
package uvm.refimpl.nat

Kunshan Wang's avatar
Kunshan Wang committed
3 4 5 6 7
import com.kenai.jffi.CallingConvention
import com.kenai.jffi.Closure
import com.kenai.jffi.Closure.Buffer
import com.kenai.jffi.{ Type => JType }
import NativeSupport._
8 9
import PlatformConstants._
import uvm.refimpl._
Kunshan Wang's avatar
Kunshan Wang committed
10 11
import uvm.ssavariables.{BinOptr, CmpOptr, ConvOptr, MemoryOrder, AtomicRMWOptr}
import uvm.ir.irbuilder.DestKind
12 13 14 15

import uvm.refimpl.MicroVM

object CDefs {
16
  import CDefsHelperFunctions._
Kunshan Wang's avatar
Kunshan Wang committed
17
  import NativeClientSupport._
Kunshan Wang's avatar
Kunshan Wang committed
18

19
  // generated from migrate_scripts/muapitocstubs.py
20
  /// GEN:BEGIN:STUBS
Kunshan Wang's avatar
Kunshan Wang committed
21
val MUVM__NEW_CONTEXT = exposedMethod("MuVM.new_context", JType.POINTER, Array(JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
22
val _raw_mvm = _jffiBuffer.getAddress(0)
23 24
val mvm = getMicroVM(_raw_mvm)
val _RV = mvm.newContext()
Kunshan Wang's avatar
Kunshan Wang committed
25 26
val _RV_FAK = exposeMuCtx(_RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
27
}
Kunshan Wang's avatar
Kunshan Wang committed
28
val MUVM__ID_OF = exposedMethod("MuVM.id_of", JType.UINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
29 30
val _raw_mvm = _jffiBuffer.getAddress(0)
val _raw_name = _jffiBuffer.getAddress(1)
31 32 33
val mvm = getMicroVM(_raw_mvm)
val name = readCString(_raw_name)
val _RV = mvm.idOf(name)
Kunshan Wang's avatar
Kunshan Wang committed
34
_jffiBuffer.setIntReturn(_RV)
35
}
Kunshan Wang's avatar
Kunshan Wang committed
36
val MUVM__NAME_OF = exposedMethod("MuVM.name_of", JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
37 38
val _raw_mvm = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
39
val mvm = getMicroVM(_raw_mvm)
Kunshan Wang's avatar
Kunshan Wang committed
40
val id = _raw_id
41
val _RV = mvm.nameOf(id)
Kunshan Wang's avatar
Kunshan Wang committed
42 43
val _RV_FAK = exposeString(_RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
44
}
Kunshan Wang's avatar
Kunshan Wang committed
45
val MUVM__SET_TRAP_HANDLER = exposedMethod("MuVM.set_trap_handler", JType.VOID, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
46 47 48
val _raw_mvm = _jffiBuffer.getAddress(0)
val _raw_trap_handler = _jffiBuffer.getAddress(1)
val _raw_userdata = _jffiBuffer.getAddress(2)
49
val mvm = getMicroVM(_raw_mvm)
Kunshan Wang's avatar
Kunshan Wang committed
50 51
val trap_handler = _raw_trap_handler
val userdata = _raw_userdata
52
val _RV = mvm.setTrapHandler(trap_handler, userdata)
53
}
Kunshan Wang's avatar
Kunshan Wang committed
54 55 56 57 58 59 60 61 62 63
val MUVM__MAKE_BOOT_IMAGE = exposedMethod("MuVM.make_boot_image", JType.VOID, Array(JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_mvm = _jffiBuffer.getAddress(0)
val _raw_whitelist = _jffiBuffer.getAddress(1)
val _raw_whitelist_sz = _jffiBuffer.getAddress(2)
val _raw_output_file = _jffiBuffer.getAddress(3)
val mvm = getMicroVM(_raw_mvm)
val whitelist = readIntArray(_raw_whitelist, _raw_whitelist_sz)
val output_file = readCString(_raw_output_file)
val _RV = mvm.makeBootImage(whitelist, output_file)
}
64 65 66 67 68
val MUVM__EXECUTE = exposedMethod("MuVM.execute", JType.VOID, Array(JType.POINTER)) { _jffiBuffer =>
val _raw_mvm = _jffiBuffer.getAddress(0)
val mvm = getMicroVM(_raw_mvm)
val _RV = mvm.execute()
}
Kunshan Wang's avatar
Kunshan Wang committed
69
val MUVM__GET_MU_ERROR_PTR = exposedMethod("MuVM.get_mu_error_ptr", JType.POINTER, Array(JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
70
val _raw_mvm = _jffiBuffer.getAddress(0)
71 72
val mvm = getMicroVM(_raw_mvm)
val _RV = mvm.getMuErrorPtr()
Kunshan Wang's avatar
Kunshan Wang committed
73
_jffiBuffer.setAddressReturn(_RV)
74
}
Kunshan Wang's avatar
Kunshan Wang committed
75
val stubsOfMuVM = new Array[Word](7)
76 77 78 79
stubsOfMuVM(0) = MUVM__NEW_CONTEXT.address
stubsOfMuVM(1) = MUVM__ID_OF.address
stubsOfMuVM(2) = MUVM__NAME_OF.address
stubsOfMuVM(3) = MUVM__SET_TRAP_HANDLER.address
80 81
stubsOfMuVM(4) = MUVM__MAKE_BOOT_IMAGE.address
stubsOfMuVM(5) = MUVM__EXECUTE.address
Kunshan Wang's avatar
Kunshan Wang committed
82
stubsOfMuVM(6) = MUVM__GET_MU_ERROR_PTR.address
Kunshan Wang's avatar
Kunshan Wang committed
83
val MUCTX__ID_OF = exposedMethod("MuCtx.id_of", JType.UINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
84 85 86
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_name = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
87 88
val name = readCString(_raw_name)
val _RV = ctx.idOf(name)
Kunshan Wang's avatar
Kunshan Wang committed
89
_jffiBuffer.setIntReturn(_RV)
90
}
Kunshan Wang's avatar
Kunshan Wang committed
91
val MUCTX__NAME_OF = exposedMethod("MuCtx.name_of", JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
92 93 94 95
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
val ctx = getMuCtx(_raw_ctx)
val id = _raw_id
96
val _RV = ctx.nameOf(id)
Kunshan Wang's avatar
Kunshan Wang committed
97 98
val _RV_FAK = exposeString(_RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
99
}
Kunshan Wang's avatar
Kunshan Wang committed
100
val MUCTX__CLOSE_CONTEXT = exposedMethod("MuCtx.close_context", JType.VOID, Array(JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
101 102
val _raw_ctx = _jffiBuffer.getAddress(0)
val ctx = getMuCtx(_raw_ctx)
103
val _RV = ctx.closeContext()
104
}
105
val MUCTX__LOAD_BUNDLE = exposedMethod("MuCtx.load_bundle", JType.VOID, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
106 107
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_buf = _jffiBuffer.getAddress(1)
108
val _raw_sz = _jffiBuffer.getAddress(2)
Kunshan Wang's avatar
Kunshan Wang committed
109
val ctx = getMuCtx(_raw_ctx)
110 111
val buf = readCharArray(_raw_buf, _raw_sz)
val _RV = ctx.loadBundle(buf)
112
}
113
val MUCTX__LOAD_HAIL = exposedMethod("MuCtx.load_hail", JType.VOID, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
114 115
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_buf = _jffiBuffer.getAddress(1)
116
val _raw_sz = _jffiBuffer.getAddress(2)
Kunshan Wang's avatar
Kunshan Wang committed
117
val ctx = getMuCtx(_raw_ctx)
118 119
val buf = readCharArray(_raw_buf, _raw_sz)
val _RV = ctx.loadHail(buf)
120
}
Kunshan Wang's avatar
Kunshan Wang committed
121
val MUCTX__HANDLE_FROM_SINT8 = exposedMethod("MuCtx.handle_from_sint8", JType.POINTER, Array(JType.POINTER, JType.SINT8, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
122 123 124 125 126 127
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getByte(1)
val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
128
val _RV = ctx.handleFromSInt8(num, len)
Kunshan Wang's avatar
Kunshan Wang committed
129 130
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
131
}
Kunshan Wang's avatar
Kunshan Wang committed
132
val MUCTX__HANDLE_FROM_UINT8 = exposedMethod("MuCtx.handle_from_uint8", JType.POINTER, Array(JType.POINTER, JType.UINT8, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
133 134 135 136 137 138
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getByte(1)
val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
139
val _RV = ctx.handleFromUInt8(num, len)
Kunshan Wang's avatar
Kunshan Wang committed
140 141
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
142
}
Kunshan Wang's avatar
Kunshan Wang committed
143
val MUCTX__HANDLE_FROM_SINT16 = exposedMethod("MuCtx.handle_from_sint16", JType.POINTER, Array(JType.POINTER, JType.SINT16, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
144 145 146 147 148 149
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getShort(1)
val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
150
val _RV = ctx.handleFromSInt16(num, len)
Kunshan Wang's avatar
Kunshan Wang committed
151 152
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
153
}
Kunshan Wang's avatar
Kunshan Wang committed
154
val MUCTX__HANDLE_FROM_UINT16 = exposedMethod("MuCtx.handle_from_uint16", JType.POINTER, Array(JType.POINTER, JType.UINT16, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
155 156 157 158 159 160
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getShort(1)
val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
161
val _RV = ctx.handleFromUInt16(num, len)
Kunshan Wang's avatar
Kunshan Wang committed
162 163
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
164
}
Kunshan Wang's avatar
Kunshan Wang committed
165
val MUCTX__HANDLE_FROM_SINT32 = exposedMethod("MuCtx.handle_from_sint32", JType.POINTER, Array(JType.POINTER, JType.SINT32, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
166 167 168 169 170 171
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getInt(1)
val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
172
val _RV = ctx.handleFromSInt32(num, len)
Kunshan Wang's avatar
Kunshan Wang committed
173 174
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
175
}
Kunshan Wang's avatar
Kunshan Wang committed
176
val MUCTX__HANDLE_FROM_UINT32 = exposedMethod("MuCtx.handle_from_uint32", JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
177 178 179 180 181 182
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getInt(1)
val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
183
val _RV = ctx.handleFromUInt32(num, len)
Kunshan Wang's avatar
Kunshan Wang committed
184 185
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
186
}
Kunshan Wang's avatar
Kunshan Wang committed
187
val MUCTX__HANDLE_FROM_SINT64 = exposedMethod("MuCtx.handle_from_sint64", JType.POINTER, Array(JType.POINTER, JType.SINT64, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
188 189 190 191 192 193
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getLong(1)
val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
194
val _RV = ctx.handleFromSInt64(num, len)
Kunshan Wang's avatar
Kunshan Wang committed
195 196
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
197
}
Kunshan Wang's avatar
Kunshan Wang committed
198
val MUCTX__HANDLE_FROM_UINT64 = exposedMethod("MuCtx.handle_from_uint64", JType.POINTER, Array(JType.POINTER, JType.UINT64, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
199 200 201 202 203 204
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getLong(1)
val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
205
val _RV = ctx.handleFromUInt64(num, len)
Kunshan Wang's avatar
Kunshan Wang committed
206 207
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
208
}
209
val MUCTX__HANDLE_FROM_UINT64S = exposedMethod("MuCtx.handle_from_uint64s", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.POINTER, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
210 211
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_nums = _jffiBuffer.getAddress(1)
212
val _raw_nnums = _jffiBuffer.getAddress(2)
Kunshan Wang's avatar
Kunshan Wang committed
213 214 215 216
val _raw_len = _jffiBuffer.getInt(3)
val ctx = getMuCtx(_raw_ctx)
val nums = readLongArray(_raw_nums, _raw_nnums)
val len = _raw_len
217
val _RV = ctx.handleFromUInt64s(nums, len)
Kunshan Wang's avatar
Kunshan Wang committed
218 219
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
220
}
Kunshan Wang's avatar
Kunshan Wang committed
221
val MUCTX__HANDLE_FROM_FLOAT = exposedMethod("MuCtx.handle_from_float", JType.POINTER, Array(JType.POINTER, JType.FLOAT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
222 223 224 225
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getFloat(1)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
226
val _RV = ctx.handleFromFloat(num)
Kunshan Wang's avatar
Kunshan Wang committed
227 228
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
229
}
Kunshan Wang's avatar
Kunshan Wang committed
230
val MUCTX__HANDLE_FROM_DOUBLE = exposedMethod("MuCtx.handle_from_double", JType.POINTER, Array(JType.POINTER, JType.DOUBLE)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
231 232 233 234
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getDouble(1)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
235
val _RV = ctx.handleFromDouble(num)
Kunshan Wang's avatar
Kunshan Wang committed
236 237
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
238
}
Kunshan Wang's avatar
Kunshan Wang committed
239
val MUCTX__HANDLE_FROM_PTR = exposedMethod("MuCtx.handle_from_ptr", JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
240 241 242 243 244 245
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_mu_type = _jffiBuffer.getInt(1)
val _raw_ptr = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
val mu_type = _raw_mu_type
val ptr = _raw_ptr
246
val _RV = ctx.handleFromPtr(mu_type, ptr)
Kunshan Wang's avatar
Kunshan Wang committed
247 248
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
249
}
Kunshan Wang's avatar
Kunshan Wang committed
250
val MUCTX__HANDLE_FROM_FP = exposedMethod("MuCtx.handle_from_fp", JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
251 252 253 254 255 256
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_mu_type = _jffiBuffer.getInt(1)
val _raw_fp = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
val mu_type = _raw_mu_type
val fp = _raw_fp
257
val _RV = ctx.handleFromFP(mu_type, fp)
Kunshan Wang's avatar
Kunshan Wang committed
258 259
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
260
}
Kunshan Wang's avatar
Kunshan Wang committed
261
val MUCTX__HANDLE_TO_SINT8 = exposedMethod("MuCtx.handle_to_sint8", JType.SINT8, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
262 263 264
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
265
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIntValue]
266
val _RV = ctx.handleToSInt8(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
267
_jffiBuffer.setByteReturn(_RV)
268
}
Kunshan Wang's avatar
Kunshan Wang committed
269
val MUCTX__HANDLE_TO_UINT8 = exposedMethod("MuCtx.handle_to_uint8", JType.UINT8, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
270 271 272
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
273
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIntValue]
274
val _RV = ctx.handleToUInt8(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
275
_jffiBuffer.setByteReturn(_RV)
276
}
Kunshan Wang's avatar
Kunshan Wang committed
277
val MUCTX__HANDLE_TO_SINT16 = exposedMethod("MuCtx.handle_to_sint16", JType.SINT16, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
278 279 280
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
281
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIntValue]
282
val _RV = ctx.handleToSInt16(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
283
_jffiBuffer.setShortReturn(_RV)
284
}
Kunshan Wang's avatar
Kunshan Wang committed
285
val MUCTX__HANDLE_TO_UINT16 = exposedMethod("MuCtx.handle_to_uint16", JType.UINT16, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
286 287 288
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
289
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIntValue]
290
val _RV = ctx.handleToUInt16(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
291
_jffiBuffer.setShortReturn(_RV)
292
}
Kunshan Wang's avatar
Kunshan Wang committed
293
val MUCTX__HANDLE_TO_SINT32 = exposedMethod("MuCtx.handle_to_sint32", JType.SINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
294 295 296
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
297
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIntValue]
298
val _RV = ctx.handleToSInt32(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
299
_jffiBuffer.setIntReturn(_RV)
300
}
Kunshan Wang's avatar
Kunshan Wang committed
301
val MUCTX__HANDLE_TO_UINT32 = exposedMethod("MuCtx.handle_to_uint32", JType.UINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
302 303 304
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
305
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIntValue]
306
val _RV = ctx.handleToUInt32(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
307
_jffiBuffer.setIntReturn(_RV)
308
}
Kunshan Wang's avatar
Kunshan Wang committed
309
val MUCTX__HANDLE_TO_SINT64 = exposedMethod("MuCtx.handle_to_sint64", JType.SINT64, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
310 311 312
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
313
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIntValue]
314
val _RV = ctx.handleToSInt64(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
315
_jffiBuffer.setLongReturn(_RV)
316
}
Kunshan Wang's avatar
Kunshan Wang committed
317
val MUCTX__HANDLE_TO_UINT64 = exposedMethod("MuCtx.handle_to_uint64", JType.UINT64, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
318 319 320
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
321
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIntValue]
322
val _RV = ctx.handleToUInt64(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
323
_jffiBuffer.setLongReturn(_RV)
324
}
Kunshan Wang's avatar
Kunshan Wang committed
325
val MUCTX__HANDLE_TO_FLOAT = exposedMethod("MuCtx.handle_to_float", JType.FLOAT, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
326 327 328
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
329
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuFloatValue]
330
val _RV = ctx.handleToFloat(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
331
_jffiBuffer.setFloatReturn(_RV)
332
}
Kunshan Wang's avatar
Kunshan Wang committed
333
val MUCTX__HANDLE_TO_DOUBLE = exposedMethod("MuCtx.handle_to_double", JType.DOUBLE, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
334 335 336
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
337
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuDoubleValue]
338
val _RV = ctx.handleToDouble(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
339
_jffiBuffer.setDoubleReturn(_RV)
340
}
Kunshan Wang's avatar
Kunshan Wang committed
341
val MUCTX__HANDLE_TO_PTR = exposedMethod("MuCtx.handle_to_ptr", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
342 343 344
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
345
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuUPtrValue]
346
val _RV = ctx.handleToPtr(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
347
_jffiBuffer.setAddressReturn(_RV)
348
}
Kunshan Wang's avatar
Kunshan Wang committed
349
val MUCTX__HANDLE_TO_FP = exposedMethod("MuCtx.handle_to_fp", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
350 351 352
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
353
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuUFPValue]
354
val _RV = ctx.handleToFP(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
355
_jffiBuffer.setAddressReturn(_RV)
356
}
Kunshan Wang's avatar
Kunshan Wang committed
357
val MUCTX__HANDLE_FROM_CONST = exposedMethod("MuCtx.handle_from_const", JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
358 359 360 361
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
val ctx = getMuCtx(_raw_ctx)
val id = _raw_id
362
val _RV = ctx.handleFromConst(id)
Kunshan Wang's avatar
Kunshan Wang committed
363 364
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
365
}
Kunshan Wang's avatar
Kunshan Wang committed
366
val MUCTX__HANDLE_FROM_GLOBAL = exposedMethod("MuCtx.handle_from_global", JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
367 368 369 370
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
val ctx = getMuCtx(_raw_ctx)
val id = _raw_id
371
val _RV = ctx.handleFromGlobal(id)
Kunshan Wang's avatar
Kunshan Wang committed
372 373
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
374
}
Kunshan Wang's avatar
Kunshan Wang committed
375
val MUCTX__HANDLE_FROM_FUNC = exposedMethod("MuCtx.handle_from_func", JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
376 377 378 379
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
val ctx = getMuCtx(_raw_ctx)
val id = _raw_id
380
val _RV = ctx.handleFromFunc(id)
Kunshan Wang's avatar
Kunshan Wang committed
381 382
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
383
}
Kunshan Wang's avatar
Kunshan Wang committed
384
val MUCTX__HANDLE_FROM_EXPOSE = exposedMethod("MuCtx.handle_from_expose", JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
385 386 387 388
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
val ctx = getMuCtx(_raw_ctx)
val id = _raw_id
389
val _RV = ctx.handleFromExpose(id)
Kunshan Wang's avatar
Kunshan Wang committed
390 391
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
392
}
Kunshan Wang's avatar
Kunshan Wang committed
393
val MUCTX__DELETE_VALUE = exposedMethod("MuCtx.delete_value", JType.VOID, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
394 395 396
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
397
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuValue]
398
val _RV = ctx.deleteValue(opnd)
399
}
Kunshan Wang's avatar
Kunshan Wang committed
400
val MUCTX__REF_EQ = exposedMethod("MuCtx.ref_eq", JType.SINT, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
401 402 403 404
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_lhs = _jffiBuffer.getAddress(1)
val _raw_rhs = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
405 406
val lhs = getMuValueNotNull(_raw_lhs).asInstanceOf[MuGenRefValue]
val rhs = getMuValueNotNull(_raw_rhs).asInstanceOf[MuGenRefValue]
407
val _RV = ctx.refEq(lhs, rhs)
408 409
val _RV_FAK = booleanToInt(_RV)
_jffiBuffer.setIntReturn(_RV_FAK)
410
}
Kunshan Wang's avatar
Kunshan Wang committed
411
val MUCTX__REF_ULT = exposedMethod("MuCtx.ref_ult", JType.SINT, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
412 413 414 415
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_lhs = _jffiBuffer.getAddress(1)
val _raw_rhs = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
416 417
val lhs = getMuValueNotNull(_raw_lhs).asInstanceOf[MuIRefValue]
val rhs = getMuValueNotNull(_raw_rhs).asInstanceOf[MuIRefValue]
418
val _RV = ctx.refUlt(lhs, rhs)
419 420
val _RV_FAK = booleanToInt(_RV)
_jffiBuffer.setIntReturn(_RV_FAK)
421
}
Kunshan Wang's avatar
Kunshan Wang committed
422
val MUCTX__EXTRACT_VALUE = exposedMethod("MuCtx.extract_value", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
423 424 425 426
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_str = _jffiBuffer.getAddress(1)
val _raw_index = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
427
val str = getMuValueNotNull(_raw_str).asInstanceOf[MuStructValue]
Kunshan Wang's avatar
Kunshan Wang committed
428
val index = _raw_index
429
val _RV = ctx.extractValue(str, index)
Kunshan Wang's avatar
Kunshan Wang committed
430 431
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
432
}
Kunshan Wang's avatar
Kunshan Wang committed
433
val MUCTX__INSERT_VALUE = exposedMethod("MuCtx.insert_value", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.SINT, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
434 435 436 437 438
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_str = _jffiBuffer.getAddress(1)
val _raw_index = _jffiBuffer.getInt(2)
val _raw_newval = _jffiBuffer.getAddress(3)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
439
val str = getMuValueNotNull(_raw_str).asInstanceOf[MuStructValue]
Kunshan Wang's avatar
Kunshan Wang committed
440
val index = _raw_index
Kunshan Wang's avatar
Kunshan Wang committed
441
val newval = getMuValueNotNull(_raw_newval).asInstanceOf[MuValue]
442
val _RV = ctx.insertValue(str, index, newval)
Kunshan Wang's avatar
Kunshan Wang committed
443 444
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
445
}
Kunshan Wang's avatar
Kunshan Wang committed
446
val MUCTX__EXTRACT_ELEMENT = exposedMethod("MuCtx.extract_element", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
447 448 449 450
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_str = _jffiBuffer.getAddress(1)
val _raw_index = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
451 452
val str = getMuValueNotNull(_raw_str).asInstanceOf[MuSeqValue]
val index = getMuValueNotNull(_raw_index).asInstanceOf[MuIntValue]
453
val _RV = ctx.extractElement(str, index)
Kunshan Wang's avatar
Kunshan Wang committed
454 455
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
456
}
Kunshan Wang's avatar
Kunshan Wang committed
457
val MUCTX__INSERT_ELEMENT = exposedMethod("MuCtx.insert_element", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
458 459 460 461 462
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_str = _jffiBuffer.getAddress(1)
val _raw_index = _jffiBuffer.getAddress(2)
val _raw_newval = _jffiBuffer.getAddress(3)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
463 464 465
val str = getMuValueNotNull(_raw_str).asInstanceOf[MuSeqValue]
val index = getMuValueNotNull(_raw_index).asInstanceOf[MuIntValue]
val newval = getMuValueNotNull(_raw_newval).asInstanceOf[MuValue]
466
val _RV = ctx.insertElement(str, index, newval)
Kunshan Wang's avatar
Kunshan Wang committed
467 468
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
469
}
Kunshan Wang's avatar
Kunshan Wang committed
470
val MUCTX__NEW_FIXED = exposedMethod("MuCtx.new_fixed", JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
471 472 473 474
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_mu_type = _jffiBuffer.getInt(1)
val ctx = getMuCtx(_raw_ctx)
val mu_type = _raw_mu_type
475
val _RV = ctx.newFixed(mu_type)
Kunshan Wang's avatar
Kunshan Wang committed
476 477
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
478
}
Kunshan Wang's avatar
Kunshan Wang committed
479
val MUCTX__NEW_HYBRID = exposedMethod("MuCtx.new_hybrid", JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
480 481 482 483 484
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_mu_type = _jffiBuffer.getInt(1)
val _raw_length = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
val mu_type = _raw_mu_type
Kunshan Wang's avatar
Kunshan Wang committed
485
val length = getMuValueNotNull(_raw_length).asInstanceOf[MuIntValue]
486
val _RV = ctx.newHybrid(mu_type, length)
Kunshan Wang's avatar
Kunshan Wang committed
487 488
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
489
}
Kunshan Wang's avatar
Kunshan Wang committed
490
val MUCTX__REFCAST = exposedMethod("MuCtx.refcast", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
491 492 493 494
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val _raw_new_type = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
495
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuGenRefValue]
Kunshan Wang's avatar
Kunshan Wang committed
496
val new_type = _raw_new_type
497
val _RV = ctx.refcast(opnd, new_type)
Kunshan Wang's avatar
Kunshan Wang committed
498 499
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
500
}
Kunshan Wang's avatar
Kunshan Wang committed
501
val MUCTX__GET_IREF = exposedMethod("MuCtx.get_iref", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
502 503 504
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
505
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuRefValue]
506
val _RV = ctx.getIRef(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
507 508
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
509
}
Kunshan Wang's avatar
Kunshan Wang committed
510
val MUCTX__GET_FIELD_IREF = exposedMethod("MuCtx.get_field_iref", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.SINT)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
511 512 513 514
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val _raw_field = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
515
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIRefValue]
Kunshan Wang's avatar
Kunshan Wang committed
516
val field = _raw_field
517
val _RV = ctx.getFieldIRef(opnd, field)
Kunshan Wang's avatar
Kunshan Wang committed
518 519
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
520
}
Kunshan Wang's avatar
Kunshan Wang committed
521
val MUCTX__GET_ELEM_IREF = exposedMethod("MuCtx.get_elem_iref", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
522 523 524 525
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val _raw_index = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
526 527
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIRefValue]
val index = getMuValueNotNull(_raw_index).asInstanceOf[MuIntValue]
528
val _RV = ctx.getElemIRef(opnd, index)
Kunshan Wang's avatar
Kunshan Wang committed
529 530
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
531
}
Kunshan Wang's avatar
Kunshan Wang committed
532
val MUCTX__SHIFT_IREF = exposedMethod("MuCtx.shift_iref", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
533 534 535 536
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val _raw_offset = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
537 538
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIRefValue]
val offset = getMuValueNotNull(_raw_offset).asInstanceOf[MuIntValue]
539
val _RV = ctx.shiftIRef(opnd, offset)
Kunshan Wang's avatar
Kunshan Wang committed
540 541
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
542
}
Kunshan Wang's avatar
Kunshan Wang committed
543
val MUCTX__GET_VAR_PART_IREF = exposedMethod("MuCtx.get_var_part_iref", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
544 545 546
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
547
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuIRefValue]
548
val _RV = ctx.getVarPartIRef(opnd)
Kunshan Wang's avatar
Kunshan Wang committed
549 550
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
551
}
Kunshan Wang's avatar
Kunshan Wang committed
552
val MUCTX__LOAD = exposedMethod("MuCtx.load", JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
553 554 555 556 557
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_ord = _jffiBuffer.getInt(1)
val _raw_loc = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
val ord = toMemoryOrder(_raw_ord)
Kunshan Wang's avatar
Kunshan Wang committed
558
val loc = getMuValueNotNull(_raw_loc).asInstanceOf[MuIRefValue]
559
val _RV = ctx.load(ord, loc)
Kunshan Wang's avatar
Kunshan Wang committed
560 561
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
562
}
Kunshan Wang's avatar
Kunshan Wang committed
563
val MUCTX__STORE = exposedMethod("MuCtx.store", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
564 565 566 567 568 569
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_ord = _jffiBuffer.getInt(1)
val _raw_loc = _jffiBuffer.getAddress(2)
val _raw_newval = _jffiBuffer.getAddress(3)
val ctx = getMuCtx(_raw_ctx)
val ord = toMemoryOrder(_raw_ord)
Kunshan Wang's avatar
Kunshan Wang committed
570 571
val loc = getMuValueNotNull(_raw_loc).asInstanceOf[MuIRefValue]
val newval = getMuValueNotNull(_raw_newval).asInstanceOf[MuValue]
572
val _RV = ctx.store(ord, loc, newval)
573
}
Kunshan Wang's avatar
Kunshan Wang committed
574
val MUCTX__CMPXCHG = exposedMethod("MuCtx.cmpxchg", JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.SINT, JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
575 576 577 578 579 580 581 582 583 584 585
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_ord_succ = _jffiBuffer.getInt(1)
val _raw_ord_fail = _jffiBuffer.getInt(2)
val _raw_weak = _jffiBuffer.getInt(3)
val _raw_loc = _jffiBuffer.getAddress(4)
val _raw_expected = _jffiBuffer.getAddress(5)
val _raw_desired = _jffiBuffer.getAddress(6)
val _raw_is_succ = _jffiBuffer.getAddress(7)
val ctx = getMuCtx(_raw_ctx)
val ord_succ = toMemoryOrder(_raw_ord_succ)
val ord_fail = toMemoryOrder(_raw_ord_fail)
586
val weak = intToBoolean(_raw_weak)
Kunshan Wang's avatar
Kunshan Wang committed
587 588 589
val loc = getMuValueNotNull(_raw_loc).asInstanceOf[MuIRefValue]
val expected = getMuValueNotNull(_raw_expected).asInstanceOf[MuValue]
val desired = getMuValueNotNull(_raw_desired).asInstanceOf[MuValue]
Kunshan Wang's avatar
Kunshan Wang committed
590
val is_succ = _raw_is_succ
591
val _RV = ctx.cmpxchg(ord_succ, ord_fail, weak, loc, expected, desired, is_succ)
Kunshan Wang's avatar
Kunshan Wang committed
592 593
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
594
}
Kunshan Wang's avatar
Kunshan Wang committed
595
val MUCTX__ATOMICRMW = exposedMethod("MuCtx.atomicrmw", JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
596 597 598 599 600 601 602 603
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_ord = _jffiBuffer.getInt(1)
val _raw_op = _jffiBuffer.getInt(2)
val _raw_loc = _jffiBuffer.getAddress(3)
val _raw_opnd = _jffiBuffer.getAddress(4)
val ctx = getMuCtx(_raw_ctx)
val ord = toMemoryOrder(_raw_ord)
val op = toAtomicRMWOptr(_raw_op)
Kunshan Wang's avatar
Kunshan Wang committed
604 605
val loc = getMuValueNotNull(_raw_loc).asInstanceOf[MuIRefValue]
val opnd = getMuValueNotNull(_raw_opnd).asInstanceOf[MuValue]
606
val _RV = ctx.atomicrmw(ord, op, loc, opnd)
Kunshan Wang's avatar
Kunshan Wang committed
607 608
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
609
}
Kunshan Wang's avatar
Kunshan Wang committed
610
val MUCTX__FENCE = exposedMethod("MuCtx.fence", JType.VOID, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
611 612 613 614
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_ord = _jffiBuffer.getInt(1)
val ctx = getMuCtx(_raw_ctx)
val ord = toMemoryOrder(_raw_ord)
615
val _RV = ctx.fence(ord)
616
}
Kunshan Wang's avatar
Kunshan Wang committed
617
val MUCTX__NEW_STACK = exposedMethod("MuCtx.new_stack", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
618 619 620
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_func = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
621
val func = getMuValueNotNull(_raw_func).asInstanceOf[MuFuncRefValue]
622
val _RV = ctx.newStack(func)
Kunshan Wang's avatar
Kunshan Wang committed
623 624
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
625
}
626
val MUCTX__NEW_THREAD_NOR = exposedMethod("MuCtx.new_thread_nor", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
627 628 629 630
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_stack = _jffiBuffer.getAddress(1)
val _raw_threadlocal = _jffiBuffer.getAddress(2)
val _raw_vals = _jffiBuffer.getAddress(3)
631
val _raw_nvals = _jffiBuffer.getAddress(4)
Kunshan Wang's avatar
Kunshan Wang committed
632
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
633 634
val stack = getMuValueNotNull(_raw_stack).asInstanceOf[MuStackRefValue]
val threadlocal = getMuValueNullable(_raw_threadlocal).asInstanceOf[Option[MuRefValue]]
Kunshan Wang's avatar
Kunshan Wang committed
635
val vals = readMuValueArray(_raw_vals, _raw_nvals)
636
val _RV = ctx.newThreadNor(stack, threadlocal, vals)
Kunshan Wang's avatar
Kunshan Wang committed
637 638
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
639
}
Kunshan Wang's avatar
Kunshan Wang committed
640
val MUCTX__NEW_THREAD_EXC = exposedMethod("MuCtx.new_thread_exc", JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
641 642 643 644 645
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_stack = _jffiBuffer.getAddress(1)
val _raw_threadlocal = _jffiBuffer.getAddress(2)
val _raw_exc = _jffiBuffer.getAddress(3)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
646 647 648
val stack = getMuValueNotNull(_raw_stack).asInstanceOf[MuStackRefValue]
val threadlocal = getMuValueNullable(_raw_threadlocal).asInstanceOf[Option[MuRefValue]]
val exc = getMuValueNotNull(_raw_exc).asInstanceOf[MuRefValue]
649
val _RV = ctx.newThreadExc(stack, threadlocal, exc)
Kunshan Wang's avatar
Kunshan Wang committed
650 651
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
652
}
Kunshan Wang's avatar
Kunshan Wang committed
653
val MUCTX__KILL_STACK = exposedMethod("MuCtx.kill_stack", JType.VOID, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
654 655 656
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_stack = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
657
val stack = getMuValueNotNull(_raw_stack).asInstanceOf[MuStackRefValue]
658
val _RV = ctx.killStack(stack)
659
}
Kunshan Wang's avatar
Kunshan Wang committed
660
val MUCTX__SET_THREADLOCAL = exposedMethod("MuCtx.set_threadlocal", JType.VOID, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
661 662 663 664
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_thread = _jffiBuffer.getAddress(1)
val _raw_threadlocal = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
665 666
val thread = getMuValueNotNull(_raw_thread).asInstanceOf[MuThreadRefValue]
val threadlocal = getMuValueNotNull(_raw_threadlocal).asInstanceOf[MuRefValue]
667
val _RV = ctx.setThreadlocal(thread, threadlocal)
668
}
Kunshan Wang's avatar
Kunshan Wang committed
669
val MUCTX__GET_THREADLOCAL = exposedMethod("MuCtx.get_threadlocal", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
670 671 672
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_thread = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
673
val thread = getMuValueNotNull(_raw_thread).asInstanceOf[MuThreadRefValue]
674
val _RV = ctx.getThreadlocal(thread)
Kunshan Wang's avatar
Kunshan Wang committed
675 676
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
677
}
Kunshan Wang's avatar
Kunshan Wang committed
678
val MUCTX__NEW_CURSOR = exposedMethod("MuCtx.new_cursor", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
679 680 681
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_stack = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
682
val stack = getMuValueNotNull(_raw_stack).asInstanceOf[MuStackRefValue]
683
val _RV = ctx.newCursor(stack)
Kunshan Wang's avatar
Kunshan Wang committed
684 685
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
686
}
Kunshan Wang's avatar
Kunshan Wang committed
687
val MUCTX__NEXT_FRAME = exposedMethod("MuCtx.next_frame", JType.VOID, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
688 689 690
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_cursor = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
691
val cursor = getMuValueNotNull(_raw_cursor).asInstanceOf[MuFCRefValue]
692
val _RV = ctx.nextFrame(cursor)
693
}
Kunshan Wang's avatar
Kunshan Wang committed
694
val MUCTX__COPY_CURSOR = exposedMethod("MuCtx.copy_cursor", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
695 696 697
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_cursor = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
698
val cursor = getMuValueNotNull(_raw_cursor).asInstanceOf[MuFCRefValue]
699
val _RV = ctx.copyCursor(cursor)
Kunshan Wang's avatar
Kunshan Wang committed
700 701
val _RV_FAK = exposeMuValue(ctx, _RV)
_jffiBuffer.setAddressReturn(_RV_FAK)
702
}
Kunshan Wang's avatar
Kunshan Wang committed
703
val MUCTX__CLOSE_CURSOR = exposedMethod("MuCtx.close_cursor", JType.VOID, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
704 705 706
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_cursor = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
707
val cursor = getMuValueNotNull(_raw_cursor).asInstanceOf[MuFCRefValue]
708
val _RV = ctx.closeCursor(cursor)
709
}
Kunshan Wang's avatar
Kunshan Wang committed
710
val MUCTX__CUR_FUNC = exposedMethod("MuCtx.cur_func", JType.UINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
711 712 713
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_cursor = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
714
val cursor = getMuValueNotNull(_raw_cursor).asInstanceOf[MuFCRefValue]
715
val _RV = ctx.curFunc(cursor)
Kunshan Wang's avatar
Kunshan Wang committed
716
_jffiBuffer.setIntReturn(_RV)
717
}
Kunshan Wang's avatar
Kunshan Wang committed
718
val MUCTX__CUR_FUNC_VER = exposedMethod("MuCtx.cur_func_ver", JType.UINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
719 720 721
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_cursor = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
722
val cursor = getMuValueNotNull(_raw_cursor).asInstanceOf[MuFCRefValue]
723
val _RV = ctx.curFuncVer(cursor)
Kunshan Wang's avatar
Kunshan Wang committed
724
_jffiBuffer.setIntReturn(_RV)
725
}
Kunshan Wang's avatar
Kunshan Wang committed
726
val MUCTX__CUR_INST = exposedMethod("MuCtx.cur_inst", JType.UINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
727 728 729
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_cursor = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
730
val cursor = getMuValueNotNull(_raw_cursor).asInstanceOf[MuFCRefValue]
731
val _RV = ctx.curInst(cursor)
Kunshan Wang's avatar
Kunshan Wang committed
732
_jffiBuffer.setIntReturn(_RV)
733
}
Kunshan Wang's avatar
Kunshan Wang committed
734
val MUCTX__DUMP_KEEPALIVES = exposedMethod("MuCtx.dump_keepalives", JType.VOID, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
735 736 737 738
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_cursor = _jffiBuffer.getAddress(1)
val _raw_results = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
739 740
val cursor = getMuValueNotNull(_raw_cursor).asInstanceOf[MuFCRefValue]
val results = _raw_results
741
val _RV = ctx.dumpKeepalives(cursor, results)
742
}
Kunshan Wang's avatar
Kunshan Wang committed
743
val MUCTX__POP_FRAMES_TO = exposedMethod("MuCtx.pop_frames_to", JType.VOID, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
744 745 746
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_cursor = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
747
val cursor = getMuValueNotNull(_raw_cursor).asInstanceOf[MuFCRefValue]
748
val _RV = ctx.popFramesTo(cursor)
749
}
Kunshan Wang's avatar
Kunshan Wang committed
750
val MUCTX__PUSH_FRAME = exposedMethod("MuCtx.push_frame", JType.VOID, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
751 752 753 754
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_stack = _jffiBuffer.getAddress(1)
val _raw_func = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
755 756
val stack = getMuValueNotNull(_raw_stack).asInstanceOf[MuStackRefValue]
val func = getMuValueNotNull(_raw_func).asInstanceOf[MuFuncRefValue]
757
val _RV = ctx.pushFrame(stack, func)
758
}
Kunshan Wang's avatar
Kunshan Wang committed
759
val MUCTX__TR64_IS_FP = exposedMethod("MuCtx.tr64_is_fp", JType.SINT, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
760 761 762
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_value = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
763
val value = getMuValueNotNull(_raw_value).asInstanceOf[MuTagRef64Value]
764
val _RV = ctx.tr64IsFP(value)
765 766
val _RV_FAK = booleanToInt(_RV)
_jffiBuffer.setIntReturn(_RV_FAK)
767
}
Kunshan Wang's avatar
Kunshan Wang committed
768
val MUCTX__TR64_IS_INT = exposedMethod("MuCtx.tr64_is_int", JType.SINT, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
769 770 771
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_value = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
772
val value = getMuValueNotNull(_raw_value).asInstanceOf[MuTagRef64Value]
773
val _RV = ctx.tr64IsInt(value)
774 775
val _RV_FAK = booleanToInt(_RV)
_jffiBuffer.setIntReturn(_RV_FAK)
776
}
Kunshan Wang's avatar
Kunshan Wang committed
777
val MUCTX__TR64_IS_REF = exposedMethod("MuCtx.tr64_is_ref", JType.SINT, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
778 779 780
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_value = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed
781
val value = getMuValueNotNull(_raw_value).asInstanceOf[MuTagRef64Value]
782
val _RV = ctx.tr64IsRef(value)
783 784
val _RV_FAK = booleanToInt(_RV)
_jffiBuffer.setIntReturn(_RV_FAK)
785
}
Kunshan Wang's avatar
Kunshan Wang committed
786
val MUCTX__TR64_TO_FP = exposedMethod("MuCtx.tr64_to_fp", JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
Kunshan Wang's avatar
Kunshan Wang committed
787 788 789
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_value = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
Kunshan Wang's avatar
Kunshan Wang committed