Commit b60e8b56 authored by Kunshan Wang's avatar Kunshan Wang

fixed add_dest

parent f6d369d9
......@@ -181,10 +181,11 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
val destClause = DestClause(bb, vars)
kind match {
case DestKind.NORMAL => inst.obj match {
case i: InstBranch => i.dest = destClause
case i: HasExcClause => getOrCreateExcClause(i).nor = destClause
case i => {
throw new IllegalArgumentException(
"NORMAL requires instruction with exception clause. Found: %s".format(i.getClass.getName))
"NORMAL requires BRANCH or instructions with exception clause. Found: %s".format(i.getClass.getName))
}
}
case DestKind.EXCEPT => inst.obj match {
......@@ -194,7 +195,7 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
}
case i => {
throw new IllegalArgumentException(
"EXCEPT requires WATCHPOINT or instruction with exception clause. Found: %s".format(i.getClass.getName))
"EXCEPT requires WATCHPOINT or instructions with exception clause. Found: %s".format(i.getClass.getName))
}
}
case DestKind.TRUE => inst.obj match {
......
......@@ -695,7 +695,7 @@ object MemoryOperations {
IndexedSeq[Long]()
} else {
for (i <- 0L until len) yield {
val addr = base + i * WORD_SIZE_BYTES
val addr = base + i * 8L
val v = memorySupport.loadLong(addr)
v
}
......
......@@ -227,10 +227,21 @@ void malloc_freer(MuValue *values, MuCPtr freerdata) {
void nop_freer(MuValue *values, MuCPtr freerdata) {
}
void simple_trap_handler(MuCtx *ctx, MuThreadRefValue thread,
MuStackRefValue stack, MuWPID wpid, MuTrapHandlerResult *result,
MuStackRefValue *new_stack, MuValue **values, int *nvalues,
MuValuesFreer *freer, MuCPtr *freerdata, MuRefValue *exception,
void simple_trap_handler(
// input parameters
MuCtx *ctx,
MuThreadRefValue thread,
MuStackRefValue stack,
MuWPID wpid,
// output parameters
MuTrapHandlerResult *result,
MuStackRefValue *new_stack,
MuValue **values,
MuArraySize *nvalues,
MuValuesFreer *freer,
MuCPtr *freerdata,
MuRefValue *exception,
// input parameter (userdata)
MuCPtr userdata) {
muprintf("Hi! I am the native trap handler!\n");
......@@ -339,10 +350,21 @@ bool test_traps(MuVM *mvm) {
return true;
}
void load_bundle_trap_handler(MuCtx *ctx, MuThreadRefValue thread,
MuStackRefValue stack, MuWPID wpid, MuTrapHandlerResult *result,
MuStackRefValue *new_stack, MuValue **values, int *nvalues,
MuValuesFreer *freer, MuCPtr *freerdata, MuRefValue *exception,
void load_bundle_trap_handler(
// input parameters
MuCtx *ctx,
MuThreadRefValue thread,
MuStackRefValue stack,
MuWPID wpid,
// output parameters
MuTrapHandlerResult *result,
MuStackRefValue *new_stack,
MuValue **values,
MuArraySize *nvalues,
MuValuesFreer *freer,
MuCPtr *freerdata,
MuRefValue *exception,
// input parameter (userdata)
MuCPtr userdata) {
muprintf("Hi! I am the native trap handler!\n");
......@@ -539,10 +561,21 @@ bool test_memory_ops(MuVM *mvm) {
return true;
}
void osr_bundle_trap_handler(MuCtx *ctx, MuThreadRefValue thread,
MuStackRefValue stack, MuWPID wpid, MuTrapHandlerResult *result,
MuStackRefValue *new_stack, MuValue **values, int *nvalues,
MuValuesFreer *freer, MuCPtr *freerdata, MuRefValue *exception,
void osr_bundle_trap_handler(
// input parameters
MuCtx *ctx,
MuThreadRefValue thread,
MuStackRefValue stack,
MuWPID wpid,
// output parameters
MuTrapHandlerResult *result,
MuStackRefValue *new_stack,
MuValue **values,
MuArraySize *nvalues,
MuValuesFreer *freer,
MuCPtr *freerdata,
MuRefValue *exception,
// input parameter (userdata)
MuCPtr userdata) {
muprintf("Hi! I am the native trap handler!\n");
......@@ -736,10 +769,21 @@ struct wp_trap_data {
int which;
};
void wp_trap_handler(MuCtx *ctx, MuThreadRefValue thread,
MuStackRefValue stack, MuWPID wpid, MuTrapHandlerResult *result,
MuStackRefValue *new_stack, MuValue **values, int *nvalues,
MuValuesFreer *freer, MuCPtr *freerdata, MuRefValue *exception,
void wp_trap_handler(
// input parameters
MuCtx *ctx,
MuThreadRefValue thread,
MuStackRefValue stack,
MuWPID wpid,
// output parameters
MuTrapHandlerResult *result,
MuStackRefValue *new_stack,
MuValue **values,
MuArraySize *nvalues,
MuValuesFreer *freer,
MuCPtr *freerdata,
MuRefValue *exception,
// input parameter (userdata)
MuCPtr userdata) {
muprintf("Hi! I am the native trap handler!\n");
......@@ -828,10 +872,21 @@ int native_callback(int v2) {
return v2+1;
}
void native_trap_handler(MuCtx *ctx, MuThreadRefValue thread,
MuStackRefValue stack, MuWPID wpid, MuTrapHandlerResult *result,
MuStackRefValue *new_stack, MuValue **values, int *nvalues,
MuValuesFreer *freer, MuCPtr *freerdata, MuRefValue *exception,
void native_trap_handler(
// input parameters
MuCtx *ctx,
MuThreadRefValue thread,
MuStackRefValue stack,
MuWPID wpid,
// output parameters
MuTrapHandlerResult *result,
MuStackRefValue *new_stack,
MuValue **values,
MuArraySize *nvalues,
MuValuesFreer *freer,
MuCPtr *freerdata,
MuRefValue *exception,
// input parameter (userdata)
MuCPtr userdata) {
muprintf("Hi! I am the native trap handler!\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment