1st draft of merging with develop branch: Hopefully passing rustfmt

parent c075b1e4
......@@ -56,19 +56,25 @@ fn built() {
#[cfg(feature = "sel4-rumprun-target-side")]
#[cfg(target_arch = "x86_64")]
fn main() {
use std::path::Path;
let mut compiler_name = String::new();
compiler_name.push_str("x86_64-rumprun-netbsd-gcc");
gcc::Config::new().flag("-O3").flag("-c")
.compiler(Path::new(compiler_name.as_str()))
.file("src/runtime/runtime_x64_sel4_rumprun_sysv.c")
.compile("libruntime_c.a");
gcc::Config::new().flag("-O3").flag("-c")
.compiler(Path::new(compiler_name.as_str()))
.file("src/runtime/runtime_asm_x64_sel4_rumprun_sysv.S")
.compile("libruntime_asm.a");
gcc::Config::new().flag("-O3").flag("-c")
.compiler(Path::new(compiler_name.as_str()))
.file("zebu_c_helpers.c")
.compile("libzebu_c_helpers.a");
use std::path::Path;
let mut compiler_name = String::new();
compiler_name.push_str("x86_64-rumprun-netbsd-gcc");
gcc::Config::new()
.flag("-O3")
.flag("-c")
.compiler(Path::new(compiler_name.as_str()))
.file("src/runtime/runtime_x64_sel4_rumprun_sysv.c")
.compile("libruntime_c.a");
gcc::Config::new()
.flag("-O3")
.flag("-c")
.compiler(Path::new(compiler_name.as_str()))
.file("src/runtime/runtime_asm_x64_sel4_rumprun_sysv.S")
.compile("libruntime_asm.a");
gcc::Config::new()
.flag("-O3")
.flag("-c")
.compiler(Path::new(compiler_name.as_str()))
.file("zebu_c_helpers.c")
.compile("libzebu_c_helpers.a");
}
......@@ -656,7 +656,8 @@ macro_rules! inst {
This macro is used as follows:
1- for a test like add_simple(int, int) -> int,
the following syntax should be used (each I means an int):
emit_test! ((vm) (add add_test1 add_test1_v1 III (sig, int64(22), int64(27), int64(49))));
emit_test! ((vm) (add add_test1 add_test1_v1
III (sig, int64(22), int64(27), int64(49))));
2- for a test like add_double(double, double) -> double,
the following syntax should be used (each I means an int):
emit_test! ((vm) (double_add test1 FFF (sig, f64(1f64), f64(1f64), f64(2f64))));
......@@ -670,256 +671,21 @@ Macro limitations and points to use:
****************************************/
macro_rules! emit_test {
/*
emit_test! ((vm) (add add_test1 add_test1_v1 III (sig, int64(22), int64(27), int64(49))));
emit_test! ((vm)
udiv udiv_test1 udiv_test1_v1
Int,Int, Int
EQ
udiv_sig
int64(22), int64(4), int64(5)
);
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident III ($test_sig: ident, $ty1: ident($in1: expr), $ty2: ident($in2: expr), $ty3: ident($out: expr)))) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
constdef! (($vm) <int64t> int64_fail = Constant::Int(1));
constdef! (($vm) <$ty1> int64_0 = Constant::Int($in1));
constdef! (($vm) <$ty2> int64_1 = Constant::Int($in2));
constdef! (($vm) <$ty3> int64_2 = Constant::Int($out));
funcsig! (($vm) tester_sig = () -> ());
funcdecl! (($vm) <tester_sig> $test_name);
funcdef! (($vm) <tester_sig> $test_name VERSION $tester_name);
ssa! (($vm, $tester_name) <$ty1> a);
ssa! (($vm, $tester_name) <$ty1> b);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
consta! (($vm, $tester_name) int64_0_local = int64_0);
consta! (($vm, $tester_name) int64_1_local = int64_1);
block! (($vm, $tester_name) blk_entry);
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
ssa! (($vm, $tester_name) <$ty3> result);
inst! (($vm, $tester_name) blk_entry_call:
result = EXPRCALL (CallConvention::Mu, is_abort: false) const_funcref_local (int64_0_local, int64_1_local)
);
consta! (($vm, $tester_name) int64_2_local = int64_2);
consta! (($vm, $tester_name) int64_pass_local = int64_pass);
consta! (($vm, $tester_name) int64_fail_local = int64_fail);
ssa! (($vm, $tester_name) <int1> cmp_res);
inst! (($vm, $tester_name) blk_entry_cmp:
cmp_res = CMPOP (CmpOp::EQ) result int64_2_local
);
ssa! (($vm, $tester_name) <int64t> blk_entry_ret);
inst! (($vm, $tester_name) blk_entry_inst_select:
blk_entry_ret = SELECT cmp_res int64_pass_local int64_fail_local
);
inst! (($vm, $tester_name) blk_entry_inst_ret:
SET_RETVAL blk_entry_ret
);
inst! (($vm, $tester_name) blk_entry_inst_exit:
THREADEXIT
);
define_block! (($vm, $tester_name) blk_entry(a, b) {
blk_entry_call,
blk_entry_cmp,
blk_entry_inst_select,
blk_entry_inst_ret,
blk_entry_inst_exit
});
define_func_ver! (($vm) $tester_name (entry: blk_entry) {
blk_entry
});
};
/*
emit_test! ((vm) (allocation_fastpath allocation_fastpath_test1 allocation_fastpath_test1_v1 --- (sig)));
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident --- ($test_sig: ident))) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
constdef! (($vm) <int64t> int64_fail = Constant::Int(1));
funcsig! (($vm) tester_sig = () -> ());
funcdecl! (($vm) <tester_sig> $test_name);
funcdef! (($vm) <tester_sig> $test_name VERSION $tester_name);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
block! (($vm, $tester_name) blk_entry);
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
inst! (($vm, $tester_name) blk_entry_call:
EXPRCALL (CallConvention::Mu, is_abort: false) const_funcref_local ()
);
consta! (($vm, $tester_name) int64_pass_local = int64_pass);
consta! (($vm, $tester_name) int64_fail_local = int64_fail);
inst! (($vm, $tester_name) blk_entry_inst_ret:
SET_RETVAL int64_pass_local
);
inst! (($vm, $tester_name) blk_entry_inst_exit:
THREADEXIT
);
define_block! (($vm, $tester_name) blk_entry() {
blk_entry_call,
blk_entry_inst_ret,
blk_entry_inst_exit
});
define_func_ver! (($vm) $tester_name (entry: blk_entry) {
blk_entry
});
};
/*
emit_test! ((vm) (float_add float_add_test1 float_add_test1_v1 FFF (float_add_sig, float(1f32), float(1f32), float(2f32))));
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident FFF ($test_sig: ident, $ty1: ident($in1: expr), $ty2: ident($in2: expr), $ty3: ident($out: expr)))) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
constdef! (($vm) <int64t> int64_fail = Constant::Int(1));
constdef! (($vm) <$ty1> f32_0 = Constant::Float($in1));
constdef! (($vm) <$ty2> f32_1 = Constant::Float($in2));
constdef! (($vm) <$ty3> f32_2 = Constant::Float($out));
funcsig! (($vm) tester_sig = () -> ());
funcdecl! (($vm) <tester_sig> $test_name);
funcdef! (($vm) <tester_sig> $test_name VERSION $tester_name);
ssa! (($vm, $tester_name) <$ty1> a);
ssa! (($vm, $tester_name) <$ty1> b);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
consta! (($vm, $tester_name) f32_0_local = f32_0);
consta! (($vm, $tester_name) f32_1_local = f32_1);
block! (($vm, $tester_name) blk_entry);
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
ssa! (($vm, $tester_name) <$ty3> result);
inst! (($vm, $tester_name) blk_entry_call:
result = EXPRCALL (CallConvention::Mu, is_abort: false) const_funcref_local (f32_0_local, f32_1_local)
);
consta! (($vm, $tester_name) f32_2_local = f32_2);
consta! (($vm, $tester_name) int64_pass_local = int64_pass);
consta! (($vm, $tester_name) int64_fail_local = int64_fail);
ssa! (($vm, $tester_name) <int1> cmp_res);
inst! (($vm, $tester_name) blk_entry_cmp:
cmp_res = CMPOP (CmpOp::FOEQ) result f32_2_local
);
ssa! (($vm, $tester_name) <int64t> blk_entry_ret);
inst! (($vm, $tester_name) blk_entry_inst_select:
blk_entry_ret = SELECT cmp_res int64_pass_local int64_fail_local
);
inst! (($vm, $tester_name) blk_entry_inst_ret:
SET_RETVAL blk_entry_ret
);
inst! (($vm, $tester_name) blk_entry_inst_exit:
THREADEXIT
);
define_block! (($vm, $tester_name) blk_entry(a, b) {
blk_entry_call,
blk_entry_cmp,
blk_entry_inst_select,
blk_entry_inst_ret,
blk_entry_inst_exit
});
define_func_ver! (($vm) $tester_name (entry: blk_entry) {
blk_entry
});
};
/*
emit_test! ((vm) (double_add double_add_test1 double_add_test1_v1 DDD (double_add_sig, double(1f64), double(1f64), double(2f64))));
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident DDD ($test_sig: ident, $ty1: ident($in1: expr), $ty2: ident($in2: expr), $ty3: ident($out: expr)))) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
constdef! (($vm) <int64t> int64_fail = Constant::Int(1));
constdef! (($vm) <$ty1> f64_0 = Constant::Double($in1));
constdef! (($vm) <$ty2> f64_1 = Constant::Double($in2));
constdef! (($vm) <$ty3> f64_2 = Constant::Double($out));
funcsig! (($vm) tester_sig = () -> ());
funcdecl! (($vm) <tester_sig> $test_name);
funcdef! (($vm) <tester_sig> $test_name VERSION $tester_name);
ssa! (($vm, $tester_name) <$ty1> a);
ssa! (($vm, $tester_name) <$ty1> b);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
consta! (($vm, $tester_name) f64_0_local = f64_0);
consta! (($vm, $tester_name) f64_1_local = f64_1);
block! (($vm, $tester_name) blk_entry);
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
ssa! (($vm, $tester_name) <$ty3> result);
inst! (($vm, $tester_name) blk_entry_call:
result = EXPRCALL (CallConvention::Mu, is_abort: false) const_funcref_local (f64_0_local, f64_1_local)
);
consta! (($vm, $tester_name) f64_2_local = f64_2);
consta! (($vm, $tester_name) int64_pass_local = int64_pass);
consta! (($vm, $tester_name) int64_fail_local = int64_fail);
ssa! (($vm, $tester_name) <int1> cmp_res);
inst! (($vm, $tester_name) blk_entry_cmp:
cmp_res = CMPOP (CmpOp::FOEQ) result f64_2_local
);
ssa! (($vm, $tester_name) <int64t> blk_entry_ret);
inst! (($vm, $tester_name) blk_entry_inst_select:
blk_entry_ret = SELECT cmp_res int64_pass_local int64_fail_local
);
inst! (($vm, $tester_name) blk_entry_inst_ret:
SET_RETVAL blk_entry_ret
);
inst! (($vm, $tester_name) blk_entry_inst_exit:
THREADEXIT
);
define_block! (($vm, $tester_name) blk_entry(a, b) {
blk_entry_call,
blk_entry_cmp,
blk_entry_inst_select,
blk_entry_inst_ret,
blk_entry_inst_exit
});
define_func_ver! (($vm) $tester_name (entry: blk_entry) {
blk_entry
});
};
/*
emit_test! ((vm) (double_add double_add_test1 double_add_test1_v1 Double,Double,Double,FOEQ (double_add_sig, double(1f64), double(1f64), double(2f64))));
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident $Arg1Type: ident,$Arg2Type: ident,$Arg3Type: ident,$CMPType: ident ($test_sig: ident, $ty1: ident($in1: expr), $ty2: ident($in2: expr), $ty3: ident($out: expr)))) => {
(($vm: expr)
$name: ident, $test_name: ident, $tester_name: ident,
$Arg1Type: ident, $Arg2Type: ident RET $Arg3Type: ident,
$CMPType: ident,
$test_sig: ident,
$ty1: ident($in1: expr), $ty2: ident($in2: expr) RET $ty3: ident($out: expr),
) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
......@@ -936,7 +702,8 @@ macro_rules! emit_test {
ssa! (($vm, $tester_name) <$ty1> b);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
constdef! (($vm) <type_funcref> const_funcref =
Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
consta! (($vm, $tester_name) f64_0_local = f64_0);
......@@ -947,7 +714,8 @@ macro_rules! emit_test {
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
ssa! (($vm, $tester_name) <$ty3> result);
inst! (($vm, $tester_name) blk_entry_call:
result = EXPRCALL (CallConvention::Mu, is_abort: false) const_funcref_local (f64_0_local, f64_1_local)
result = EXPRCALL (CallConvention::Mu, is_abort: false)
const_funcref_local (f64_0_local, f64_1_local)
);
consta! (($vm, $tester_name) f64_2_local = f64_2);
......@@ -984,9 +752,20 @@ macro_rules! emit_test {
};
/*
emit_test! ((vm) (test_sitofp test_sitofp_test1 test_sitofp_test1_v1 Int,Double,EQ (sig, int64(-1i64), double(-1f64))));
emit_test! ((vm) (test_sitofp, test_sitofp_test1, test_sitofp_test1_v1)
Int -> Double
EQ
sig
int64(-1i64) -> double(-1f64)
);
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident $Arg1Type: ident,$Arg3Type: ident,$CMPType: ident ($test_sig: ident, $ty1: ident($in1: expr), $ty3: ident($out: expr)))) => {
(($vm: expr)
$name: ident, $test_name: ident, $tester_name: ident,
$Arg1Type: ident RET $Arg3Type: ident,
$CMPType: ident,
$test_sig: ident,
$ty1: ident($in1: expr) RET $ty3: ident($out: expr),
) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
......@@ -997,21 +776,20 @@ macro_rules! emit_test {
funcsig! (($vm) tester_sig = () -> ());
funcdecl! (($vm) <tester_sig> $test_name);
funcdef! (($vm) <tester_sig> $test_name VERSION $tester_name);
ssa! (($vm, $tester_name) <$ty1> a);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
constdef! (($vm) <type_funcref> const_funcref =
Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
consta! (($vm, $tester_name) f64_0_local = f64_0);
block! (($vm, $tester_name) blk_entry);
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
ssa! (($vm, $tester_name) <$ty3> result);
inst! (($vm, $tester_name) blk_entry_call:
result = EXPRCALL (CallConvention::Mu, is_abort: false) const_funcref_local (f64_0_local)
result = EXPRCALL (CallConvention::Mu, is_abort: false)
const_funcref_local (f64_0_local)
);
consta! (($vm, $tester_name) f64_2_local = f64_2);
......@@ -1033,7 +811,6 @@ macro_rules! emit_test {
inst! (($vm, $tester_name) blk_entry_inst_exit:
THREADEXIT
);
define_block! (($vm, $tester_name) blk_entry(a) {
blk_entry_call,
blk_entry_cmp,
......@@ -1047,27 +824,33 @@ macro_rules! emit_test {
});
};
/*
emit_test! ((vm) (pass_1arg_by_stack pass_1arg_by_stack_test1 pass_1arg_by_stack_test1_v1 Int,EQ (sig, int64(1u64))));
emit_test! ((vm) (pass_1arg_by_stack pass_1arg_by_stack_test1 pass_1arg_by_stack_test1_v1
Int,EQ (sig, int64(1u64))));
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident $Arg1Type: ident,$CMPType: ident ($test_sig: ident, $ty1: ident($in1: expr)))) => {
(($vm: expr)
$name: ident, $test_name: ident, $tester_name: ident,
RET $Arg1Type: ident,
$CMPType: ident,
$test_sig: ident,
RET $ty1: ident($in1: expr),
) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
constdef! (($vm) <int64t> int64_fail = Constant::Int(1));
constdef! (($vm) <$ty1> arg_0 = Constant::$Arg1Type($in1));
funcsig! (($vm) tester_sig = () -> ());
funcdecl! (($vm) <tester_sig> $test_name);
funcdef! (($vm) <tester_sig> $test_name VERSION $tester_name);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
constdef! (($vm) <type_funcref> const_funcref =
Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
consta! (($vm, $tester_name) arg_0_local = arg_0);
block! (($vm, $tester_name) blk_entry);
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
......@@ -1108,22 +891,27 @@ macro_rules! emit_test {
});
};
/*
emit_test! ((vm) (catch_exception catch_exception_test1 catch_exception_test1_v1 (catch_exception_sig)));
emit_test! ((vm) (catch_exception catch_exception_test1 catch_exception_test1_v1
(catch_exception_sig)));
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident ($test_sig: ident))) => {
(($vm: expr)
$name: ident, $test_name: ident, $tester_name: ident,
$test_sig: ident,
) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
constdef! (($vm) <int64t> int64_fail = Constant::Int(1));
funcsig! (($vm) tester_sig = () -> ());
funcdecl! (($vm) <tester_sig> $test_name);
funcdef! (($vm) <tester_sig> $test_name VERSION $tester_name);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
constdef! (($vm) <type_funcref> const_funcref =
Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
block! (($vm, $tester_name) blk_entry);
......@@ -1135,7 +923,7 @@ macro_rules! emit_test {
consta! (($vm, $tester_name) int64_pass_local = int64_pass);
consta! (($vm, $tester_name) int64_fail_local = int64_fail);
inst! (($vm, $tester_name) blk_entry_inst_ret:
SET_RETVAL int64_pass_local
);
......@@ -1154,11 +942,27 @@ macro_rules! emit_test {
});
};
/*
emit_test! ((vm) (coalesce_branch2_moves coalesce_branch2_moves_test1 coalesce_branch2_moves_test1_v1 Int,Int,Int,Int,Int,Int,Int,EQ (sig, int64(1u64), int64(1u64), int64(10u64), int64(10u64), int64(0u64), int64(0u64), int64(2u64))));
emit_test! ((vm) (coalesce_branch2_moves coalesce_branch2_moves_test1
coalesce_branch2_moves_test1_v1
Int,Int,Int,Int,Int,Int,Int,EQ
sig,
int64(1u64), int64(1u64), int64(10u64),
int64(10u64), int64(0u64), int64(0u64),
int64(2u64))));
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident $Arg1Type: ident,$Arg2Type: ident,$Arg3Type: ident,$Arg4Type: ident,$Arg5Type: ident,$Arg6Type: ident,$Arg7Type: ident,$CMPType: ident ($test_sig: ident, $ty1: ident($in1: expr), $ty2: ident($in2: expr), $ty3: ident($in3: expr), $ty4: ident($in4: expr), $ty5: ident($in5: expr), $ty6: ident($in6: expr), $ty7: ident($out: expr)))) => {
(($vm: expr)
$name: ident, $test_name: ident, $tester_name: ident,
$Arg1Type: ident, $Arg2Type: ident, $Arg3Type: ident,
$Arg4Type: ident, $Arg5Type: ident, $Arg6Type: ident,
RET $Arg7Type: ident,
$CMPType: ident,
$test_sig: ident,
$ty1: ident($in1: expr), $ty2: ident($in2: expr), $ty3: ident($in3: expr),
$ty4: ident($in4: expr), $ty5: ident($in5: expr), $ty6: ident($in6: expr),
RET $ty7: ident($out: expr),
) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
......@@ -1183,7 +987,8 @@ macro_rules! emit_test {
ssa! (($vm, $tester_name) <$ty6> f);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
constdef! (($vm) <type_funcref> const_funcref =
Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
consta! (($vm, $tester_name) arg_0_local = arg_0);
......@@ -1192,13 +997,15 @@ macro_rules! emit_test {
consta! (($vm, $tester_name) arg_3_local = arg_3);
consta! (($vm, $tester_name) arg_4_local = arg_4);
consta! (($vm, $tester_name) arg_5_local = arg_5);
block! (($vm, $tester_name) blk_entry);
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
ssa! (($vm, $tester_name) <$ty7> result);
inst! (($vm, $tester_name) blk_entry_call:
result = EXPRCALL (CallConvention::Mu, is_abort: false) const_funcref_local (arg_0_local, arg_1_local, arg_2_local, arg_3_local, arg_4_local, arg_5_local)
result = EXPRCALL (CallConvention::Mu, is_abort: false)
const_funcref_local (arg_0_local, arg_1_local, arg_2_local,
arg_3_local, arg_4_local, arg_5_local)
);
consta! (($vm, $tester_name) arg_6_local = arg_6);
......@@ -1234,11 +1041,20 @@ macro_rules! emit_test {
});
};
/*
emit_test! ((vm) (add_twice add_twice_test1 add_twice_test1_v1 Int,Int,Int,Int,EQ (add_twice_sig, int64(1u64), int64(1u64), int64(1u64), int64(3u64))));
emit_test! ((vm) (add_twice add_twice_test1 add_twice_test1_v1
Int,Int,Int,Int,EQ (add_twice_sig, int64(1u64), int64(1u64), int64(1u64), int64(3u64))));
*/
(($vm: expr) ($name: ident $test_name: ident $tester_name: ident $Arg1Type: ident,$Arg2Type: ident,$Arg3Type: ident,$Arg4Type: ident,$CMPType: ident ($test_sig: ident, $ty1: ident($in1: expr), $ty2: ident($in2: expr), $ty3: ident($in3: expr), $ty4: ident($out: expr)))) => {
(($vm: expr)
$name: ident, $test_name: ident, $tester_name: ident,
$Arg1Type: ident, $Arg2Type: ident, $Arg3Type: ident,
RET $Arg4Type: ident,
$CMPType: ident,
$test_sig: ident,
$ty1: ident($in1: expr), $ty2: ident($in2: expr), $ty3: ident($in3: expr),
RET $ty4: ident($out: expr),
) => {
typedef! (($vm) int1 = mu_int(1));
typedef! (($vm) int64t = mu_int(64));
constdef! (($vm) <int64t> int64_pass = Constant::Int(0));
......@@ -1257,7 +1073,8 @@ macro_rules! emit_test {
ssa! (($vm, $tester_name) <$ty3> c);
typedef! (($vm) type_funcref = mu_funcref($test_sig));
constdef! (($vm) <type_funcref> const_funcref = Constant::FuncRef($vm.id_of(stringify!($name))));
constdef! (($vm) <type_funcref> const_funcref =
Constant::FuncRef($vm.id_of(stringify!($name))));
// blk_entry
consta! (($vm, $tester_name) arg_0_local = arg_0);
......@@ -1269,7 +1086,8 @@ macro_rules! emit_test {
consta! (($vm, $tester_name) const_funcref_local = const_funcref);
ssa! (($vm, $tester_name) <$ty4> result);
inst! (($vm, $tester_name) blk_entry_call:
result = EXPRCALL (CallConvention::Mu, is_abort: false) const_funcref_local (arg_0_local, arg_1_local, arg_2_local)
result = EXPRCALL (CallConvention::Mu, is_abort: false)
const_funcref_local (arg_0_local, arg_1_local, arg_2_local)
);
consta! (($vm, $tester_name) arg_3_local = arg_3);
......@@ -1409,7 +1227,6 @@ macro_rules! build_and_run_test {
compiler.compile(&mut func_ver);
}
let func_id = vm.id_of(stringify!($dep_name));
{
let funcs = vm.funcs().read().unwrap();
......@@ -1421,9 +1238,11 @@ macro_rules! build_and_run_test {
}
backend::emit_context(&vm);
aot::run_test_2f(&vm, stringify!($test_name), stringify!($dep_name), stringify!($tester_name));
aot::run_test_2f(&vm, stringify!($test_name),
stringify!($dep_name),
stringify!($tester_name)
);
};
($test_name: ident AND $dep_name: ident, $tester_name: ident, $fnc_name: ident) => {
VM::start_logging_trace();
......@@ -1452,7 +1271,7 @@ macro_rules! build_and_run_test {
compiler.compile(&mut func_ver);
}
let func_id = vm.id_of(stringify!($dep_name));
{
let funcs = vm.funcs().read().unwrap();
......@@ -1464,6 +1283,9 @@ macro_rules! build_and_run_test {
}
backend::emit_context(&vm);
aot::run_test_2f(&vm, stringify!($test_name), stringify!($dep_name), stringify!($tester_name));
aot::run_test_2f(&vm, stringify!($test_name),
stringify!($dep_name),
stringify!($tester_name)
);
};
}
\ No newline at end of file
}
......@@ -31,7 +31,7 @@ use self::mu::linkutils::aot;
#[test]
fn test_allocation_fastpath() {
build_and_run_test! (allocation_fastpath, allocation_fastpath_test1);
build_and_run_test!(allocation_fastpath, allocation_fastpath_test1);
}
fn allocation_fastpath() -> VM {
......@@ -79,9 +79,12 @@ fn allocation_fastpath() -> VM {
});
define_func_ver!((vm) allocation_fastpath_v1 (entry: blk_entry) {blk_entry});
emit_test! ((vm) (allocation_fastpath allocation_fastpath_test1 allocation_fastpath_test1_v1 --- (sig)));
emit_test! ((vm)
allocation_fastpath, allocation_fastpath_test1, allocation_fastpath_test1_v1,
sig,
);
vm
}
......@@ -181,8 +184,11 @@ pub fn alloc_new() -> VM {
define_func_ver!((vm) alloc_new_v1 (entry: blk_0) {
blk_0
});
emit_test! ((vm) (alloc_new alloc_new_test1 alloc_new_test1_v1 --- (alloc_new_sig)));
emit_test! ((vm)
alloc_new, alloc_new_test1, alloc_new_test1_v1,
alloc_new_sig,
);
vm
}
......@@ -71,10 +71,23 @@ fn udiv() -> VM {
define_func_ver!((vm) udiv_v1(entry: blk_entry) {
blk_entry
});
emit_test! ((vm) (udiv udiv_test1 udiv_test1_v1 III (udiv_sig, int64(22), int64(4), int64(5))));
emit_test! ((vm) (udiv udiv_test2 udiv_test2_v1 III (udiv_sig, int64(27), int64(7), int64(3))));
emit_test! ((vm)
udiv, udiv_test1, udiv_test1_v1,
Int, Int RET Int,
EQ,
udiv_sig,
int64(22), int64(4) RET int64(5),
);
emit_test! ((vm)
udiv, udiv_test2, udiv_test2_v1,
Int, Int RET Int,
EQ,
udiv_sig,
int64(27), int64(7) RET int64(3),
);
vm
}
......@@ -117,10 +130,23 @@ fn sdiv() -> VM {
define_func_ver!((vm) sdiv_v1(entry: blk_entry) {
blk_entry
});
emit_test! ((vm) (sdiv sdiv_test1 sdiv_test1_v1 III (sdiv_sig, int64(8), int64(2), int64(4))));
emit_test! ((vm) (sdiv sdiv_test2 sdiv_test2_v2 III (sdiv_sig, int64(8), int64(-3i64 as u64), int64(-2i64 as u64))));
emit_test! ((vm)
sdiv, sdiv_test1, sdiv_test1_v1,
Int, Int RET Int,
EQ,