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]>
120 lines
3.1 KiB
C
120 lines
3.1 KiB
C
/* Generated by zi2c from process_run_linux.zi. */
|
|
#ifndef ZIRAN_PROCESS_RUN_LINUX_H
|
|
#define ZIRAN_PROCESS_RUN_LINUX_H
|
|
|
|
#include <stdbool.h>
|
|
#include "zir_string_types.h"
|
|
#include "zir_slice.h"
|
|
#include "c_string.h"
|
|
#include "vec.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#ifdef ZIRAN_PROCESS_RUN_LINUX_H_PRIVATE
|
|
#define CLOSE_ON_EXEC 524288
|
|
#endif
|
|
#ifdef ZIRAN_PROCESS_RUN_LINUX_H_PRIVATE
|
|
#define zir_d_f22e9a1471997af5 4
|
|
#endif
|
|
typedef struct ProcessArgumentSlot ProcessArgumentSlot;
|
|
typedef struct ProcessOptions ProcessOptions;
|
|
#ifndef ZIRAN_CONCRETE_FORWARD___type_838711075b90279a
|
|
#define ZIRAN_CONCRETE_FORWARD___type_838711075b90279a
|
|
typedef struct __type_838711075b90279a __type_838711075b90279a;
|
|
#endif
|
|
typedef struct ProcessRun ProcessRun;
|
|
#ifndef ZIRAN_CONCRETE_FORWARD___type_01e5ac0505e23acf
|
|
#define ZIRAN_CONCRETE_FORWARD___type_01e5ac0505e23acf
|
|
typedef struct __type_01e5ac0505e23acf __type_01e5ac0505e23acf;
|
|
#endif
|
|
#ifndef ZIRAN_CONCRETE_FORWARD___type_1f00ef809eed7c2e
|
|
#define ZIRAN_CONCRETE_FORWARD___type_1f00ef809eed7c2e
|
|
typedef struct __type_1f00ef809eed7c2e __type_1f00ef809eed7c2e;
|
|
#endif
|
|
#ifdef ZIRAN_PROCESS_RUN_LINUX_H_PRIVATE
|
|
typedef struct Prepared Prepared;
|
|
#endif
|
|
#ifdef ZIRAN_PROCESS_RUN_LINUX_H_PRIVATE
|
|
typedef void (*SignalHandler)(int32_t);
|
|
#endif
|
|
|
|
struct ProcessArgumentSlot {
|
|
uint8_t* value;
|
|
};
|
|
|
|
struct ProcessOptions {
|
|
Slice arguments;
|
|
String directory;
|
|
Slice environment;
|
|
String input_path;
|
|
String output_path;
|
|
bool append_output;
|
|
String error_path;
|
|
bool merge_error;
|
|
bool capture_output;
|
|
bool new_session;
|
|
};
|
|
#ifndef ZIRAN_CONCRETE___type_838711075b90279a
|
|
#define ZIRAN_CONCRETE___type_838711075b90279a
|
|
|
|
struct __type_838711075b90279a {
|
|
uint8_t* data;
|
|
int64_t count;
|
|
int64_t capacity;
|
|
};
|
|
#endif
|
|
|
|
struct ProcessRun {
|
|
int32_t pid;
|
|
int32_t code;
|
|
bool started;
|
|
bool finished;
|
|
__type_838711075b90279a output;
|
|
};
|
|
#ifndef ZIRAN_CONCRETE___type_01e5ac0505e23acf
|
|
#define ZIRAN_CONCRETE___type_01e5ac0505e23acf
|
|
|
|
struct __type_01e5ac0505e23acf {
|
|
ProcessArgumentSlot* data;
|
|
int64_t count;
|
|
int64_t capacity;
|
|
};
|
|
#endif
|
|
#ifndef ZIRAN_CONCRETE___type_1f00ef809eed7c2e
|
|
#define ZIRAN_CONCRETE___type_1f00ef809eed7c2e
|
|
|
|
struct __type_1f00ef809eed7c2e {
|
|
int64_t* data;
|
|
int64_t count;
|
|
int64_t capacity;
|
|
};
|
|
#endif
|
|
#ifdef ZIRAN_PROCESS_RUN_LINUX_H_PRIVATE
|
|
|
|
struct Prepared {
|
|
__type_838711075b90279a bytes;
|
|
__type_01e5ac0505e23acf arguments;
|
|
__type_1f00ef809eed7c2e argument_offsets;
|
|
__type_1f00ef809eed7c2e names;
|
|
__type_1f00ef809eed7c2e values;
|
|
int64_t directory;
|
|
int64_t input;
|
|
int64_t output;
|
|
int64_t error;
|
|
};
|
|
#endif
|
|
bool process_run_linux_StartProcess(ProcessOptions options, ProcessRun* run);
|
|
bool process_run_linux_PollProcess(ProcessRun* run);
|
|
bool process_run_linux_WaitProcess(ProcessRun* run);
|
|
bool process_run_linux_SignalProcess(ProcessRun* run, int32_t signal_number, bool whole_group);
|
|
bool process_run_linux_RunProcess(ProcessOptions options, ProcessRun* run);
|
|
void process_run_linux_CatchTermination(void);
|
|
bool process_run_linux_TerminationRequested(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ZIRAN_PROCESS_RUN_LINUX_H */
|