← All docs
localtime() — internals
Compiler internals for localtime(): lowering path, type checks, and runtime helpers.
localtime() — internals
Where it lives
- Signature:
src/builtins/system/localtime.rs - Lowering:
src/codegen/lower_inst/builtins/system.rs:220 (lower_localtime) - Function symbol:
lower_localtime()
Lowering notes
- Lowers
localtime([$timestamp[, $associative]])through the shared decomposition runtime helper. __rt_localtimereads the timestamp from the integer result register (x0/rax) and the- associative-keys flag from the second argument register (
x1/rsi) — an irregular ABI, so the - two values are staged in scratch (the flag may unbox a
Mixed, clobbering the timestamp) and - reloaded into their distinct registers with no intervening call, then the returned hash pointer
- is boxed into a
Mixedassociative-array cell likegetdate.
Runtime helpers
The following runtime helpers are referenced:
__rt_hrtime__rt_localtime
Signature summary
function localtime(int $timestamp = -1, bool $associative = false): array
What the type checker enforces
- Arity: takes 0–2 arguments (2 optional).
Eval interpreter (magician)
- Declaration:
crates/elephc-magician/src/interpreter/builtins/time/localtime.rs(eval_builtin!) - Dispatch hooks:
direct,values