← All docs
microtime() — internals
Compiler internals for microtime(): lowering path, type checks, and runtime helpers.
microtime() — internals
Where it lives
- Signature:
src/builtins/system/microtime.rs - Lowering:
src/codegen/lower_inst/builtins/system.rs:111 (lower_microtime) - Function symbol:
lower_microtime()
Lowering notes
- Lowers
microtime()/microtime(true)/microtime(false)/microtime($flag). - Dispatch is driven by the arg-aware result type set in
ir_lower(see call_return_type_for_argsand themicrotimefallback incall_return_type):Float(literaltrue) calls the existing__rt_microtimefloat helper;Str- (omitted / literal
false) calls__rt_microtime_str, which builds the - “0.NNNNNNNN sec” string on the stack and persists it;
Mixed(non-literal flag) - marshals the flag and calls
__rt_microtime_mixed, which branches at runtime and - boxes either the string or the float.
Runtime helpers
The following runtime helpers are referenced:
__rt_microtime__rt_microtime_mixed__rt_microtime_str
Signature summary
function microtime(bool $as_float = false): mixed
What the type checker enforces
- Arity: takes 0–1 arguments (1 optional).
Eval interpreter (magician)
- Declaration:
crates/elephc-magician/src/interpreter/builtins/time/microtime.rs(eval_builtin!) - Dispatch hooks:
direct,values