WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit ffe3b088 authored by Kunshan Wang's avatar Kunshan Wang
Browse files

Call the method and make implicit impls

parent 982ce681
......@@ -336,7 +336,7 @@ struct MuCtx {
void (*store )(MuCtx *ctx, MuMemOrd ord, MuIRefValue loc, MuValue newval);
MuValue (*cmpxchg )(MuCtx *ctx, MuMemOrd ord_succ, MuMemOrd ord_fail,
int weak, MuIRefValue loc, MuValue expected, MuValue desired,
int *is_succ); /// MUAPIPARSER weak:bool
int *is_succ); /// MUAPIPARSER weak:bool;is_succ:out
MuValue (*atomicrmw)(MuCtx *ctx, MuMemOrd ord, MuAtomicRMWOptr op,
MuIRefValue loc, MuValue opnd);
void (*fence )(MuCtx *ctx, MuMemOrd ord);
......@@ -348,7 +348,7 @@ struct MuCtx {
MuValue *vals, int nvals); /// MUAPIPARSER threadlocal:optional;vals:array:nvals
MuThreadRefValue (*new_thread_exc)(MuCtx *ctx, MuStackRefValue stack,
MuRefValue threadlocal,
MuRefValue exc); /// MUAPIPARSER threadlocal:optional;exc:optional
MuRefValue exc); /// MUAPIPARSER threadlocal:optional
void (*kill_stack)(MuCtx *ctx, MuStackRefValue stack);
// Thread-local object reference
......@@ -366,7 +366,7 @@ struct MuCtx {
MuID (*cur_func )(MuCtx *ctx, MuFCRefValue cursor);
MuID (*cur_func_ver )(MuCtx *ctx, MuFCRefValue cursor);
MuID (*cur_inst )(MuCtx *ctx, MuFCRefValue cursor);
void (*dump_keepalives)(MuCtx *ctx, MuFCRefValue cursor, MuValue *results);
void (*dump_keepalives)(MuCtx *ctx, MuFCRefValue cursor, MuValue *results); /// MUAPIPARSER: results:out
// On-stack replacement
void (*pop_frames_to)(MuCtx *ctx, MuFCRefValue cursor);
......@@ -506,7 +506,7 @@ struct MuCtx {
void (*add_dest )(MuCtx *ctx, MuInstNode inst, MuDestKind kind, MuBBNode dest, MuVarNode *vars, int nvars); /// MUAPIPARSER vars:array:nvars
// Create a destination claues and add it to instruction "inst".
void (*add_keepalives)(MuCtx *ctx, MuInstNode inst, MuLocalVarNode *vars, int nvars);
void (*add_keepalives)(MuCtx *ctx, MuInstNode inst, MuLocalVarNode *vars, int nvars); /// MUAPIPARSER vars:array:nvars
/// Create instructions. Instructions are appended to the basic block "bb".
......
......@@ -33,7 +33,7 @@ replaces = [(re.compile(x), y) for (x,y) in [
(r'(CN|ChildNode)\[ExcParam\]', 'MuExcParamNode'),
(r'(CN|ChildNode)\[InstResult\]', 'MuInstResNode'),
(r'(CN|ChildNode)\[Inst\w+\]', 'MuInstNode'),
(r'(CN|ChildNode)\[HasKeepAliveClause\]', 'MuInstNode'),
(r'(CN|ChildNode)\[HasKeepaliveClause\]', 'MuInstNode'),
]]
sig = re.compile(r'^( def\s+(\w+)\s*\(([^)]*)\):\s+\w+\s+=)', re.MULTILINE)
......
......@@ -45,7 +45,7 @@ _primitive_types = {
_other_ptr_types = {"MuName", "MuCFP", "MuTrapHandler", "MuValueFreer"}
_self_getters = {
"MuVM*": "getMuVM",
"MuVM*": "getMicroVM",
"MuCtx*": "getMuCtx",
}
......@@ -61,7 +61,7 @@ def type_is_ptr(ty):
return type_is_explicit_ptr(ty) or type_is_handle(ty) or ty in _other_ptr_types
def type_is_handle_array(ty):
return type_is_ptr(ty) and r_handle_ty.match(ty[:-1]) is not None
return type_is_ptr(ty) and type_is_handle(ty[:-1])
def to_jffi_ty(cty):
if cty in _primitive_types:
......@@ -85,6 +85,16 @@ def to_jffi_getter(cty):
_special_cases = {
"id": "ID",
"sint8": "SInt8",
"uint8": "UInt8",
"sint16": "SInt16",
"uint16": "UInt16",
"sint32": "SInt32",
"uint32": "UInt32",
"sint64": "SInt64",
"uint64": "UInt64",
"uint64s": "UInt64s",
"fp": "FP",
"uptr": "UPtr",
"ufuncptr": "UFuncPtr",
"iref": "IRef",
......@@ -97,7 +107,6 @@ _special_cases = {
"irnoderef": "IRNodeRef",
"funcsig": "FuncSig",
"bb": "BB",
"keepalives": "KeepAlives",
"binop": "BinOp",
"tailcall": "TailCall",
"extractvalue": "ExtractValue",
......@@ -127,8 +136,8 @@ def toCamelCase(name):
ins = name.split("_")
outs = [ins[0]]
for inn in ins[1:]:
if inn in _special_case:
outs.append(_special_case[inn])
if inn in _special_cases:
outs.append(_special_cases[inn])
else:
outs.append(inn[0].upper()+inn[1:])
......@@ -141,22 +150,21 @@ def to_basic_type(typedefs, name):
_no_conversion = {
"MuID", # It's just Int.
"MuName", # Only two functions. Handle in Scala.
"MuTrapHandler", # It is a function pointer. Handle in Scala.
"MuCPtr", # Intended to be raw pointer. Passed directly.
"MuCFP", # ditto
"char*", # Only used in load_bundle or load_hail. Handle in Scala.
"int*", # Only used in cmpxchg as an output parameter. Handle in Scala.
"MuWPID", # Just Int
"MuCommInst", # Onlu used in new_comminst, and the builder uses opcode directly.
}
_array_converters = {
"char*" : "readCharArray",
"uint64_t*" : "readLongArray",
"MuFlag*" : "readFlagArray",
}
_special_converters = {
"MuName" : "readCString",
"MuMemOrd" : "toMemoryOrder",
"MuAtomicRMWOptr" : "toAtomicRMWOptr",
"MuBinOptr" : "toBinOptr",
......@@ -166,11 +174,14 @@ _special_converters = {
"MuDestKind" : "toDestKind",
}
def param_converter(pn, pt, rn, rt, is_optional, array_sz, is_bool):
def param_converter(pn, pt, rn, rt, is_optional, array_sz, is_bool, is_out):
if pt == "void":
raise ValueError("Parameter cannot be void. Param name: {}".format(pn))
if pt in _primitive_types or pt in _no_conversion:
if pt == "int" and is_bool:
return "{} != 0".format(rn)
if pt in _primitive_types or pt in _no_conversion or is_out:
return rn # does not need conversion
if array_sz is not None:
......@@ -192,9 +203,6 @@ def param_converter(pn, pt, rn, rt, is_optional, array_sz, is_bool):
if pt in _special_converters:
return "{}({})".format(_special_converters[pt], rn)
if pt == "int" and is_bool:
return "{} != 0".foramt(rn)
raise ValueError("I don't know how to convert {}. Param name: {}".format(
pt, pn))
......@@ -243,6 +251,8 @@ def generate_method(typedefs, strname, meth) -> Tuple[str, str]:
"_raw_"+self_param_name))
# convert parameters
args_to_pass = []
for i in range(1, len(params)):
param = params[i]
pn = param['name']
......@@ -250,6 +260,8 @@ def generate_method(typedefs, strname, meth) -> Tuple[str, str]:
if pn in array_szs:
continue # Array sizes don't need to be passed explicitly.
args_to_pass.append(pn)
pt = param['type']
rn = "_raw_" + pn
rt = to_basic_type(typedefs, pt)
......@@ -258,6 +270,7 @@ def generate_method(typedefs, strname, meth) -> Tuple[str, str]:
is_optional = False
array_sz = None
is_bool = False
is_out = False
for pp in pps:
if pp[1] == 'array':
array_sz = "_raw_" + pp[2]
......@@ -265,13 +278,19 @@ def generate_method(typedefs, strname, meth) -> Tuple[str, str]:
is_optional = True
elif pp[1] == 'bool':
is_bool = True
elif pp[1] == 'out':
is_out = True
pc = param_converter(pn, pt, rn, rt, is_optional, array_sz, is_bool)
pc = param_converter(pn, pt, rn, rt, is_optional, array_sz, is_bool, is_out)
stmts.append("val {} = {}".format(pn, pc))
# make the call
camelName = toCamelCase(name)
stmts.append("val _RV = {}.{}({})".format(
self_param_name, camelName, ", ".join(args_to_pass)))
# return value
footer = "}"
......
......@@ -237,8 +237,8 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
}
}
def addKeepAlives(inst: CN[HasKeepAliveClause], lvs: Seq[CN[LocalVariable]]): Unit = {
inst.keepAlives = lvs
def addKeepalives(inst: CN[HasKeepaliveClause], lvs: Seq[CN[LocalVariable]]): Unit = {
inst.keepalives = lvs
}
private def newInst[T <: Instruction](bb: BasicBlock, inst: T): CN[T] = {
......
......@@ -16,7 +16,7 @@ import uvm.refimpl.mem._
import uvm.refimpl.mem.TypeSizes._
import uvm.ssavariables._
import uvm.ssavariables.AtomicRMWOptr._
import uvm.ssavariables.HasKeepAliveClause
import uvm.ssavariables.HasKeepaliveClause
import uvm.ssavariables.MemoryOrder._
import uvm.types._
......@@ -541,8 +541,8 @@ class MuCtx(val ctxID: Int, _mutator: Mutator)(
case f: DefinedMuFrame => {
val i = f.curInst
i match {
case hkac: HasKeepAliveClause => {
val kas = hkac.keepAlives
case hkac: HasKeepaliveClause => {
val kas = hkac.keepalives
for (ka <- kas) yield {
val box = f.boxes(ka)
val ty = TypeInferer.inferType(ka)
......@@ -576,8 +576,8 @@ class MuCtx(val ctxID: Int, _mutator: Mutator)(
}
/** Test if a tagref64 holds a double. */
def tr64IsFp(value: MuTagRef64Value): Boolean = {
OpHelper.tr64IsFp(value.vb.raw)
def tr64IsFP(value: MuTagRef64Value): Boolean = {
OpHelper.tr64IsFP(value.vb.raw)
}
/** Test if a tagref64 holds an int. */
......@@ -591,9 +591,9 @@ class MuCtx(val ctxID: Int, _mutator: Mutator)(
}
/** Extract the double held by a tagref64. */
def tr64ToFp(value: MuTagRef64Value): MuDoubleValue = {
def tr64ToFP(value: MuTagRef64Value): MuDoubleValue = {
val raw = value.vb.raw
val box = new BoxDouble(OpHelper.tr64ToFp(raw))
val box = new BoxDouble(OpHelper.tr64ToFP(raw))
addHandle(MuDoubleValue(InternalTypes.DOUBLE, box))
}
......@@ -619,7 +619,7 @@ class MuCtx(val ctxID: Int, _mutator: Mutator)(
}
/** Convert a double to a tagref64. */
def tr64FromFp(value: MuDoubleValue): MuTagRef64Value = {
def tr64FromFP(value: MuDoubleValue): MuTagRef64Value = {
val fp = value.vb.value
val box = new BoxTagRef64(OpHelper.fpToTr64(fp))
addHandle(MuTagRef64Value(InternalTypes.TAGREF64, box))
......@@ -642,11 +642,11 @@ class MuCtx(val ctxID: Int, _mutator: Mutator)(
addHandle(MuTagRef64Value(InternalTypes.TAGREF64, box))
}
def enableWatchpoint(wpID: Int): Unit = {
def enableWatchPoint(wpID: Int): Unit = {
microVM.trapManager.enableWatchPoint(wpID)
}
def disableWatchpoint(wpID: Int): Unit = {
def disableWatchPoint(wpID: Int): Unit = {
microVM.trapManager.disableWatchPoint(wpID)
}
......
......@@ -72,8 +72,7 @@ trait MuCtxIRBuilderPart {
// no op
}
// BEGIN: auto-generated code
def newBundle(): MuBundleNode = {
def newBundle(): MuBundleNode = {
addHandle(irBuilder.newBundle())
}
......@@ -321,10 +320,10 @@ trait MuCtxIRBuilderPart {
irBuilder.addDest(inst, kind, bb, vars)
}
def addKeepAlives(inst: MuInstNode, lvs: Seq[MuLocalVarNode]): Unit = {
def addKeepalives(inst: MuInstNode, lvs: Seq[MuLocalVarNode]): Unit = {
require(!inst.isNull, "inst must not be NULL")
for((n,i) <- lvs.zipWithIndex) require(!n.isNull, "lvs[%d] must not be NULL".format(i))
irBuilder.addKeepAlives(inst, lvs)
irBuilder.addKeepalives(inst, lvs)
}
def newBinOp(bb: MuBBNode, optr: BinOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode): MuInstNode = {
......@@ -630,7 +629,6 @@ trait MuCtxIRBuilderPart {
addHandle(irBuilder.newCommInst(bb, opcode, flags, tys, sigs, args))
}
// BEGIN: auto-generated code
// END: auto-generated code
}
\ No newline at end of file
......@@ -121,7 +121,7 @@ object OpHelper {
(opnd & 0x7ff0000000000001L) == 0x7ff0000000000001L
}
def tr64IsFp(opnd: Long): Boolean = {
def tr64IsFP(opnd: Long): Boolean = {
(opnd & 0x7ff0000000000001L) != 0x7ff0000000000001L &&
(opnd & 0x7ff0000000000003L) != 0x7ff0000000000002L
}
......@@ -153,7 +153,7 @@ object OpHelper {
(((opnd & 0xffffffffffffeL) >> 1) | ((opnd & 0x8000000000000000L) >> 12) & (1L << 51))
}
def tr64ToFp(opnd: Long): Double = java.lang.Double.longBitsToDouble(opnd)
def tr64ToFP(opnd: Long): Double = java.lang.Double.longBitsToDouble(opnd)
def tr64ToRef(opnd: Long): Long = {
((opnd & 0x7ffffffffff8L) |
......
......@@ -10,10 +10,10 @@ import uvm.refimpl._
import uvm.ssavariables.{BinOptr, CmpOptr, ConvOptr, MemoryOrder, AtomicRMWOptr}
import uvm.ir.irbuilder.DestKind
import CDefsHelperFunctions._
import uvm.refimpl.MicroVM
object CDefs {
import CDefsHelperFunctions._
import NativeClientSupport._
exposedMethod(JType.VOID, Array(JType.SINT, JType.UINT32)) { jffiBuffer =>
......@@ -25,35 +25,41 @@ object CDefs {
/// SCRIPT: GENERATED CODE BEGIN
val MUVM__NEW_CONTEXT = exposedMethod(JType.POINTER, Array(JType.POINTER)) { _jffiBuffer =>
val _raw_mvm = _jffiBuffer.getAddress(0)
val mvm = getMuVM(_raw_mvm)
val mvm = getMicroVM(_raw_mvm)
val _RV = mvm.newContext()
}
val MUVM__ID_OF = exposedMethod(JType.UINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_mvm = _jffiBuffer.getAddress(0)
val _raw_name = _jffiBuffer.getAddress(1)
val mvm = getMuVM(_raw_mvm)
val name = _raw_name
val mvm = getMicroVM(_raw_mvm)
val name = readCString(_raw_name)
val _RV = mvm.idOf(name)
}
val MUVM__NAME_OF = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
val _raw_mvm = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
val mvm = getMuVM(_raw_mvm)
val mvm = getMicroVM(_raw_mvm)
val id = _raw_id
val _RV = mvm.nameOf(id)
}
val MUVM__SET_TRAP_HANDLER = exposedMethod(JType.VOID, Array(JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_mvm = _jffiBuffer.getAddress(0)
val _raw_trap_handler = _jffiBuffer.getAddress(1)
val _raw_userdata = _jffiBuffer.getAddress(2)
val mvm = getMuVM(_raw_mvm)
val mvm = getMicroVM(_raw_mvm)
val trap_handler = _raw_trap_handler
val userdata = _raw_userdata
val _RV = mvm.setTrapHandler(trap_handler, userdata)
}
val MUVM__EXECUTE = exposedMethod(JType.VOID, Array(JType.POINTER)) { _jffiBuffer =>
val _raw_mvm = _jffiBuffer.getAddress(0)
val mvm = getMuVM(_raw_mvm)
val mvm = getMicroVM(_raw_mvm)
val _RV = mvm.execute()
}
val MUVM__GET_MU_ERROR_PTR = exposedMethod(JType.POINTER, Array(JType.POINTER)) { _jffiBuffer =>
val _raw_mvm = _jffiBuffer.getAddress(0)
val mvm = getMuVM(_raw_mvm)
val mvm = getMicroVM(_raw_mvm)
val _RV = mvm.getMuErrorPtr()
}
val stubsOfMuVM = Array[Word](6)
stubsOfMuVM(0) = MUVM__NEW_CONTEXT.address
......@@ -66,31 +72,36 @@ val MUCTX__ID_OF = exposedMethod(JType.UINT32, Array(JType.POINTER, JType.POINTE
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_name = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val name = _raw_name
val name = readCString(_raw_name)
val _RV = ctx.idOf(name)
}
val MUCTX__NAME_OF = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
val ctx = getMuCtx(_raw_ctx)
val id = _raw_id
val _RV = ctx.nameOf(id)
}
val MUCTX__CLOSE_CONTEXT = exposedMethod(JType.VOID, Array(JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val ctx = getMuCtx(_raw_ctx)
val _RV = ctx.closeContext()
}
val MUCTX__LOAD_BUNDLE = exposedMethod(JType.VOID, Array(JType.POINTER, JType.POINTER, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_buf = _jffiBuffer.getAddress(1)
val _raw_sz = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val buf = _raw_buf
val buf = readCharArray(_raw_buf, _raw_sz)
val _RV = ctx.loadBundle(buf)
}
val MUCTX__LOAD_HAIL = exposedMethod(JType.VOID, Array(JType.POINTER, JType.POINTER, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_buf = _jffiBuffer.getAddress(1)
val _raw_sz = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val buf = _raw_buf
val buf = readCharArray(_raw_buf, _raw_sz)
val _RV = ctx.loadHail(buf)
}
val MUCTX__HANDLE_FROM_SINT8 = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.SINT8, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -99,6 +110,7 @@ val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
val _RV = ctx.handleFromSInt8(num, len)
}
val MUCTX__HANDLE_FROM_UINT8 = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.UINT8, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -107,6 +119,7 @@ val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
val _RV = ctx.handleFromUInt8(num, len)
}
val MUCTX__HANDLE_FROM_SINT16 = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.SINT16, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -115,6 +128,7 @@ val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
val _RV = ctx.handleFromSInt16(num, len)
}
val MUCTX__HANDLE_FROM_UINT16 = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.UINT16, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -123,6 +137,7 @@ val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
val _RV = ctx.handleFromUInt16(num, len)
}
val MUCTX__HANDLE_FROM_SINT32 = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.SINT32, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -131,6 +146,7 @@ val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
val _RV = ctx.handleFromSInt32(num, len)
}
val MUCTX__HANDLE_FROM_UINT32 = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -139,6 +155,7 @@ val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
val _RV = ctx.handleFromUInt32(num, len)
}
val MUCTX__HANDLE_FROM_SINT64 = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.SINT64, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -147,6 +164,7 @@ val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
val _RV = ctx.handleFromSInt64(num, len)
}
val MUCTX__HANDLE_FROM_UINT64 = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.UINT64, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -155,6 +173,7 @@ val _raw_len = _jffiBuffer.getInt(2)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val len = _raw_len
val _RV = ctx.handleFromUInt64(num, len)
}
val MUCTX__HANDLE_FROM_UINT64S = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.POINTER, JType.SINT, JType.SINT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -164,18 +183,21 @@ val _raw_len = _jffiBuffer.getInt(3)
val ctx = getMuCtx(_raw_ctx)
val nums = readLongArray(_raw_nums, _raw_nnums)
val len = _raw_len
val _RV = ctx.handleFromUInt64s(nums, len)
}
val MUCTX__HANDLE_FROM_FLOAT = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.FLOAT)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getFloat(1)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val _RV = ctx.handleFromFloat(num)
}
val MUCTX__HANDLE_FROM_DOUBLE = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.DOUBLE)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_num = _jffiBuffer.getDouble(1)
val ctx = getMuCtx(_raw_ctx)
val num = _raw_num
val _RV = ctx.handleFromDouble(num)
}
val MUCTX__HANDLE_FROM_PTR = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -184,6 +206,7 @@ val _raw_ptr = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
val mu_type = _raw_mu_type
val ptr = _raw_ptr
val _RV = ctx.handleFromPtr(mu_type, ptr)
}
val MUCTX__HANDLE_FROM_FP = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.UINT32, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
......@@ -192,108 +215,126 @@ val _raw_fp = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
val mu_type = _raw_mu_type
val fp = _raw_fp
val _RV = ctx.handleFromFP(mu_type, fp)
}
val MUCTX__HANDLE_TO_SINT8 = exposedMethod(JType.SINT8, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToSInt8(opnd)
}
val MUCTX__HANDLE_TO_UINT8 = exposedMethod(JType.UINT8, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToUInt8(opnd)
}
val MUCTX__HANDLE_TO_SINT16 = exposedMethod(JType.SINT16, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToSInt16(opnd)
}
val MUCTX__HANDLE_TO_UINT16 = exposedMethod(JType.UINT16, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToUInt16(opnd)
}
val MUCTX__HANDLE_TO_SINT32 = exposedMethod(JType.SINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToSInt32(opnd)
}
val MUCTX__HANDLE_TO_UINT32 = exposedMethod(JType.UINT32, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToUInt32(opnd)
}
val MUCTX__HANDLE_TO_SINT64 = exposedMethod(JType.SINT64, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToSInt64(opnd)
}
val MUCTX__HANDLE_TO_UINT64 = exposedMethod(JType.UINT64, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToUInt64(opnd)
}
val MUCTX__HANDLE_TO_FLOAT = exposedMethod(JType.FLOAT, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToFloat(opnd)
}
val MUCTX__HANDLE_TO_DOUBLE = exposedMethod(JType.DOUBLE, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToDouble(opnd)
}
val MUCTX__HANDLE_TO_PTR = exposedMethod(JType.POINTER, Array(JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_opnd = _jffiBuffer.getAddress(1)
val ctx = getMuCtx(_raw_ctx)
val opnd = getMuValueNotNull(_raw_opnd)
val _RV = ctx.handleToPtr(opnd)
}