One commit, because the parts below only build together. Allocator: an interval needed at the current instruction is never evicted, and the allocated-program verifier checks that every operand sits where the allocation says. AArch64 encoder: compiler_aarch64.zi encodes allocated machine IR with the shared ARM byte helpers, maps the function-address relocation, sign-extends signed 8- and 16-bit loads and rejects what it cannot encode with a named diagnostic. It has no AOT ELF writer yet. Native default with checked pointers and no fallback: on linux-x86_64, `ziran run app.zx`, `zi2zx run`, the embedding API's Auto and the Kryon players run a bundle's verified program as native code in W^X memory. Stray and freed pointers, double free, bounds and read-only stores trap. A native gap is a named preflight error, nothing falls back to the engine, and `--backend engine` picks it explicitly. zx2native uses the same preflight. Native code exchanges module state for hot reload, checks the stack, zeroes fresh locals, spends fuel at the engine's checkpoints and returns records, arrays and strings from host calls. `zi2zx --debug` source origins name lines in native traps and `zx2native --emit map`. The host value API drops its VM prefix (HostValue, HOST_*). A call with a record result loads the hidden result address into rax only after its stack arguments are stored, and an indirect target stays in r10: rax could hold a stack argument (Kryon's text-field clip guard arrived as an address) or the target (indirect calls returning records crashed). Self-hosting ports: compiler_backend_process, compiler_backend_cache, compiler_native_names and compiler_runtime_emit replace the zir_c_build, zir_c_cache and zir_c_process C, with checked bootstrap C and Makefile rules. zir_c.toolchain again reports "compiling OUT failed:" with the head of the compiler output and a truncation marker. The parallel scheduler no longer stalls on a held compiler after reaping a finished job, and poll or read errors now fail the build. A fresh BUILD_DIR (Kryon's runtime build) builds: generated files have pattern rules, objects wait for the headers they include, and engine flags are per object instead of leaking into zi2c. Legacy removals F1-F10 and N1-N4: the duplicate LirX64 encoder and its spec test, zir_c_*, zir_runtime and zir_native, nine zero-reference spec tests, vec_capacity, the zx_metadata and native_cache_names benchmarks, build-android-host.sh and two shell wrappers are deleted; zx2native is machine-only; `zi2zx` rejects `--opt` on ZX input; the bootstrap is regenerated. ASSEMBLY docs, the legacy-removal plan, the milestones and the remaining-work plan record the current position. Co-Authored-By: Claude Opus 5.5 <[email protected]>
77 lines
3.0 KiB
C
77 lines
3.0 KiB
C
/* Generated by zi2c from timer_linux.zi. */
|
|
#ifndef ZIRAN_TIMER_LINUX_H
|
|
#define ZIRAN_TIMER_LINUX_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
typedef struct zir_9339a8296a493286_ClockValue zir_9339a8296a493286_ClockValue;
|
|
|
|
struct zir_9339a8296a493286_ClockValue {
|
|
ptrdiff_t seconds;
|
|
ptrdiff_t nanoseconds;
|
|
};
|
|
#ifndef ZIR_FOREIGN_zir_f_9bb5b5b3425765c7_ClockGetTimeRaw_a884510c
|
|
#define ZIR_FOREIGN_zir_f_9bb5b5b3425765c7_ClockGetTimeRaw_a884510c
|
|
#ifdef __APPLE__
|
|
int32_t zir_foreign_zir_f_9bb5b5b3425765c7_ClockGetTimeRaw(int32_t clock, zir_9339a8296a493286_ClockValue* value) __asm__("_clock_gettime");
|
|
#else
|
|
int32_t zir_foreign_zir_f_9bb5b5b3425765c7_ClockGetTimeRaw(int32_t clock, zir_9339a8296a493286_ClockValue* value) __asm__("clock_gettime");
|
|
#endif
|
|
static int32_t
|
|
zir_f_9bb5b5b3425765c7_ClockGetTimeRaw(int32_t clock, zir_9339a8296a493286_ClockValue* value)
|
|
{
|
|
return zir_foreign_zir_f_9bb5b5b3425765c7_ClockGetTimeRaw(clock, value);
|
|
}
|
|
#endif
|
|
#ifndef ZIR_FOREIGN_zir_f_9bb5b5b3425765c7_ClockSleepRaw_86fa7920
|
|
#define ZIR_FOREIGN_zir_f_9bb5b5b3425765c7_ClockSleepRaw_86fa7920
|
|
#ifdef __APPLE__
|
|
int32_t zir_foreign_zir_f_9bb5b5b3425765c7_ClockSleepRaw(int32_t clock, int32_t flags, zir_9339a8296a493286_ClockValue* request, zir_9339a8296a493286_ClockValue* remaining) __asm__("_clock_nanosleep");
|
|
#else
|
|
int32_t zir_foreign_zir_f_9bb5b5b3425765c7_ClockSleepRaw(int32_t clock, int32_t flags, zir_9339a8296a493286_ClockValue* request, zir_9339a8296a493286_ClockValue* remaining) __asm__("clock_nanosleep");
|
|
#endif
|
|
static int32_t
|
|
zir_f_9bb5b5b3425765c7_ClockSleepRaw(int32_t clock, int32_t flags, zir_9339a8296a493286_ClockValue* request, zir_9339a8296a493286_ClockValue* remaining)
|
|
{
|
|
return zir_foreign_zir_f_9bb5b5b3425765c7_ClockSleepRaw(clock, flags, request,
|
|
remaining);
|
|
}
|
|
#endif
|
|
int64_t MonotonicNanoseconds(void);
|
|
int64_t MonotonicMilliseconds(void);
|
|
zir_9339a8296a493286_ClockValue timer_linux_MakeClockValue(int64_t milliseconds);
|
|
bool SleepMilliseconds(int64_t milliseconds);
|
|
|
|
/* Small procedures other modules inline; timer_linux.c defines them. */
|
|
#if !defined(__cplusplus) && !defined(ZIRAN_TIMER_LINUX_H_SOURCE) && !defined(ZIRAN_NO_HEADER_INLINE)
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
static inline zir_9339a8296a493286_ClockValue timer_linux_MakeClockValue_ziran_inline(int64_t milliseconds);
|
|
#define timer_linux_MakeClockValue(...) timer_linux_MakeClockValue_ziran_inline(__VA_ARGS__)
|
|
|
|
static inline zir_9339a8296a493286_ClockValue
|
|
timer_linux_MakeClockValue_ziran_inline(int64_t milliseconds)
|
|
{
|
|
zir_9339a8296a493286_ClockValue value = {0};
|
|
if (milliseconds < 0LL) {
|
|
return value;
|
|
}
|
|
ptrdiff_t* value_0 = &(value.seconds);
|
|
(*value_0) = (ptrdiff_t)((milliseconds / 1000LL));
|
|
ptrdiff_t* value_1 = &(value.nanoseconds);
|
|
(*value_1) = (ptrdiff_t)(((int64_t)((uint64_t)((milliseconds % 1000LL)) * UINT64_C(1000000))));
|
|
return value;
|
|
}
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ZIRAN_TIMER_LINUX_H */
|