cStubs.scala 104 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 MuIRNodeAliases._
17
  import CDefsHelperFunctions._
Kunshan Wang's avatar
Kunshan Wang committed
18
  import NativeClientSupport._
Kunshan Wang's avatar
Kunshan Wang committed
19

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