interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / src / omega_exec.h

44 lines · 2039 bytes Raw Blame History
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_EXEC_H
18#define OMEGA_EXEC_H
19
20#include "omega_realize.h"
21#include <stdint.h>
22#include <stdbool.h>
23
24/* Native in-process execution on AArch64 host.
25 * Executable pages are kept for the last OMEGA_EXEC_CACHE_SLOTS distinct code byte strings
26 * (identity = the bytes, not the RealizationObject address). Measured 2026-10-19 on the Spark
27 * (omega-mv#574): mmap+copy+mprotect+munmap per call cost 19 to 23 us against under 40 ns of
28 * code, so a repeated realization paid 99.9 percent of its time in page setup. */
29#define OMEGA_EXEC_CACHE_SLOTS 64u
30typedef struct {
31 uint64_t hits; /* calls served from a resident mapping */
32 uint64_t misses; /* calls that mapped fresh pages */
33 uint64_t evictions; /* resident mappings dropped to make room */
34 uint64_t resident; /* mappings currently held */
35} OmegaExecCacheStats;
36int omega_exec_native_f3(const RealizationObject *real, uint64_t a, uint64_t b, uint64_t c, uint64_t *out_res);
37void omega_exec_native_cache_stats(OmegaExecCacheStats *out);
38void omega_exec_native_cache_reset(void); /* unmaps every resident mapping and zeroes the counters */
39
40/* Bare-metal QEMU runner generation and execution */
41int omega_build_qemu_runner(const RealizationObject *real, const char *out_bin_path);
42int omega_exec_qemu_virt(const char *runner_bin_path, char *out_log, size_t out_log_len);
43
44#endif /* OMEGA_EXEC_H */