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

Kunshan Wang's avatar
Kunshan Wang committed
3
import com.kenai.jffi.{ Type => JType }
4

Kunshan Wang's avatar
Kunshan Wang committed
5
import NativeSupport._
6
import uvm.refimpl._
Kunshan Wang's avatar
Kunshan Wang committed
7
import uvm.ssavariables.{BinOptr, CmpOptr, ConvOptr, MemoryOrder, AtomicRMWOptr}
8 9

object CDefs {
Kunshan Wang's avatar
Kunshan Wang committed
10
  import NativeMemoryAccessHelper._
11
  import CDefsHelperFunctions._
Kunshan Wang's avatar
Kunshan Wang committed
12
  import NativeClientSupport._
Kunshan Wang's avatar
Kunshan Wang committed
13

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