-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: parenthetical syntax for cycles
, timeout
etc.
#4608
base: master
Are you sure you want to change the base?
Conversation
@@ -312,14 +312,16 @@ let funcE name sort ctrl typ_binds args typs exp = | |||
note = Note.{ def with typ; eff = T.Triv }; | |||
} | |||
|
|||
let recordE' = ref (fun _ -> nullE ()) (* gets correctly filled below *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use and
to allow mutual recursion
src/ir_passes/tailcall.ml
Outdated
begin match e1.it, env with | ||
| VarE f1, { tail_pos = true; | ||
info = Some { func; typ_binds; temps; label; tail_called } } | ||
when f1 = func && are_generic_insts typ_binds insts -> | ||
tail_called := true; | ||
(blockE (assignEs temps (exp env e2)) (breakE label (unitE ()))).it | ||
| _,_-> PrimE (CallPrim insts, [exp env e1; exp env e2]) | ||
| _,_-> PrimE (CallPrim (insts, pars), [exp env e1; exp env e2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| _,_-> PrimE (CallPrim (insts, pars), [exp env e1; exp env e2]) | |
| _,_-> PrimE (CallPrim (insts, exp env pars), [exp env e1; exp env e2]) |
unfortunately it doesn't arrive in the `async.ml`
at least now I get > ingress Err: IC0504: Canister rwlgt-iiaaa-aaaaa-aaaaa-cai violated contract: ic0_call_cycles_add128 called when no call is under construction.
we should use the system call though, instead of assigning to `@cycles`, as that will go away
cycles
etc.
0b40189
to
3bed728
Compare
and observe the deadline
…elect fields in parentheticals
@@ -203,5 +203,8 @@ let error_codes : (string * string option) list = | |||
"M0197", Some([%blob "lang_utils/error_codes/M0197.md"]); (* `system` capability required *) | |||
"M0198", Some([%blob "lang_utils/error_codes/M0198.md"]); (* Unused field pattern warning *) | |||
"M0199", Some([%blob "lang_utils/error_codes/M0199.md"]); (* Deprecate experimental stable memory *) | |||
"M0200", Some([%blob "lang_utils/error_codes/M0200.md"]) (* Cannot determine subtyping or equality *) | |||
"M0200", Some([%blob "lang_utils/error_codes/M0200.md"]); (* Cannot determine subtyping or equality *) | |||
"M0202", None; (* parenthetical note must be applied to a message send *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this contiguous
let cyclesSetup = if hasCycles | ||
then Some (thenE | ||
(natE Mo_values.Numerics.Nat.zero |> assignVarE "@cycles") | ||
(primE SystemCyclesAddPrim [dotE pars "cycles" T.nat])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bind pars to an object variable? Otherwise we get duplicated effects!
this probably doesn't make much sense
cycles
etc.cycles
, timeout
etc.
@@ -12187,6 +12215,29 @@ and compile_prim_invocation (env : E.t) ae p es at = | |||
SR.Vanilla, Cycles.refunded env | |||
| SystemCyclesBurnPrim, [e1] -> | |||
SR.Vanilla, compile_exp_vanilla env ae e1 ^^ Cycles.burn env | |||
| ICCyclesPrim, [] -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an idempotent operation, so we have to be careful to not call it twice. E.g. it fails for paired up environment+parenthetical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should return two options. Possibly just the Nat
(cycles
) and Nat32
(timeout
). We definitely have to search the attributes.
Arr.load_field env 1l ^^ | ||
G.i (LocalSet (nr 0l)) | ||
; Tagged.Object, | ||
Opt.inject_simple env G.nop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't care storing back anything, as there is no captured environment.
Tagged.branch_with env [I32Type] | ||
[ Tagged.Closure, | ||
G.i Drop ^^ | ||
Opt.null_lit env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use br 1
to fall out?
ICCallPrim
(and friends) should carry the fragment to set theSystemCyclesAddPrim
while the call is being set up towards the replica.Parentheticals
(with cycles = 42_000_000) Actor.call(param)
(with timeout = 10)
ic0.call_with_best_effort_response : (timeout_seconds : i32) -> ()
(with receiveMax = 50_000)
(to limit the response size)(with resend = true; resendDelay = 3)
whenSYS_TRANSIENT
reject response (like UnixEINTR
)call_cycles_add128_up_to
ic#1158(with memoryLimit = 1G) ActorClass(<args>)
TODOs:
cycles : Nat
for canister sends (self and raw sends too)timeout : Nat32
for best-effortasync
blocksICCallPrim
, see topICCallRawPrim
, not directly annotatable (desisting for now)FIXME
s,TODO
s