omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / src / omega_self_host.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef OMEGA_SELF_HOST_H |
| 18 | #define OMEGA_SELF_HOST_H |
| 19 | |
| 20 | #include "omega_types.h" |
| 21 | #include "omega_realize.h" |
| 22 | #include <stdbool.h> |
| 23 | |
| 24 | #define OP_COMPILE_REALIZER OP_COMPILE |
| 25 | |
| 26 | /* Builds the canonical OMEGA semantic compiler graph G_C */ |
| 27 | int omega_build_compiler_graph(OmegaGraph *g, SemanticId *out_semantic_id); |
| 28 | |
| 29 | /* Reference C0 lowering of compiler graph G_C into AArch64 machine bytes C1 */ |
| 30 | int omega_self_host_compile_c0(const OmegaGraph *g, const SemanticId *g_c_id, RealizationObject *out_c1); |
| 31 | |
| 32 | /* Executes native AArch64 compiler in memory: |
| 33 | * runs compiler->code_bytes on in_omg0 wire bytes, producing out_real */ |
| 34 | int omega_self_host_run_native_compiler(const RealizationObject *compiler, |
| 35 | const uint8_t *in_omg0, size_t in_len, |
| 36 | RealizationObject *out_real); |
| 37 | |
| 38 | /* Runs the 3-generation bootstrap sequence: |
| 39 | * C0(G_C) -> C1 |
| 40 | * C1(G_C) -> C2 |
| 41 | * C2(G_C) -> C3 |
| 42 | * Verifies byte-for-byte fixed point C1 == C2 == C3 */ |
| 43 | int omega_self_host_bootstrap_sequence(RealizationObject *out_c1, |
| 44 | RealizationObject *out_c2, |
| 45 | RealizationObject *out_c3); |
| 46 | |
| 47 | /* Verifies compilation parity on M5 target G_S: |
| 48 | * runs C1 on serialized G_S, checks byte parity with M5 and executes to 15 */ |
| 49 | int omega_self_host_verify_m5_parity(const RealizationObject *c1, uint64_t *out_observed); |
| 50 | |
| 51 | #endif /* OMEGA_SELF_HOST_H */ |