forked from M-Labs/artiq
1
0
Fork 0

runtime: use i64 for watchdog timeout, not i32.

This commit is contained in:
whitequark 2016-10-16 16:32:02 +00:00
parent a8c017bfcc
commit 7618907cad
5 changed files with 9 additions and 5 deletions

View File

@ -821,7 +821,7 @@ class ARTIQIRGenerator(algorithm.Visitor):
timeout = self.visit(context_expr_node.args[0])
timeout_ms = self.append(ir.Arith(ast.Mult(loc=None), timeout,
ir.Constant(1000, builtins.TFloat())))
timeout_ms_int = self.append(ir.Coerce(timeout_ms, builtins.TInt32()))
timeout_ms_int = self.append(ir.Coerce(timeout_ms, builtins.TInt64()))
watchdog_id = self.append(ir.Builtin("watchdog_set", [timeout_ms_int],
builtins.TInt32()))

View File

@ -356,7 +356,7 @@ class LLVMIRGenerator:
elif name == "now":
llty = lli64
elif name == "watchdog_set":
llty = ll.FunctionType(lli32, [lli32])
llty = ll.FunctionType(lli32, [lli64])
elif name == "watchdog_clear":
llty = ll.FunctionType(llvoid, [lli32])
else:

View File

@ -1,3 +1,4 @@
[root]
name = "ksupport"
version = "0.0.0"

View File

@ -142,8 +142,11 @@ pub extern fn __artiq_terminate(exception: *const kernel_proto::Exception,
loop {}
}
extern fn watchdog_set(ms: i32) -> usize {
// FIXME: fix ms
extern fn watchdog_set(ms: i64) -> usize {
if ms < 0 {
artiq_raise!("ValueError", "cannot set a watchdog with a negative timeout")
}
send(&WatchdogSetRequest { ms: ms as u64 });
recv!(&WatchdogSetReply { id } => id)
}

View File

@ -3,7 +3,7 @@
int64_t now = 0;
int watchdog_set(int ms)
int watchdog_set(long long ms)
{
printf("watchdog_set %d\n", ms);
return ms;