Commit c82f43d0 authored by qinsoon's avatar qinsoon

more tests about rpython time

parent c70cd85a
...@@ -2309,17 +2309,15 @@ impl <'a> InstructionSelection { ...@@ -2309,17 +2309,15 @@ impl <'a> InstructionSelection {
let (stack_arg_size, _, stack_arg_offsets) = backend::sequetial_layout(&stack_arg_tys, vm); let (stack_arg_size, _, stack_arg_offsets) = backend::sequetial_layout(&stack_arg_tys, vm);
let mut stack_arg_size_with_padding = stack_arg_size; let mut stack_arg_size_with_padding = stack_arg_size;
let mut stack_arg_padding = 0;
if stack_arg_size % 16 == 0 { if stack_arg_size % 16 == 0 {
// do not need to adjust rsp // do not need to adjust rsp
} else if stack_arg_size % 8 == 0 { } else if stack_arg_size % 8 == 0 {
// adjust rsp by -8 // adjust rsp by -8
stack_arg_padding = 8;
stack_arg_size_with_padding += 8; stack_arg_size_with_padding += 8;
} else { } else {
let rem = stack_arg_size % 16; let rem = stack_arg_size % 16;
stack_arg_padding = 16 - rem; let stack_arg_padding = 16 - rem;
stack_arg_size_with_padding += stack_arg_padding; stack_arg_size_with_padding += stack_arg_padding;
} }
...@@ -2328,7 +2326,7 @@ impl <'a> InstructionSelection { ...@@ -2328,7 +2326,7 @@ impl <'a> InstructionSelection {
if stack_arg_size_with_padding != 0 { if stack_arg_size_with_padding != 0 {
let mut index = 0; let mut index = 0;
let mut rsp_offset_before_call = - (stack_arg_size_with_padding as i32); let rsp_offset_before_call = - (stack_arg_size_with_padding as i32);
for arg in stack_args { for arg in stack_args {
self.emit_store_base_offset(&x86_64::RSP, rsp_offset_before_call + (stack_arg_offsets[index]) as i32, &arg, vm); self.emit_store_base_offset(&x86_64::RSP, rsp_offset_before_call + (stack_arg_offsets[index]) as i32, &arg, vm);
...@@ -2763,7 +2761,7 @@ impl <'a> InstructionSelection { ...@@ -2763,7 +2761,7 @@ impl <'a> InstructionSelection {
// arg <- RBP + 16 // arg <- RBP + 16
// return addr // return addr
// old RBP <- RBP // old RBP <- RBP
let mut stack_arg_base_offset : i32 = 16; let stack_arg_base_offset : i32 = 16;
let arg_by_stack_tys = arg_by_stack.iter().map(|x| x.ty.clone()).collect(); let arg_by_stack_tys = arg_by_stack.iter().map(|x| x.ty.clone()).collect();
let (_, _, stack_arg_offsets) = backend::sequetial_layout(&arg_by_stack_tys, vm); let (_, _, stack_arg_offsets) = backend::sequetial_layout(&arg_by_stack_tys, vm);
......
...@@ -661,10 +661,8 @@ fn pass_mixed_args_by_stack() -> VM { ...@@ -661,10 +661,8 @@ fn pass_mixed_args_by_stack() -> VM {
// blk_entry // blk_entry
consta! ((vm, pass_mixed_args_by_stack_v1) int64_0_local = int64_0); consta! ((vm, pass_mixed_args_by_stack_v1) int64_0_local = int64_0);
consta! ((vm, pass_mixed_args_by_stack_v1) int64_1_local = int64_1);
consta! ((vm, pass_mixed_args_by_stack_v1) int64_2_local = int64_2); consta! ((vm, pass_mixed_args_by_stack_v1) int64_2_local = int64_2);
consta! ((vm, pass_mixed_args_by_stack_v1) int8_1_local = int8_1); consta! ((vm, pass_mixed_args_by_stack_v1) int8_1_local = int8_1);
consta! ((vm, pass_mixed_args_by_stack_v1) int8_2_local = int8_2);
block! ((vm, pass_mixed_args_by_stack_v1) blk_entry); block! ((vm, pass_mixed_args_by_stack_v1) blk_entry);
block! ((vm, pass_mixed_args_by_stack_v1) blk_main); block! ((vm, pass_mixed_args_by_stack_v1) blk_main);
......
...@@ -19,6 +19,7 @@ use test_compiler::test_call::gen_ccall_exit; ...@@ -19,6 +19,7 @@ use test_compiler::test_call::gen_ccall_exit;
struct Foo (i8, i8, i8); struct Foo (i8, i8, i8);
#[test] #[test]
#[allow(unused_variables)]
fn test_write_int8_val() { fn test_write_int8_val() {
let lib = testutil::compile_fnc("write_int8", &write_int8); let lib = testutil::compile_fnc("write_int8", &write_int8);
......
...@@ -1158,6 +1158,7 @@ def test_rpytarget_richards(): ...@@ -1158,6 +1158,7 @@ def test_rpytarget_richards():
res = run_boot_image(main, '/tmp/test_richards-mu', args=['5']) res = run_boot_image(main, '/tmp/test_richards-mu', args=['5'])
assert res.returncode == 0, res.err assert res.returncode == 0, res.err
@pytest.mark.xfail(reason='printing time fails')
@may_spawn_proc @may_spawn_proc
def test_rpytarget_richards_measure_time(): def test_rpytarget_richards_measure_time():
from rpython.translator.goal.richards import entry_point from rpython.translator.goal.richards import entry_point
...@@ -1171,6 +1172,31 @@ def test_rpytarget_richards_measure_time(): ...@@ -1171,6 +1172,31 @@ def test_rpytarget_richards_measure_time():
res = run_boot_image(main, '/tmp/test_richards_measure_time-mu', args=['5']) res = run_boot_image(main, '/tmp/test_richards_measure_time-mu', args=['5'])
assert res.returncode == 0, res.err assert res.returncode == 0, res.err
@pytest.mark.xfail(reason='ValueError exception, probably formatting fails')
@may_spawn_proc
def test_rpython_print_time():
import time
def main(argv):
print time.time()
return 0
res = run_boot_image(main, '/tmp/test_print_time')
assert res.returncode == 0, res.err
@may_spawn_proc
def test_rpython_time_diff():
import time
def main(argv):
t1 = time.time()
t2 = time.time()
if t2 >= t1:
return 0
else:
return 1
res = run_boot_image(main, '/tmp/test_time_diff')
assert res.returncode == 0, res.err
@may_spawn_proc @may_spawn_proc
def test_dtoa(): def test_dtoa():
from rpython.rlib.rdtoa import dtoa from rpython.rlib.rdtoa import dtoa
......
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