To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 083afc1a authored by Kunshan Wang's avatar Kunshan Wang
Browse files

WIP: cstubs generated

parent de2867ae
......@@ -155,6 +155,7 @@ _special_cases = {
"swapstack": "SwapStack",
"comminst": "CommInst",
"ir": "IR",
"irbuilderref": "IRBuilderRef",
}
def toCamelCase(name):
......@@ -174,12 +175,12 @@ def to_basic_type(typedefs, name):
return name
_no_conversion = {
"MuID", # It's just Int.
# "MuID", # It may be optional, in which case it needs conversion.
"MuTrapHandler", # It is a function pointer. Handle in Scala.
"MuCPtr", # Intended to be raw pointer. Passed directly.
"MuCFP", # ditto
"MuWPID", # Just Int
"MuCommInst", # Onlu used in new_comminst, and the builder uses opcode directly.
# "MuCommInst", # same as MuID
}
_array_converters = {
......@@ -198,7 +199,8 @@ _special_converters = {
"MuBinOptr" : "toBinOptr",
"MuCmpOptr" : "toCmpOptr",
"MuConvOptr" : "toConvOptr",
"MuCallConv" : "toFlag",
"MuCallConv" : "toCallConv",
"MuCommInst" : "toCommInst",
}
_special_return_converters = {
......@@ -216,7 +218,9 @@ def param_converter(pn, pt, rn, rt, is_optional, array_sz, is_out):
if pt in _primitive_types or pt in _no_conversion or is_out:
return rn # does not need conversion
if type_is_node(pt):
if type_is_node(pt) or pt == "MuID":
if is_optional:
return "readMuIDOptional({})".format(rn)
return rn # does not need conversion
if array_sz is not None:
......@@ -238,7 +242,10 @@ def param_converter(pn, pt, rn, rt, is_optional, array_sz, is_out):
return "getMuValueNotNull({}).asInstanceOf[{}]".format(rn, pt)
if pt in _special_converters:
return "{}({})".format(_special_converters[pt], rn)
converter = _special_converters[pt]
if is_optional:
converter = converter + "Optional"
return "{}({})".format(converter, rn)
raise ValueError("I don't know how to convert {}. Param name: {}".format(
pt, pn))
......
python3 muapitocstubs.py
python3 muapitoirbuildercomminstsimpl.py
python3 muapitolibmupy.py
python3 irbuildernodestoirbuildermethods.py
......@@ -9,6 +9,7 @@ import uvm.types._
import uvm.utils.IDFactory
import uvm.staticanalysis.InstructionResultInferer
import scala.collection.mutable.HashMap
import uvm.comminsts.CommInst
object IRBuilder {
......@@ -194,7 +195,7 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
val _node = new NodeFunc(id, sig)
onNewNodeCreated(_node)
}
def newExpFunc(id: MuID, func: MuFuncNode, callconv: MuCallConv, cookie: MuConstIntNode): Unit = {
def newExpFunc(id: MuID, func: MuFuncNode, callconv: Flag, cookie: MuConstIntNode): Unit = {
val _node = new NodeExpFunc(id, func, callconv, cookie)
onNewNodeCreated(_node)
}
......@@ -214,8 +215,8 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
val _node = new NodeExcClause(id, nor, exc)
onNewNodeCreated(_node)
}
def newKeepAliveClasue(id: MuID, vars: Seq[MuLocalVarNode]): Unit = {
val _node = new NodeKeepAliveClasue(id, vars)
def newKeepaliveClause(id: MuID, vars: Seq[MuLocalVarNode]): Unit = {
val _node = new NodeKeepaliveClause(id, vars)
onNewNodeCreated(_node)
}
def newCscRetWith(id: MuID, rettys: Seq[MuVarNode]): Unit = {
......@@ -234,15 +235,15 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
val _node = new NodeNscThrowExc(id, exc)
onNewNodeCreated(_node)
}
def newBinOp(id: MuID, resultID: MuID, optr: MuBinOptr, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode, excClaues: Option[MuExcClause]): Unit = {
def newBinOp(id: MuID, resultID: MuID, optr: BinOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode, excClaues: Option[MuExcClause]): Unit = {
val _node = new NodeBinOp(id, resultID, optr, ty, opnd1, opnd2, excClaues)
onNewNodeCreated(_node)
}
def newCmp(id: MuID, resultID: MuID, optr: MuBinOptr, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode): Unit = {
def newCmp(id: MuID, resultID: MuID, optr: CmpOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode): Unit = {
val _node = new NodeCmp(id, resultID, optr, ty, opnd1, opnd2)
onNewNodeCreated(_node)
}
def newConv(id: MuID, resultID: MuID, optr: MuBinOptr, fromTy: MuTypeNode, toTy: MuTypeNode, opnd: MuVarNode): Unit = {
def newConv(id: MuID, resultID: MuID, optr: ConvOptr.Value, fromTy: MuTypeNode, toTy: MuTypeNode, opnd: MuVarNode): Unit = {
val _node = new NodeConv(id, resultID, optr, fromTy, toTy, opnd)
onNewNodeCreated(_node)
}
......@@ -334,23 +335,23 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
val _node = new NodeGetVarPartIRef(id, resultID, isPtr, refty, opnd)
onNewNodeCreated(_node)
}
def newLoad(id: MuID, resultID: MuID, isPtr: Boolean, ord: MuMemOrd, refty: MuTypeNode, loc: MuVarNode, excClause: Option[MuExcClause]): Unit = {
def newLoad(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, excClause: Option[MuExcClause]): Unit = {
val _node = new NodeLoad(id, resultID, isPtr, ord, refty, loc, excClause)
onNewNodeCreated(_node)
}
def newStore(id: MuID, isPtr: Boolean, ord: MuMemOrd, refty: MuTypeNode, loc: MuVarNode, newval: MuVarNode, excClause: Option[MuExcClause]): Unit = {
def newStore(id: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, newval: MuVarNode, excClause: Option[MuExcClause]): Unit = {
val _node = new NodeStore(id, isPtr, ord, refty, loc, newval, excClause)
onNewNodeCreated(_node)
}
def newCmpXchg(id: MuID, valueResultID: MuID, succResultID: MuID, isPtr: Boolean, isWeak: Boolean, ordSucc: MuMemOrd, ordFail: MuMemOrd, refty: MuTypeNode, loc: MuVarNode, expected: MuVarNode, desired: MuVarNode, excClause: Option[MuExcClause]): Unit = {
def newCmpXchg(id: MuID, valueResultID: MuID, succResultID: MuID, isPtr: Boolean, isWeak: Boolean, ordSucc: MemoryOrder.Value, ordFail: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, expected: MuVarNode, desired: MuVarNode, excClause: Option[MuExcClause]): Unit = {
val _node = new NodeCmpXchg(id, valueResultID, succResultID, isPtr, isWeak, ordSucc, ordFail, refty, loc, expected, desired, excClause)
onNewNodeCreated(_node)
}
def newAtomicRMW(id: MuID, resultID: MuID, isPtr: Boolean, ord: MuMemOrd, optr: MuAtomicRMWOptr, refTy: MuTypeNode, loc: MuVarNode, opnd: MuVarNode, excClause: Option[MuExcClause]): Unit = {
def newAtomicRMW(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, optr: AtomicRMWOptr.Value, refTy: MuTypeNode, loc: MuVarNode, opnd: MuVarNode, excClause: Option[MuExcClause]): Unit = {
val _node = new NodeAtomicRMW(id, resultID, isPtr, ord, optr, refTy, loc, opnd, excClause)
onNewNodeCreated(_node)
}
def newFence(id: MuID, ord: MuMemOrd): Unit = {
def newFence(id: MuID, ord: MemoryOrder.Value): Unit = {
val _node = new NodeFence(id, ord)
onNewNodeCreated(_node)
}
......@@ -366,7 +367,7 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
val _node = new NodeWPBranch(id, wpid)
onNewNodeCreated(_node)
}
def newCCall(id: MuID, resultIds: Seq[MuID], callconv: MuCallConv, calleeTy: MuTypeNode, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
def newCCall(id: MuID, resultIds: Seq[MuID], callconv: Flag, calleeTy: MuTypeNode, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
val _node = new NodeCCall(id, resultIds, callconv, calleeTy, sig, callee, args, excClause, keepaliveClause)
onNewNodeCreated(_node)
}
......@@ -378,7 +379,7 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
val _node = new NodeSwapStack(id, resultIds, swappee, curStackClause, newStackClause, excClause, keepaliveClause)
onNewNodeCreated(_node)
}
def newCommInst(id: MuID, resultIds: Seq[MuID], opcode: MuCommInst, flags: Seq[MuFlag], tys: Seq[MuTypeNode], sigs: Seq[MuFuncSigNode], args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
def newCommInst(id: MuID, resultIds: Seq[MuID], opcode: CommInst, flags: Seq[Flag], tys: Seq[MuTypeNode], sigs: Seq[MuFuncSigNode], args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
val _node = new NodeCommInst(id, resultIds, opcode, flags, tys, sigs, args, excClause, keepaliveClause)
onNewNodeCreated(_node)
}
......
......@@ -21,18 +21,20 @@ object IRBuilderNode {
type MuNewStackClause = MuID
type MuWPID = MuID
type MuFlag = Int
type MuBinOptr = MuFlag
type MuCmpOptr = MuFlag
type MuConvOptr = MuFlag
type MuMemOrd = MuFlag
type MuAtomicRMWOptr = MuFlag
type MuCallConv = MuFlag
type MuCommInst = MuFlag
//type MuBinOptr = MuFlag
//type MuCmpOptr = MuFlag
//type MuConvOptr = MuFlag
//type MuMemOrd = MuFlag
//type MuAtomicRMWOptr = MuFlag
//type MuCallConv = MuFlag
//type MuCommInst = MuFlag
}
import IRBuilderNode._
import uvm.ssavariables._
import uvm.comminsts.CommInst
abstract class IRBuilderNode(val id: MuID)
abstract class IRBuilderNode(id: MuID)
// EXT:BEGIN:IRBUILDER_NODES
......@@ -76,7 +78,7 @@ case class NodeGlobalCell(id: MuID, ty: MuTypeNode) extends IRBuilderNode(id)
case class NodeFunc(id: MuID, sig: MuFuncSigNode) extends IRBuilderNode(id)
case class NodeExpFunc(id: MuID, func: MuFuncNode, callconv: MuCallConv, cookie: MuConstIntNode) extends IRBuilderNode(id)
case class NodeExpFunc(id: MuID, func: MuFuncNode, callconv: Flag, cookie: MuConstIntNode) extends IRBuilderNode(id)
case class NodeFuncVer(id: MuID, func: MuFuncNode, bbs: Seq[MuBBNode]) extends IRBuilderNode(id)
......@@ -85,7 +87,7 @@ case class NodeDestClause(id: MuID, dest: MuBBNode, vars: Seq[MuVarNode]) extend
case class NodeExcClause(id: MuID, nor: MuDestClause, exc: MuDestClause) extends IRBuilderNode(id)
case class NodeKeepAliveClasue(id: MuID, vars: Seq[MuLocalVarNode]) extends IRBuilderNode(id)
case class NodeKeepaliveClause(id: MuID, vars: Seq[MuLocalVarNode]) extends IRBuilderNode(id)
case class NodeCscRetWith(id: MuID, rettys: Seq[MuVarNode]) extends IRBuilderNode(id)
case class NodeCscKillOld(id: MuID) extends IRBuilderNode(id)
......@@ -93,9 +95,9 @@ case class NodeCscKillOld(id: MuID) extends IRBuilderNode(id)
case class NodeNscPassValues(id: MuID, tys: Seq[MuTypeNode], vars: Seq[MuVarNode]) extends IRBuilderNode(id)
case class NodeNscThrowExc(id: MuID, exc: MuVarNode) extends IRBuilderNode(id)
case class NodeBinOp(id: MuID, resultID: MuID, optr: MuBinOptr, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode, excClaues: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeCmp(id: MuID, resultID: MuID, optr: MuBinOptr, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode) extends IRBuilderNode(id)
case class NodeConv(id: MuID, resultID: MuID, optr: MuBinOptr, fromTy: MuTypeNode, toTy: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode(id)
case class NodeBinOp(id: MuID, resultID: MuID, optr: BinOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode, excClaues: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeCmp(id: MuID, resultID: MuID, optr: CmpOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode) extends IRBuilderNode(id)
case class NodeConv(id: MuID, resultID: MuID, optr: ConvOptr.Value, fromTy: MuTypeNode, toTy: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode(id)
case class NodeSelect(id: MuID, resultID: MuID, condTy: MuTypeNode, opndTy: MuTypeNode, cond: MuVarNode, ifTrue: MuVarNode, ifFalse: MuVarNode) extends IRBuilderNode(id)
case class NodeBranch(id: MuID, dest: MuDestClause) extends IRBuilderNode(id)
......@@ -119,17 +121,17 @@ case class NodeGetFieldIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuT
case class NodeGetElemIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode) extends IRBuilderNode(id)
case class NodeShiftIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, offty: MuTypeNode, opnd: MuVarNode, offset: MuVarNode) extends IRBuilderNode(id)
case class NodeGetVarPartIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode(id)
case class NodeLoad(id: MuID, resultID: MuID, isPtr: Boolean, ord: MuMemOrd, refty: MuTypeNode, loc: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeStore(id: MuID, isPtr: Boolean, ord: MuMemOrd, refty: MuTypeNode, loc: MuVarNode, newval: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeCmpXchg(id: MuID, valueResultID: MuID, succResultID: MuID, isPtr: Boolean, isWeak: Boolean, ordSucc: MuMemOrd, ordFail: MuMemOrd, refty: MuTypeNode, loc: MuVarNode, expected: MuVarNode, desired: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeAtomicRMW(id: MuID, resultID: MuID, isPtr: Boolean, ord: MuMemOrd, optr: MuAtomicRMWOptr, refTy: MuTypeNode, loc: MuVarNode, opnd: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeFence(id: MuID, ord: MuMemOrd) extends IRBuilderNode(id)
case class NodeLoad(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeStore(id: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, newval: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeCmpXchg(id: MuID, valueResultID: MuID, succResultID: MuID, isPtr: Boolean, isWeak: Boolean, ordSucc: MemoryOrder.Value, ordFail: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, expected: MuVarNode, desired: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeAtomicRMW(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, optr: AtomicRMWOptr.Value, refTy: MuTypeNode, loc: MuVarNode, opnd: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeFence(id: MuID, ord: MemoryOrder.Value) extends IRBuilderNode(id)
case class NodeTrap(id: MuID, resultIds: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeWatchPoint(id: MuID, wpid: MuWPID, resultIds: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeWPBranch(id: MuID, wpid: MuWPID) extends IRBuilderNode(id)
case class NodeCCall(id: MuID, resultIds: Seq[MuID], callconv: MuCallConv, calleeTy: MuTypeNode, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeCCall(id: MuID, resultIds: Seq[MuID], callconv: Flag, calleeTy: MuTypeNode, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeNewThread(id: MuID, resultID: MuID, stack: MuVarNode, threadlocal: Option[MuVarNode], newStackClause: MuNewStackClause, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeSwapStack(id: MuID, resultIds: Seq[MuID], swappee: MuVarNode, curStackClause: MuCurStackClause, newStackClause: MuNewStackClause, excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeCommInst(id: MuID, resultIds: Seq[MuID], opcode: MuCommInst, flags: Seq[MuFlag], tys: Seq[MuTypeNode], sigs: Seq[MuFuncSigNode], args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeCommInst(id: MuID, resultIds: Seq[MuID], opcode: CommInst, flags: Seq[Flag], tys: Seq[MuTypeNode], sigs: Seq[MuFuncSigNode], args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
// EXT:END:IRBUILDER_NODES
\ No newline at end of file
......@@ -884,7 +884,7 @@ val _raw_call_conv = _jffiBuffer.getInt(2)
val _raw_cookie = _jffiBuffer.getAddress(3)
val ctx = getMuCtx(_raw_ctx)
val func = getMuValueNotNull(_raw_func).asInstanceOf[MuFuncRefValue]
val call_conv = toFlag(_raw_call_conv)
val call_conv = toCallConv(_raw_call_conv)
val cookie = getMuValueNotNull(_raw_cookie).asInstanceOf[MuIntValue]
val _RV = ctx.expose(func, call_conv, cookie)
val _RV_FAK = exposeMuValue(ctx, _RV)
......@@ -895,7 +895,7 @@ val _raw_ctx = _jffiBuffer.getAddress(0)
val _raw_call_conv = _jffiBuffer.getInt(1)
val _raw_value = _jffiBuffer.getAddress(2)
val ctx = getMuCtx(_raw_ctx)
val call_conv = toFlag(_raw_call_conv)
val call_conv = toCallConv(_raw_call_conv)
val value = getMuValueNotNull(_raw_value).asInstanceOf[MuValue]
val _RV = ctx.unexpose(call_conv, value)
}
......@@ -1008,7 +1008,7 @@ val MUIRBUILDER__GEN_SYM = exposedMethod("MuIRBuilder.gen_sym", JType.UINT32, Ar
val _raw_b = _jffiBuffer.getAddress(0)
val _raw_name = _jffiBuffer.getAddress(1)
val b = getMuIRBuilder(_raw_b)
val name = readCString(_raw_name)
val name = readCStringOptional(_raw_name)
val _RV = b.genSym(name)
_jffiBuffer.setIntReturn(_RV)
}
......@@ -1168,6 +1168,13 @@ val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val _RV = b.newTypeFrameCursorRef(id)
}
val MUIRBUILDER__NEW_TYPE_IRBUILDERREF = exposedMethod("MuIRBuilder.new_type_irbuilderref", JType.VOID, Array(JType.POINTER, JType.UINT32)) { _jffiBuffer =>
val _raw_b = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val _RV = b.newTypeIRBuilderRef(id)
}
val MUIRBUILDER__NEW_FUNCSIG = exposedMethod("MuIRBuilder.new_funcsig", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
val _raw_b = _jffiBuffer.getAddress(0)
val _raw_id = _jffiBuffer.getInt(1)
......@@ -1285,7 +1292,7 @@ val _raw_cookie = _jffiBuffer.getInt(4)
val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val func = _raw_func
val callconv = toFlag(_raw_callconv)
val callconv = toCallConv(_raw_callconv)
val cookie = _raw_cookie
val _RV = b.newExpFunc(id, func, callconv, cookie)
}
......@@ -1312,7 +1319,7 @@ val _raw_ninsts = _jffiBuffer.getAddress(6)
val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val nor_param_ids = readIntArray(_raw_nor_param_ids, _raw_n_nor_param_ids)
val exc_param_id = _raw_exc_param_id
val exc_param_id = readMuIDOptional(_raw_exc_param_id)
val insts = readMuIDArray(_raw_insts, _raw_ninsts)
val _RV = b.newBB(id, nor_param_ids, exc_param_id, insts)
}
......@@ -1403,7 +1410,7 @@ val optr = toBinOptr(_raw_optr)
val ty = _raw_ty
val opnd1 = _raw_opnd1
val opnd2 = _raw_opnd2
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newBinOp(id, result_id, optr, ty, opnd1, opnd2, exc_clause)
}
val MUIRBUILDER__NEW_CMP = exposedMethod("MuIRBuilder.new_cmp", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1516,8 +1523,8 @@ val result_ids = readIntArray(_raw_result_ids, _raw_n_result_ids)
val sig = _raw_sig
val callee = _raw_callee
val args = readMuIDArray(_raw_args, _raw_nargs)
val exc_clause = _raw_exc_clause
val keepalive_clause = _raw_keepalive_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val keepalive_clause = readMuIDOptional(_raw_keepalive_clause)
val _RV = b.newCall(id, result_ids, sig, callee, args, exc_clause, keepalive_clause)
}
val MUIRBUILDER__NEW_TAILCALL = exposedMethod("MuIRBuilder.new_tailcall", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.POINTER, JType.POINTER)) { _jffiBuffer =>
......@@ -1650,7 +1657,7 @@ val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val result_id = _raw_result_id
val allocty = _raw_allocty
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newNew(id, result_id, allocty, exc_clause)
}
val MUIRBUILDER__NEW_NEWHYBRID = exposedMethod("MuIRBuilder.new_newhybrid", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1667,7 +1674,7 @@ val result_id = _raw_result_id
val allocty = _raw_allocty
val lenty = _raw_lenty
val length = _raw_length
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newNewHybrid(id, result_id, allocty, lenty, length, exc_clause)
}
val MUIRBUILDER__NEW_ALLOCA = exposedMethod("MuIRBuilder.new_alloca", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1680,7 +1687,7 @@ val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val result_id = _raw_result_id
val allocty = _raw_allocty
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newAlloca(id, result_id, allocty, exc_clause)
}
val MUIRBUILDER__NEW_ALLOCAHYBRID = exposedMethod("MuIRBuilder.new_allocahybrid", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1697,7 +1704,7 @@ val result_id = _raw_result_id
val allocty = _raw_allocty
val lenty = _raw_lenty
val length = _raw_length
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newAllocaHybrid(id, result_id, allocty, lenty, length, exc_clause)
}
val MUIRBUILDER__NEW_GETIREF = exposedMethod("MuIRBuilder.new_getiref", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1799,7 +1806,7 @@ val is_ptr = intToBoolean(_raw_is_ptr)
val ord = toMemoryOrder(_raw_ord)
val refty = _raw_refty
val loc = _raw_loc
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newLoad(id, result_id, is_ptr, ord, refty, loc, exc_clause)
}
val MUIRBUILDER__NEW_STORE = exposedMethod("MuIRBuilder.new_store", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.SINT, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1818,7 +1825,7 @@ val ord = toMemoryOrder(_raw_ord)
val refty = _raw_refty
val loc = _raw_loc
val newval = _raw_newval
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newStore(id, is_ptr, ord, refty, loc, newval, exc_clause)
}
val MUIRBUILDER__NEW_CMPXCHG = exposedMethod("MuIRBuilder.new_cmpxchg", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.SINT, JType.SINT, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1847,7 +1854,7 @@ val refty = _raw_refty
val loc = _raw_loc
val expected = _raw_expected
val desired = _raw_desired
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newCmpXchg(id, value_result_id, succ_result_id, is_ptr, is_weak, ord_succ, ord_fail, refty, loc, expected, desired, exc_clause)
}
val MUIRBUILDER__NEW_ATOMICRMW = exposedMethod("MuIRBuilder.new_atomicrmw", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.SINT, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1870,7 +1877,7 @@ val optr = toAtomicRMWOptr(_raw_optr)
val refTy = _raw_refTy
val loc = _raw_loc
val opnd = _raw_opnd
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newAtomicRMW(id, result_id, is_ptr, ord, optr, refTy, loc, opnd, exc_clause)
}
val MUIRBUILDER__NEW_FENCE = exposedMethod("MuIRBuilder.new_fence", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1894,8 +1901,8 @@ val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val result_ids = readIntArray(_raw_result_ids, _raw_nretvals)
val rettys = readMuIDArray(_raw_rettys, _raw_nretvals)
val exc_clause = _raw_exc_clause
val keepalive_clause = _raw_keepalive_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val keepalive_clause = readMuIDOptional(_raw_keepalive_clause)
val _RV = b.newTrap(id, result_ids, rettys, exc_clause, keepalive_clause)
}
val MUIRBUILDER__NEW_WATCHPOINT = exposedMethod("MuIRBuilder.new_watchpoint", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.POINTER, JType.POINTER, JType.POINTER, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1912,8 +1919,8 @@ val id = _raw_id
val wpid = _raw_wpid
val result_ids = readIntArray(_raw_result_ids, _raw_nretvals)
val rettys = readMuIDArray(_raw_rettys, _raw_nretvals)
val exc_clause = _raw_exc_clause
val keepalive_clause = _raw_keepalive_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val keepalive_clause = readMuIDOptional(_raw_keepalive_clause)
val _RV = b.newWatchPoint(id, wpid, result_ids, rettys, exc_clause, keepalive_clause)
}
val MUIRBUILDER__NEW_WPBRANCH = exposedMethod("MuIRBuilder.new_wpbranch", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1941,13 +1948,13 @@ val _raw_keepalive_clause = _jffiBuffer.getInt(11)
val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val result_ids = readIntArray(_raw_result_ids, _raw_n_result_ids)
val callconv = toFlag(_raw_callconv)
val callconv = toCallConv(_raw_callconv)
val callee_ty = _raw_callee_ty
val sig = _raw_sig
val callee = _raw_callee
val args = readMuIDArray(_raw_args, _raw_nargs)
val exc_clause = _raw_exc_clause
val keepalive_clause = _raw_keepalive_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val keepalive_clause = readMuIDOptional(_raw_keepalive_clause)
val _RV = b.newCCall(id, result_ids, callconv, callee_ty, sig, callee, args, exc_clause, keepalive_clause)
}
val MUIRBUILDER__NEW_NEWTHREAD = exposedMethod("MuIRBuilder.new_newthread", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1962,9 +1969,9 @@ val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val result_id = _raw_result_id
val stack = _raw_stack
val threadlocal = _raw_threadlocal
val threadlocal = readMuIDOptional(_raw_threadlocal)
val new_stack_clause = _raw_new_stack_clause
val exc_clause = _raw_exc_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val _RV = b.newNewThread(id, result_id, stack, threadlocal, new_stack_clause, exc_clause)
}
val MUIRBUILDER__NEW_SWAPSTACK = exposedMethod("MuIRBuilder.new_swapstack", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.POINTER, JType.POINTER, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -1983,8 +1990,8 @@ val result_ids = readIntArray(_raw_result_ids, _raw_n_result_ids)
val swappee = _raw_swappee
val cur_stack_clause = _raw_cur_stack_clause
val new_stack_clause = _raw_new_stack_clause
val exc_clause = _raw_exc_clause
val keepalive_clause = _raw_keepalive_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val keepalive_clause = readMuIDOptional(_raw_keepalive_clause)
val _RV = b.newSwapStack(id, result_ids, swappee, cur_stack_clause, new_stack_clause, exc_clause, keepalive_clause)
}
val MUIRBUILDER__NEW_COMMINST = exposedMethod("MuIRBuilder.new_comminst", JType.VOID, Array(JType.POINTER, JType.UINT32, JType.POINTER, JType.POINTER, JType.UINT32, JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER, JType.POINTER, JType.UINT32, JType.UINT32)) { _jffiBuffer =>
......@@ -2006,16 +2013,16 @@ val _raw_keepalive_clause = _jffiBuffer.getInt(14)
val b = getMuIRBuilder(_raw_b)
val id = _raw_id
val result_ids = readIntArray(_raw_result_ids, _raw_n_result_ids)
val opcode = _raw_opcode
val opcode = toCommInst(_raw_opcode)
val flags = readFlagArray(_raw_flags, _raw_nflags)
val tys = readMuIDArray(_raw_tys, _raw_ntys)
val sigs = readMuIDArray(_raw_sigs, _raw_nsigs)
val args = readMuIDArray(_raw_args, _raw_nargs)
val exc_clause = _raw_exc_clause
val keepalive_clause = _raw_keepalive_clause
val exc_clause = readMuIDOptional(_raw_exc_clause)
val keepalive_clause = readMuIDOptional(_raw_keepalive_clause)
val _RV = b.newCommInst(id, result_ids, opcode, flags, tys, sigs, args, exc_clause, keepalive_clause)
}
val stubsOfMuIRBuilder = new Array[Word](78)
val stubsOfMuIRBuilder = new Array[Word](79)
stubsOfMuIRBuilder(0) = MUIRBUILDER__LOAD.address
stubsOfMuIRBuilder(1) = MUIRBUILDER__ABORT.address
stubsOfMuIRBuilder(2) = MUIRBUILDER__GEN_SYM.address
......@@ -2037,63 +2044,64 @@ stubsOfMuIRBuilder(17) = MUIRBUILDER__NEW_TYPE_TAGREF64.address
stubsOfMuIRBuilder(18) = MUIRBUILDER__NEW_TYPE_THREADREF.address
stubsOfMuIRBuilder(19) = MUIRBUILDER__NEW_TYPE_STACKREF.address
stubsOfMuIRBuilder(20) = MUIRBUILDER__NEW_TYPE_FRAMECURSORREF.address
stubsOfMuIRBuilder(21) = MUIRBUILDER__NEW_FUNCSIG.address
stubsOfMuIRBuilder(22) = MUIRBUILDER__NEW_CONST_INT.address
stubsOfMuIRBuilder(23) = MUIRBUILDER__NEW_CONST_INT_EX.address
stubsOfMuIRBuilder(24) = MUIRBUILDER__NEW_CONST_FLOAT.address
stubsOfMuIRBuilder(25) = MUIRBUILDER__NEW_CONST_DOUBLE.address
stubsOfMuIRBuilder(26) = MUIRBUILDER__NEW_CONST_NULL.address
stubsOfMuIRBuilder(27) = MUIRBUILDER__NEW_CONST_SEQ.address
stubsOfMuIRBuilder(28) = MUIRBUILDER__NEW_CONST_EXTERN.address
stubsOfMuIRBuilder(29) = MUIRBUILDER__NEW_GLOBAL_CELL.address
stubsOfMuIRBuilder(30) = MUIRBUILDER__NEW_FUNC.address
stubsOfMuIRBuilder(31) = MUIRBUILDER__NEW_EXP_FUNC.address
stubsOfMuIRBuilder(32) = MUIRBUILDER__NEW_FUNC_VER.address
stubsOfMuIRBuilder(33) = MUIRBUILDER__NEW_BB.address
stubsOfMuIRBuilder(34) = MUIRBUILDER__NEW_DEST_CLAUSE.address
stubsOfMuIRBuilder(35) = MUIRBUILDER__NEW_EXC_CLAUSE.address
stubsOfMuIRBuilder(36) = MUIRBUILDER__NEW_KEEPALIVE_CLAUSE.address
stubsOfMuIRBuilder(37) = MUIRBUILDER__NEW_CSC_RET_WITH.address
stubsOfMuIRBuilder(38) = MUIRBUILDER__NEW_CSC_KILL_OLD.address
stubsOfMuIRBuilder(39) = MUIRBUILDER__NEW_NSC_PASS_VALUES.address
stubsOfMuIRBuilder(40) = MUIRBUILDER__NEW_NSC_THROW_EXC.address
stubsOfMuIRBuilder(41) = MUIRBUILDER__NEW_BINOP.address
stubsOfMuIRBuilder(42) = MUIRBUILDER__NEW_CMP.address
stubsOfMuIRBuilder(43) = MUIRBUILDER__NEW_CONV.address
stubsOfMuIRBuilder(44) = MUIRBUILDER__NEW_SELECT.address
stubsOfMuIRBuilder(45) = MUIRBUILDER__NEW_BRANCH.address
stubsOfMuIRBuilder(46) = MUIRBUILDER__NEW_BRANCH2.address
stubsOfMuIRBuilder(47) = MUIRBUILDER__NEW_SWITCH.address
stubsOfMuIRBuilder(48) = MUIRBUILDER__NEW_CALL.address
stubsOfMuIRBuilder(49) = MUIRBUILDER__NEW_TAILCALL.address
stubsOfMuIRBuilder(50) = MUIRBUILDER__NEW_RET.address
stubsOfMuIRBuilder(51) = MUIRBUILDER__NEW_THROW.address
stubsOfMuIRBuilder(52) = MUIRBUILDER__NEW_EXTRACTVALUE.address
stubsOfMuIRBuilder(53) = MUIRBUILDER__NEW_INSERTVALUE.address
stubsOfMuIRBuilder(54) = MUIRBUILDER__NEW_EXTRACTELEMENT.address
stubsOfMuIRBuilder(55) = MUIRBUILDER__NEW_INSERTELEMENT.address
stubsOfMuIRBuilder(56) = MUIRBUILDER__NEW_SHUFFLEVECTOR.address
stubsOfMuIRBuilder(57) = MUIRBUILDER__NEW_NEW.address
stubsOfMuIRBuilder(58) = MUIRBUILDER__NEW_NEWHYBRID.address
stubsOfMuIRBuilder(59) = MUIRBUILDER__NEW_ALLOCA.address
stubsOfMuIRBuilder(60) = MUIRBUILDER__NEW_ALLOCAHYBRID.address
stubsOfMuIRBuilder(61) = MUIRBUILDER__NEW_GETIREF.address
stubsOfMuIRBuilder(62) = MUIRBUILDER__NEW_GETFIELDIREF.address
stubsOfMuIRBuilder(63) = MUIRBUILDER__NEW_GETELEMIREF.address
stubsOfMuIRBuilder(64) = MUIRBUILDER__NEW_SHIFTIREF.address
stubsOfMuIRBuilder(65) = MUIRBUILDER__NEW_GETVARPARTIREF.address
stubsOfMuIRBuilder(66) = MUIRBUILDER__NEW_LOAD.address
stubsOfMuIRBuilder(67) = MUIRBUILDER__NEW_STORE.address
stubsOfMuIRBuilder(68) = MUIRBUILDER__NEW_CMPXCHG.address
stubsOfMuIRBuilder(69) = MUIRBUILDER__NEW_ATOMICRMW.address
stubsOfMuIRBuilder(70) = MUIRBUILDER__NEW_FENCE.address
stubsOfMuIRBuilder(71) = MUIRBUILDER__NEW_TRAP.address
stubsOfMuIRBuilder(72) = MUIRBUILDER__NEW_WATCHPOINT.address
stubsOfMuIRBuilder(73) = MUIRBUILDER__NEW_WPBRANCH.address
stubsOfMuIRBuilder(74) = MUIRBUILDER__NEW_CCALL.address
stubsOfMuIRBuilder(75) = MUIRBUILDER__NEW_NEWTHREAD.address
stubsOfMuIRBuilder(76) = MUIRBUILDER__NEW_SWAPSTACK.address
stubsOfMuIRBuilder(77) = MUIRBUILDER__NEW_COMMINST.address
stubsOfMuIRBuilder(21) = MUIRBUILDER__NEW_TYPE_IRBUILDERREF.address
stubsOfMuIRBuilder(22) = MUIRBUILDER__NEW_FUNCSIG.address
stubsOfMuIRBuilder(23) = MUIRBUILDER__NEW_CONST_INT.address
stubsOfMuIRBuilder(24) = MUIRBUILDER__NEW_CONST_INT_EX.address
stubsOfMuIRBuilder(25) = MUIRBUILDER__NEW_CONST_FLOAT.address
stubsOfMuIRBuilder(26) = MUIRBUILDER__NEW_CONST_DOUBLE.address
stubsOfMuIRBuilder(27) = MUIRBUILDER__NEW_CONST_NULL.address
stubsOfMuIRBuilder(28) = MUIRBUILDER__NEW_CONST_SEQ.address
stubsOfMuIRBuilder(29) = MUIRBUILDER__NEW_CONST_EXTERN.address
stubsOfMuIRBuilder(30) = MUIRBUILDER__NEW_GLOBAL_CELL.address
stubsOfMuIRBuilder(31) = MUIRBUILDER__NEW_FUNC.address
stubsOfMuIRBuilder(32) = MUIRBUILDER__NEW_EXP_FUNC.address
stubsOfMuIRBuilder(33) = MUIRBUILDER__NEW_FUNC_VER.address
stubsOfMuIRBuilder(34) = MUIRBUILDER__NEW_BB.address
stubsOfMuIRBuilder(35) = MUIRBUILDER__NEW_DEST_CLAUSE.address
stubsOfMuIRBuilder(36) = MUIRBUILDER__NEW_EXC_CLAUSE.address
stubsOfMuIRBuilder(37) = MUIRBUILDER__NEW_KEEPALIVE_CLAUSE.address
stubsOfMuIRBuilder(38) = MUIRBUILDER__NEW_CSC_RET_WITH.address
stubsOfMuIRBuilder(39) = MUIRBUILDER__NEW_CSC_KILL_OLD.address
stubsOfMuIRBuilder(40) = MUIRBUILDER__NEW_NSC_PASS_VALUES.address
stubsOfMuIRBuilder(41) = MUIRBUILDER__NEW_NSC_THROW_EXC.address
stubsOfMuIRBuilder(42) = MUIRBUILDER__NEW_BINOP.address
stubsOfMuIRBuilder(43) = MUIRBUILDER__NEW_CMP.address
stubsOfMuIRBuilder(44) = MUIRBUILDER__NEW_CONV.address
stubsOfMuIRBuilder(45) = MUIRBUILDER__NEW_SELECT.address
stubsOfMuIRBuilder(46) = MUIRBUILDER__NEW_BRANCH.address