From 1491a503185639385d8b548704fa4cfc674a6a61 Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:56:17 -0600 Subject: [PATCH 1/4] Scan OSC tokens in seeded Omega --- CONTRIBUTORS.md | 1 + mk/compiler.mk | 14 + om/compiler/osc_literal.om | 647 +++++++++++++++++++++++++++++ src/compiler/osc_lex.c | 202 +++------ src/omega_api_decl.h | 23 + src/omega_native.h | 4 +- src/omega_om_units.c | 37 +- src/omega_om_units.ident | 2 +- tests/compiler/osc_lex_reference.c | 192 +++++++++ tests/compiler/test_osc_lex.c | 108 +++++ 10 files changed, 1091 insertions(+), 139 deletions(-) create mode 100644 tests/compiler/osc_lex_reference.c create mode 100644 tests/compiler/test_osc_lex.c diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index eecee27ef..3173071d3 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -361,3 +361,4 @@ Update this table in the same commit as the work it credits. | Codex (under Drake Stapleton’s direction) | Replayed the nine-check Spark GB10 Q38 stress suite on `371a882a5` and published the [November 20 measurements](docs/gpu/Q38_27B_GB10_STRESS_20261120.md). | | Codex (under Drake Stapleton’s direction) | Implemented the seeded Omega training harness for native tokenization, CPU and GB10 fine-tuning and held-out evaluation. | +| Codex (under Drake Stapleton's direction) | Migrated OSC token scanning to seeded Omega and added differential tests against the C lexer. | diff --git a/mk/compiler.mk b/mk/compiler.mk index 9dbee5bf6..51e98df79 100644 --- a/mk/compiler.mk +++ b/mk/compiler.mk @@ -26,6 +26,20 @@ OSC_MODEL = src/compiler/model/osc_model.c OSC_MODEL_GEN = src/compiler/model/osc_model_gen.c OSC_HDRS = $(wildcard src/compiler/*.h) $(wildcard src/compiler/model/*.h) src/sha256.h +OSC_LEX_TEST_SRC = tests/compiler/test_osc_lex.c tests/compiler/osc_lex_reference.c \ + src/compiler/osc_lex.c src/compiler/osc_diag.c src/omega_om_units.c +OSC_LEX_FIXTURES = $(wildcard tests/compiler/progs/*.osc tests/compiler/neg/*.osc) + +$(OSC_DIR)/test_osc_lex: $(OSC_LEX_TEST_SRC) $(OSC_HDRS) src/omega_api_decl.h + @mkdir -p $(OSC_DIR) + $(CC) $(OSC_CFLAGS) -o $@ $(OSC_LEX_TEST_SRC) + +.PHONY: test-osc-lex +test-osc-lex: $(OSC_DIR)/test_osc_lex + @$(OSC_DIR)/test_osc_lex $(OSC_LEX_FIXTURES) + +test-compiler test-compiler-quick: test-osc-lex + $(OSC_DIR)/test_osc_model: tests/compiler/test_osc_model.c $(OSC_MODEL) $(OSC_MODEL_GEN) $(OSC_HDRS) @mkdir -p $(OSC_DIR) $(CC) $(OSC_CFLAGS) -o $@ tests/compiler/test_osc_model.c $(OSC_MODEL) $(OSC_MODEL_GEN) diff --git a/om/compiler/osc_literal.om b/om/compiler/osc_literal.om index 779b7af34..48ca502ea 100644 --- a/om/compiler/osc_literal.om +++ b/om/compiler/osc_literal.om @@ -2,8 +2,24 @@ note SPDX-License-Identifier: Apache-2.0 note Decode the spelling of one OSC integer token. Syntax takes precedence over overflow. note bridge c-define OSC_LITERAL_MALFORMED 1 note bridge c-define OSC_LITERAL_OVERFLOW 2 +note The lexer and literal decoder share this unit so integer tokens need no second bridge call. +note bridge c-type lexstate OscLexState +note bridge c-define OSC_LEX_COMMENT 3 +note bridge c-define OSC_LEX_FULL 4 +note bridge c-define OSC_LEX_NAME_LONG 5 +note bridge c-define OSC_LEX_BAD_BYTE 6 om2 +layout lexstate 40 +field pos ulong at 0 little +field start ulong at 8 little +field value ulong at 16 little +field line uint at 24 little +field col uint at 28 little +field width uint at 32 little +field kind uint at 36 little +end + fn literal_digit c ulong to ulong if and ge c 48 le c 57 ret sub c 48 @@ -57,3 +73,634 @@ end put value 0 acc ret 0 end + +note OscTokKind values from src/compiler/osc_lex.h. The oracle exercises every spelling. +const OT_EOF uint 0 +const OT_NAME uint 1 +const OT_INT uint 2 +const OT_RESERVED uint 3 +const OT_FN uint 4 +const OT_LET uint 5 +const OT_MUT uint 6 +const OT_OWN uint 7 +const OT_ALLOC uint 8 +const OT_IF uint 9 +const OT_ELSE uint 10 +const OT_WHILE uint 11 +const OT_BOUND uint 12 +const OT_FOR uint 13 +const OT_IN uint 14 +const OT_RETURN uint 15 +const OT_REQUIRES uint 16 +const OT_ENSURES uint 17 +const OT_AS uint 18 +const OT_TRUE uint 19 +const OT_FALSE uint 20 +const OT_U8 uint 21 +const OT_U16 uint 22 +const OT_U32 uint 23 +const OT_U64 uint 24 +const OT_I8 uint 25 +const OT_I16 uint 26 +const OT_I32 uint 27 +const OT_I64 uint 28 +const OT_BOOL uint 29 +const OT_LPAREN uint 30 +const OT_RPAREN uint 31 +const OT_LBRACE uint 32 +const OT_RBRACE uint 33 +const OT_LBRACK uint 34 +const OT_RBRACK uint 35 +const OT_COMMA uint 36 +const OT_SEMI uint 37 +const OT_COLON uint 38 +const OT_ARROW uint 39 +const OT_DOTDOT uint 40 +const OT_ASSIGN uint 41 +const OT_PLUS uint 42 +const OT_MINUS uint 43 +const OT_STAR uint 44 +const OT_SLASH uint 45 +const OT_PERCENT uint 46 +const OT_AMP uint 47 +const OT_PIPE uint 48 +const OT_CARET uint 49 +const OT_TILDE uint 50 +const OT_BANG uint 51 +const OT_ANDAND uint 52 +const OT_OROR uint 53 +const OT_SHL uint 54 +const OT_SHR uint 55 +const OT_EQ uint 56 +const OT_NE uint 57 +const OT_LT uint 58 +const OT_LE uint 59 +const OT_GT uint 60 +const OT_GE uint 61 +const OT_STRUCT uint 62 +const OT_DOT uint 63 +const OT_ARENA uint 64 +const OT_POOL uint 65 +const OT_HANDLE uint 66 +const OT_IMPORT uint 67 +const OT_BYTES uint 68 +const OT_CELLS uint 69 + +fn lex_digit c uchar to bool +ret and ge c 48 le c 57 +end + +fn lex_alpha c uchar to bool +if eq c 95 + ret true +end +ret or and ge c 65 le c 90 and ge c 97 le c 122 +end + +note Function-mode units cannot contain text globals. Compare exact ASCII spellings +note packed most significant byte first. Identifiers contain no zero bytes. +fn lex_word word view uchar * to uint +if gt len word 10 + ret OT_NAME +end +key = ulong 0 +tail = uint 0 +index = ulong 0 +while lt index len word bound 10 + if lt index 8 + key = or shl key 8 ulong get word index + else + tail = or shl tail 8 uint get word index + end + index = add index 1 +end +if ne tail 0 + note capability + if and eq key 0x6361706162696c69 eq tail 0x7479 + ret OT_RESERVED + end + note authority + if and eq key 0x617574686f726974 eq tail 0x79 + ret OT_RESERVED + end + ret OT_NAME +end +note fn +if eq key 0x666e + ret OT_FN +end +note let +if eq key 0x6c6574 + ret OT_LET +end +note mut +if eq key 0x6d7574 + ret OT_MUT +end +note own +if eq key 0x6f776e + ret OT_OWN +end +note alloc +if eq key 0x616c6c6f63 + ret OT_ALLOC +end +note if +if eq key 0x6966 + ret OT_IF +end +note else +if eq key 0x656c7365 + ret OT_ELSE +end +note while +if eq key 0x7768696c65 + ret OT_WHILE +end +note bound +if eq key 0x626f756e64 + ret OT_BOUND +end +note for +if eq key 0x666f72 + ret OT_FOR +end +note in +if eq key 0x696e + ret OT_IN +end +note return +if eq key 0x72657475726e + ret OT_RETURN +end +note requires +if eq key 0x7265717569726573 + ret OT_REQUIRES +end +note ensures +if eq key 0x656e7375726573 + ret OT_ENSURES +end +note as +if eq key 0x6173 + ret OT_AS +end +note true +if eq key 0x74727565 + ret OT_TRUE +end +note false +if eq key 0x66616c7365 + ret OT_FALSE +end +note u8 +if eq key 0x7538 + ret OT_U8 +end +note u16 +if eq key 0x753136 + ret OT_U16 +end +note u32 +if eq key 0x753332 + ret OT_U32 +end +note u64 +if eq key 0x753634 + ret OT_U64 +end +note i8 +if eq key 0x6938 + ret OT_I8 +end +note i16 +if eq key 0x693136 + ret OT_I16 +end +note i32 +if eq key 0x693332 + ret OT_I32 +end +note i64 +if eq key 0x693634 + ret OT_I64 +end +note bool +if eq key 0x626f6f6c + ret OT_BOOL +end +note struct +if eq key 0x737472756374 + ret OT_STRUCT +end +note arena +if eq key 0x6172656e61 + ret OT_ARENA +end +note pool +if eq key 0x706f6f6c + ret OT_POOL +end +note handle +if eq key 0x68616e646c65 + ret OT_HANDLE +end +note import +if eq key 0x696d706f7274 + ret OT_IMPORT +end +note bytes +if eq key 0x6279746573 + ret OT_BYTES +end +note cells +if eq key 0x63656c6c73 + ret OT_CELLS +end +note free +if eq key 0x66726565 + ret OT_RESERVED +end +note drop +if eq key 0x64726f70 + ret OT_RESERVED +end +note delete +if eq key 0x64656c657465 + ret OT_RESERVED +end +note dealloc +if eq key 0x6465616c6c6f63 + ret OT_RESERVED +end +note effect +if eq key 0x656666656374 + ret OT_RESERVED +end +note cap +if eq key 0x636170 + ret OT_RESERVED +end +note mint +if eq key 0x6d696e74 + ret OT_RESERVED +end +note revoke +if eq key 0x7265766f6b65 + ret OT_RESERVED +end +note grant +if eq key 0x6772616e74 + ret OT_RESERVED +end +note publish +if eq key 0x7075626c697368 + ret OT_RESERVED +end +note promote +if eq key 0x70726f6d6f7465 + ret OT_RESERVED +end +note admin +if eq key 0x61646d696e + ret OT_RESERVED +end +note syscall +if eq key 0x73797363616c6c + ret OT_RESERVED +end +note io +if eq key 0x696f + ret OT_RESERVED +end +note print +if eq key 0x7072696e74 + ret OT_RESERVED +end +note extern +if eq key 0x65787465726e + ret OT_RESERVED +end +note unsafe +if eq key 0x756e73616665 + ret OT_RESERVED +end +note asm +if eq key 0x61736d + ret OT_RESERVED +end +note loop +if eq key 0x6c6f6f70 + ret OT_RESERVED +end +note match +if eq key 0x6d61746368 + ret OT_RESERVED +end +note enum +if eq key 0x656e756d + ret OT_RESERVED +end +note var +if eq key 0x766172 + ret OT_RESERVED +end +note const +if eq key 0x636f6e7374 + ret OT_RESERVED +end +note self +if eq key 0x73656c66 + ret OT_RESERVED +end +note rec +if eq key 0x726563 + ret OT_RESERVED +end +note break +if eq key 0x627265616b + ret OT_RESERVED +end +note continue +if eq key 0x636f6e74696e7565 + ret OT_RESERVED +end +ret OT_NAME +end + +fn lex_pair key uint to uint +note -> +if eq key 0x2d3e + ret OT_ARROW +end +note .. +if eq key 0x2e2e + ret OT_DOTDOT +end +note && +if eq key 0x2626 + ret OT_ANDAND +end +note || +if eq key 0x7c7c + ret OT_OROR +end +note << +if eq key 0x3c3c + ret OT_SHL +end +note >> +if eq key 0x3e3e + ret OT_SHR +end +note == +if eq key 0x3d3d + ret OT_EQ +end +note != +if eq key 0x213d + ret OT_NE +end +note <= +if eq key 0x3c3d + ret OT_LE +end +note >= +if eq key 0x3e3d + ret OT_GE +end +ret OT_EOF +end + +fn lex_single key uint to uint +note ( +if eq key 0x28 + ret OT_LPAREN +end +note ) +if eq key 0x29 + ret OT_RPAREN +end +note { +if eq key 0x7b + ret OT_LBRACE +end +note } +if eq key 0x7d + ret OT_RBRACE +end +note [ +if eq key 0x5b + ret OT_LBRACK +end +note ] +if eq key 0x5d + ret OT_RBRACK +end +note , +if eq key 0x2c + ret OT_COMMA +end +note ; +if eq key 0x3b + ret OT_SEMI +end +note : +if eq key 0x3a + ret OT_COLON +end +note = +if eq key 0x3d + ret OT_ASSIGN +end +note + +if eq key 0x2b + ret OT_PLUS +end +note - +if eq key 0x2d + ret OT_MINUS +end +note * +if eq key 0x2a + ret OT_STAR +end +note / +if eq key 0x2f + ret OT_SLASH +end +note % +if eq key 0x25 + ret OT_PERCENT +end +note & +if eq key 0x26 + ret OT_AMP +end +note | +if eq key 0x7c + ret OT_PIPE +end +note ^ +if eq key 0x5e + ret OT_CARET +end +note ~ +if eq key 0x7e + ret OT_TILDE +end +note ! +if eq key 0x21 + ret OT_BANG +end +note < +if eq key 0x3c + ret OT_LT +end +note > +if eq key 0x3e + ret OT_GT +end +note . +if eq key 0x2e + ret OT_DOT +end +ret OT_EOF +end + +note Leave pos at the first token byte. Only LF advances the line number. +note On an unfinished block comment, report the position of its opening slash. +fn lex_trivia src view uchar * cursor edit lexstate to bool +pos = get cursor pos +line = get cursor line +col = get cursor col +while lt pos len src bound 9223372036854775807 + c = get src pos + if eq c 10 + line = add line 1 + col = 1 + pos = add pos 1 + continue + end + if or eq c 32 or eq c 9 eq c 13 + col = add col 1 + pos = add pos 1 + continue + end + if ne c 47 + break + end + if eq add pos 1 len src + break + end + nextbyte = get src add pos 1 + if eq nextbyte 47 + while lt pos len src bound 9223372036854775807 + if eq get src pos 10 + break + end + pos = add pos 1 + col = add col 1 + end + continue + end + if ne nextbyte 42 + break + end + put cursor line line + put cursor col col + pos = add pos 2 + col = add col 2 + while true bound 9223372036854775807 + if eq pos len src + ret false + end + c = get src pos + pos = add pos 1 + col = add col 1 + if eq c 42 + if lt pos len src + if eq get src pos 47 + pos = add pos 1 + col = add col 1 + break + end + end + end + if eq c 10 + line = add line 1 + col = 1 + end + end +end +put cursor pos pos +put cursor line line +put cursor col col +ret true +end + +note On entry col is the previous token's start column and width its byte length. +note Tokens never cross a line. Trivia updates both coordinates before the capacity check. +export fn osc_lex_next src view uchar * cursor edit lexstate room ulong namemax ulong to ulong +value = new ulong 1 0 +put cursor col add get cursor col get cursor width +if not lex_trivia src cursor + ret 3 +end +if eq room 0 + ret 4 +end +start = get cursor pos +put cursor start start +put cursor width 0 +put cursor value 0 +put cursor kind OT_EOF +if eq start len src + ret 0 +end +c = get src start +pos = add start 1 +if or lex_alpha c lex_digit c + while lt pos len src bound 9223372036854775807 + ch = get src pos + if not or lex_alpha ch lex_digit ch + break + end + pos = add pos 1 + end + size = sub pos start + put cursor pos pos + put cursor width uint size + if lex_digit c + status = osc_parse_literal part src start size value + if ne status 0 + ret status + end + put cursor value get value 0 + put cursor kind OT_INT + else + if gt ulong uint size namemax + ret 5 + end + put cursor kind lex_word part src start size + end + ret 0 +end +kind = OT_EOF +if lt pos len src + pair = or shl uint c 8 uint get src pos + kind = lex_pair pair +end +if ne kind OT_EOF + pos = add pos 1 +else + kind = lex_single uint c + if eq kind OT_EOF + ret 6 + end +end +put cursor kind kind +put cursor pos pos +put cursor width uint sub pos start +ret 0 +end diff --git a/src/compiler/osc_lex.c b/src/compiler/osc_lex.c index 0a6f03cd5..726cd31e5 100644 --- a/src/compiler/osc_lex.c +++ b/src/compiler/osc_lex.c @@ -21,28 +21,10 @@ #include "osc_lex.h" #include "omega_api_decl.h" +#include +#include #include -static const struct { const char *w; int k; } keywords[] = { - {"fn", OT_FN}, {"let", OT_LET}, {"mut", OT_MUT}, {"own", OT_OWN}, {"alloc", OT_ALLOC}, - {"if", OT_IF}, {"else", OT_ELSE}, {"while", OT_WHILE}, {"bound", OT_BOUND}, {"for", OT_FOR}, - {"in", OT_IN}, {"return", OT_RETURN}, {"requires", OT_REQUIRES}, {"ensures", OT_ENSURES}, - {"as", OT_AS}, {"true", OT_TRUE}, {"false", OT_FALSE}, {"u8", OT_U8}, {"u16", OT_U16}, - {"u32", OT_U32}, {"u64", OT_U64}, {"i8", OT_I8}, {"i16", OT_I16}, {"i32", OT_I32}, - {"i64", OT_I64}, {"bool", OT_BOOL}, {"struct", OT_STRUCT}, {"arena", OT_ARENA}, - {"pool", OT_POOL}, {"handle", OT_HANDLE}, {"import", OT_IMPORT}, - {"bytes", OT_BYTES}, {"cells", OT_CELLS}, -}; - -/* Reserved: destruction words (destruction has no surface syntax, III.8) and - * the V0 effect / authority / control-flow words. Never names. */ -static const char *const reserved[] = { - "free", "drop", "delete", "dealloc", - "effect", "cap", "capability", "mint", "revoke", "grant", "publish", "promote", "authority", "admin", - "syscall", "io", "print", "extern", "unsafe", "asm", "loop", "match", "enum", - "var", "const", "self", "rec", "break", "continue", -}; - static const char *const kind_names[OT__COUNT] = { "end of input", "NAME", "INT", "reserved word", "fn", "let", "mut", "own", "alloc", "if", "else", "while", "bound", "for", "in", "return", "requires", @@ -67,128 +49,78 @@ void osc_tok_text(const char *src, const OscToken *t, char *buf, size_t cap) buf[n] = 0; } -static int is_alpha(int c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'; } -static int is_digit(int c) { return c >= '0' && c <= '9'; } +/* Omega selects the refusal and its source location. Keep formatting at the + * OscDiag boundary so all compiler diagnostics use the same representation. */ +static void lex_diag(OscDiag *d, uint64_t status, const char *src, const OscLexState *s, + const OscToken *t, uint32_t cap) +{ + char text[64]; + switch (status) { + case OSC_LEX_COMMENT: + osc_diag_set(d, OSC_DIAG_SYNTAX, s->line, s->col, "/*", 0, NULL, "unterminated comment", + "unterminated /* comment"); + break; + case OSC_LEX_FULL: + osc_diag_set(d, OSC_DIAG_CAPACITY, s->line, s->col, "unit", 0, NULL, "token capacity", + "more than %u tokens", cap); + break; + case OSC_LEX_NAME_LONG: + osc_tok_text(src, t, text, sizeof text); + osc_diag_set(d, OSC_DIAG_CAPACITY, s->line, s->col, text, 0, NULL, "identifier length", + "identifier longer than %d characters", OSC_LEX_NAME_MAX); + break; + case OSC_LITERAL_MALFORMED: + osc_tok_text(src, t, text, sizeof text); + osc_diag_set(d, OSC_DIAG_SYNTAX, s->line, s->col, text, 0, NULL, "malformed literal", + "malformed integer literal '%s'", text); + break; + case OSC_LITERAL_OVERFLOW: + osc_tok_text(src, t, text, sizeof text); + osc_diag_set(d, OSC_DIAG_OVERFLOW_UNSAFE, s->line, s->col, text, 0, NULL, "literal wider than 64 bits", + "integer literal does not fit in 64 bits"); + break; + case OSC_LEX_BAD_BYTE: { + unsigned char c = (unsigned char)src[s->start]; + if (c >= 0x20 && c < 0x7f) { + text[0] = (char)c; + text[1] = 0; + } else { + snprintf(text, sizeof text, "\\x%02x", (unsigned)c); + } + osc_diag_set(d, OSC_DIAG_SYNTAX, s->line, s->col, text, 0, NULL, "unexpected character", + "unexpected character '%s'", text); + break; + } + default: + abort(); + } +} int osc_lex(const char *src, size_t len, OscToken *toks, uint32_t cap, uint32_t *ntok, OscDiag *d) { - size_t i = 0; - uint32_t line = 1, col = 1, n = 0; -#define ADV() do { if (src[i] == '\n') { line++; col = 1; } else col++; i++; } while (0) + OscLexState cursor = {.line = 1, .col = 1}; + uint32_t count = 0; for (;;) { - /* skip whitespace and comments */ - while (i < len) { - char c = src[i]; - if (c == ' ' || c == '\t' || c == '\r' || c == '\n') { ADV(); continue; } - if (c == '/' && i + 1 < len && src[i + 1] == '/') { - while (i < len && src[i] != '\n') ADV(); - continue; - } - if (c == '/' && i + 1 < len && src[i + 1] == '*') { - uint32_t sl = line, sc = col; - ADV(); ADV(); - while (i < len && !(src[i] == '*' && i + 1 < len && src[i + 1] == '/')) ADV(); - if (i >= len) { - osc_diag_set(d, OSC_DIAG_SYNTAX, sl, sc, "/*", 0, NULL, "unterminated comment", - "unterminated /* comment"); - return -1; - } - ADV(); ADV(); - continue; - } - break; + uint64_t status = osc_lex_next((const uint8_t *)src, len, &cursor, cap - count, OSC_LEX_NAME_MAX); + OscToken *t = NULL; + if (status != OSC_LEX_FULL && status != OSC_LEX_COMMENT) { + t = &toks[count]; + memset(t, 0, sizeof *t); + t->kind = (uint16_t)cursor.kind; + t->off = (uint32_t)cursor.start; + t->len = cursor.width; + t->line = cursor.line; + t->col = cursor.col; + t->ival = cursor.value; } - if (n >= cap) { - osc_diag_set(d, OSC_DIAG_CAPACITY, line, col, "unit", 0, NULL, "token capacity", - "more than %u tokens", cap); + if (status) { + lex_diag(d, status, src, &cursor, t, cap); return -1; } - OscToken *t = &toks[n]; - memset(t, 0, sizeof *t); - t->line = line; - t->col = col; - t->off = (uint32_t)i; - if (i >= len) { t->kind = OT_EOF; n++; break; } - char c = src[i]; - if (is_alpha(c)) { - size_t s = i; - while (i < len && (is_alpha(src[i]) || is_digit(src[i]))) ADV(); - t->len = (uint32_t)(i - s); - char buf[OSC_LEX_NAME_MAX + 1]; - if (t->len > OSC_LEX_NAME_MAX) { - osc_tok_text(src, t, buf, sizeof buf); - osc_diag_set(d, OSC_DIAG_CAPACITY, t->line, t->col, buf, 0, NULL, "identifier length", - "identifier longer than %d characters", OSC_LEX_NAME_MAX); - return -1; - } - osc_tok_text(src, t, buf, sizeof buf); - t->kind = OT_NAME; - for (size_t k = 0; k < sizeof keywords / sizeof keywords[0]; k++) - if (strcmp(buf, keywords[k].w) == 0) t->kind = (uint16_t)keywords[k].k; - for (size_t k = 0; k < sizeof reserved / sizeof reserved[0]; k++) - if (strcmp(buf, reserved[k]) == 0) t->kind = OT_RESERVED; - n++; - continue; - } - if (is_digit(c)) { - size_t s = i; - while (i < len && (is_alpha(src[i]) || is_digit(src[i]))) ADV(); - t->len = (uint32_t)(i - s); - uint64_t status = osc_parse_literal((const uint8_t *)src + s, i - s, &t->ival); - char buf[64]; - if (status == OSC_LITERAL_MALFORMED) { - osc_tok_text(src, t, buf, sizeof buf); - osc_diag_set(d, OSC_DIAG_SYNTAX, t->line, t->col, buf, 0, NULL, "malformed literal", - "malformed integer literal '%s'", buf); - return -1; - } - if (status == OSC_LITERAL_OVERFLOW) { - osc_tok_text(src, t, buf, sizeof buf); - osc_diag_set(d, OSC_DIAG_OVERFLOW_UNSAFE, t->line, t->col, buf, 0, NULL, "literal wider than 64 bits", - "integer literal does not fit in 64 bits"); - return -1; - } - t->kind = OT_INT; - n++; - continue; - } - /* punctuation: longest match first */ - static const struct { const char *s; int k; } punct[] = { - {"->", OT_ARROW}, {"..", OT_DOTDOT}, {"&&", OT_ANDAND}, {"||", OT_OROR}, {"<<", OT_SHL}, - {">>", OT_SHR}, {"==", OT_EQ}, {"!=", OT_NE}, {"<=", OT_LE}, {">=", OT_GE}, - {"(", OT_LPAREN}, {")", OT_RPAREN}, {"{", OT_LBRACE}, {"}", OT_RBRACE}, {"[", OT_LBRACK}, - {"]", OT_RBRACK}, {",", OT_COMMA}, {";", OT_SEMI}, {":", OT_COLON}, {"=", OT_ASSIGN}, - {"+", OT_PLUS}, {"-", OT_MINUS}, {"*", OT_STAR}, {"/", OT_SLASH}, {"%", OT_PERCENT}, - {"&", OT_AMP}, {"|", OT_PIPE}, {"^", OT_CARET}, {"~", OT_TILDE}, {"!", OT_BANG}, - {"<", OT_LT}, {">", OT_GT}, {".", OT_DOT}, - }; - int found = 0; - for (size_t k = 0; k < sizeof punct / sizeof punct[0]; k++) { - size_t pl = strlen(punct[k].s); - if (i + pl <= len && memcmp(src + i, punct[k].s, pl) == 0) { - t->kind = (uint16_t)punct[k].k; - t->len = (uint32_t)pl; - for (size_t q = 0; q < pl; q++) ADV(); - found = 1; - break; - } - } - if (!found) { - char buf[8]; - unsigned char uc = (unsigned char)c; - if (uc >= 0x20 && uc < 0x7f) { buf[0] = (char)uc; buf[1] = 0; } - else - { - static const char hx[] = "0123456789abcdef"; - buf[0] = '\\'; buf[1] = 'x'; buf[2] = hx[uc >> 4]; buf[3] = hx[uc & 15]; buf[4] = 0; - } - osc_diag_set(d, OSC_DIAG_SYNTAX, line, col, buf, 0, NULL, "unexpected character", - "unexpected character '%s'", buf); - return -1; + count++; + if (cursor.kind == OT_EOF) { + *ntok = count; + return 0; } - n++; } -#undef ADV - *ntok = n; - return 0; } diff --git a/src/omega_api_decl.h b/src/omega_api_decl.h index dd89def5f..635eb28d5 100644 --- a/src/omega_api_decl.h +++ b/src/omega_api_decl.h @@ -168,8 +168,31 @@ uint64_t rx_fus_word64(const uint8_t o_d[8]); uint64_t rx_fus_eligible_kind(uint64_t o_k); #define OSC_LITERAL_MALFORMED 1 #define OSC_LITERAL_OVERFLOW 2 +#define OSC_LEX_COMMENT 3 +#define OSC_LEX_FULL 4 +#define OSC_LEX_NAME_LONG 5 +#define OSC_LEX_BAD_BYTE 6 +typedef struct { + uint64_t pos; + uint64_t start; + uint64_t value; + uint32_t line; + uint32_t col; + uint32_t width; + uint32_t kind; +} OscLexState; +OMBR_ASSERT(sizeof(OscLexState) == 40, "layout lexstate size"); +OMBR_ASSERT(offsetof(OscLexState, pos) == 0, "layout lexstate field pos"); +OMBR_ASSERT(offsetof(OscLexState, start) == 8, "layout lexstate field start"); +OMBR_ASSERT(offsetof(OscLexState, value) == 16, "layout lexstate field value"); +OMBR_ASSERT(offsetof(OscLexState, line) == 24, "layout lexstate field line"); +OMBR_ASSERT(offsetof(OscLexState, col) == 28, "layout lexstate field col"); +OMBR_ASSERT(offsetof(OscLexState, width) == 32, "layout lexstate field width"); +OMBR_ASSERT(offsetof(OscLexState, kind) == 36, "layout lexstate field kind"); /* export fn osc_parse_literal spelling view uchar * value out ulong 1 to ulong */ uint64_t osc_parse_literal(const uint8_t *o_spelling, size_t o_spelling_len, uint64_t o_value[1]); +/* export fn osc_lex_next src view uchar * cursor edit lexstate room ulong namemax ulong to ulong */ +uint64_t osc_lex_next(const uint8_t *o_src, size_t o_src_len, OscLexState *o_cursor, uint64_t o_room, uint64_t o_namemax); #ifdef __cplusplus } #endif diff --git a/src/omega_native.h b/src/omega_native.h index ce0e42d18..adfbc22e2 100644 --- a/src/omega_native.h +++ b/src/omega_native.h @@ -207,10 +207,12 @@ const char *omega2_ident_rx_fusion_core(void); uint32_t omega2_rx_fus_word64(uint64_t *result, const uint8_t *o_d, uint64_t o_d_len); /* export fn rx_fus_eligible_kind k ulong to ulong */ uint32_t omega2_rx_fus_eligible_kind(uint64_t *result, uint64_t o_k); -#define OMEGA2_IDENT_osc_literal "omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=c61bdcbb9f71b01df86fba045b4206809091e709eba208939a4270b67dabbce2 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" +#define OMEGA2_IDENT_osc_literal "omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=a3fa19176dbf6193b157f84e4b7330e7065215e2ea0bccb0f9dfe706645267fb omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" const char *omega2_ident_osc_literal(void); /* export fn osc_parse_literal spelling view uchar * value out ulong 1 to ulong */ uint32_t omega2_osc_parse_literal(uint64_t *result, const uint8_t *o_spelling, uint64_t o_spelling_len, uint64_t *o_value); +/* export fn osc_lex_next src view uchar * cursor edit lexstate room ulong namemax ulong to ulong */ +uint32_t omega2_osc_lex_next(uint64_t *result, const uint8_t *o_src, uint64_t o_src_len, uint8_t *o_cursor, uint64_t o_room, uint64_t o_namemax); #ifdef __cplusplus } #endif diff --git a/src/omega_om_units.c b/src/omega_om_units.c index 535bd15af..5f6420022 100644 --- a/src/omega_om_units.c +++ b/src/omega_om_units.c @@ -1939,8 +1939,8 @@ __attribute__((visibility("default"))) uint32_t omega2_rx_fus_eligible_kind(uint return OMEGA_BAD_ARG; return ombr2_run(ombr2_entry_rx_fus_eligible_kind, a, result, 1, ou, no); } -__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_literal\n.hidden ombr2_code_osc_literal\nombr2_code_osc_literal:\n.byte 0x1f,0x00,0x00,0x14,0x1f,0xc0,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0xe4,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0x63,0x00,0x00,0xb4,0x00,0xc0,0x00,0xd1,0xc0,0x03,0x5f,0xd6,0x1f,0x04,0x01,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0x18,0x01,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0xa3,0x00,0x00,0xb4,0x01,0x04,0x01,0xd1,0x42,0x01,0x80,0xd2,0x40,0x00,0x01,0x8b,0xc0,0x03,0x5f,0xd6,0x1f,0x84,0x01,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0x98,0x01,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0xa3,0x00,0x00,0xb4,0x01,0x84,0x01,0xd1,0x42,0x01,0x80,0xd2,0x40,0x00,0x01,0x8b,0xc0,0x03,0x5f,0xd6,0x00,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x03,0x00,0x80,0xd2,0x43,0x00,0x00,0xf9,0x43,0x01,0x80,0xd2,0x04,0x00,0x80,0xd2,0x3f,0x08,0x00,0xf1,0x63,0x02,0x00,0x54,0x05,0x00,0x80,0xd2,0xbf,0x00,0x01,0xeb,0xc2,0x0a,0x00,0x54,0x06,0x68,0x65,0x38,0xdf,0xc0,0x00,0xf1,0xa1,0x01,0x00,0x54,0x26,0x00,0x80,0xd2,0xdf,0x00,0x01,0xeb,0x02,0x0a,0x00,0x54,0x05,0x68,0x66,0x38,0xbf,0xe0,0x01,0xf1,0x61,0x00,0x00,0x54,0x03,0x02,0x80,0xd2,0x44,0x00,0x80,0xd2,0xbf,0x88,0x01,0xf1,0x61,0x00,0x00,0x54,0x43,0x00,0x80,0xd2,0x44,0x00,0x80,0xd2,0x9f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0x00,0x80,0xd2,0x06,0x00,0x80,0xd2,0x08,0x00,0x80,0xd2,0x9f,0x00,0x01,0xeb,0x62,0x06,0x00,0x54,0xe9,0xff,0x9f,0xd2,0xe9,0xff,0xbf,0xf2,0xe9,0xff,0xdf,0xf2,0xe9,0xff,0xef,0xf2,0x1f,0x01,0x09,0xeb,0x42,0x07,0x00,0x54,0x08,0x05,0x00,0x91,0x9f,0x00,0x01,0xeb,0xa2,0x06,0x00,0x54,0x0a,0x68,0x64,0x38,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xfe,0x2b,0x00,0xf9,0xe0,0x27,0x40,0xf9,0xaa,0xff,0xff,0x97,0xe9,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xfe,0x2b,0x40,0xf9,0xff,0x83,0x01,0x91,0x3f,0x01,0x03,0xeb,0x63,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x0a,0x00,0x80,0x92,0x4b,0x01,0x09,0xcb,0x43,0x02,0x00,0xb4,0x6c,0x09,0xc3,0x9a,0xbf,0x00,0x0c,0xeb,0x49,0x00,0x00,0x54,0x26,0x00,0x80,0xd2,0xaa,0x7c,0x03,0x9b,0x45,0x01,0x09,0x8b,0x84,0x04,0x00,0x91,0xcd,0xff,0xff,0x17,0x66,0x00,0x00,0xb4,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x45,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x41,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x61,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17,0x81,0x00,0x80,0xd2,0xf8,0xff,0xff,0x17\n.previous\n"); -static const char ombr2_ident_osc_literal[] = "omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=c61bdcbb9f71b01df86fba045b4206809091e709eba208939a4270b67dabbce2 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_literal\n.hidden ombr2_code_osc_literal\nombr2_code_osc_literal:\n.byte 0x20,0x00,0x00,0x14,0x74,0x03,0x00,0x14,0x1f,0xc0,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0xe4,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0x63,0x00,0x00,0xb4,0x00,0xc0,0x00,0xd1,0xc0,0x03,0x5f,0xd6,0x1f,0x04,0x01,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0x18,0x01,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0xa3,0x00,0x00,0xb4,0x01,0x04,0x01,0xd1,0x42,0x01,0x80,0xd2,0x40,0x00,0x01,0x8b,0xc0,0x03,0x5f,0xd6,0x1f,0x84,0x01,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0x98,0x01,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0xa3,0x00,0x00,0xb4,0x01,0x84,0x01,0xd1,0x42,0x01,0x80,0xd2,0x40,0x00,0x01,0x8b,0xc0,0x03,0x5f,0xd6,0x00,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x03,0x00,0x80,0xd2,0x43,0x00,0x00,0xf9,0x43,0x01,0x80,0xd2,0x04,0x00,0x80,0xd2,0x3f,0x08,0x00,0xf1,0x63,0x02,0x00,0x54,0x05,0x00,0x80,0xd2,0xbf,0x00,0x01,0xeb,0xc2,0x0a,0x00,0x54,0x06,0x68,0x65,0x38,0xdf,0xc0,0x00,0xf1,0xa1,0x01,0x00,0x54,0x26,0x00,0x80,0xd2,0xdf,0x00,0x01,0xeb,0x02,0x0a,0x00,0x54,0x05,0x68,0x66,0x38,0xbf,0xe0,0x01,0xf1,0x61,0x00,0x00,0x54,0x03,0x02,0x80,0xd2,0x44,0x00,0x80,0xd2,0xbf,0x88,0x01,0xf1,0x61,0x00,0x00,0x54,0x43,0x00,0x80,0xd2,0x44,0x00,0x80,0xd2,0x9f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0x00,0x80,0xd2,0x06,0x00,0x80,0xd2,0x08,0x00,0x80,0xd2,0x9f,0x00,0x01,0xeb,0x62,0x06,0x00,0x54,0xe9,0xff,0x9f,0xd2,0xe9,0xff,0xbf,0xf2,0xe9,0xff,0xdf,0xf2,0xe9,0xff,0xef,0xf2,0x1f,0x01,0x09,0xeb,0x42,0x07,0x00,0x54,0x08,0x05,0x00,0x91,0x9f,0x00,0x01,0xeb,0xa2,0x06,0x00,0x54,0x0a,0x68,0x64,0x38,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xfe,0x2b,0x00,0xf9,0xe0,0x27,0x40,0xf9,0xaa,0xff,0xff,0x97,0xe9,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xfe,0x2b,0x40,0xf9,0xff,0x83,0x01,0x91,0x3f,0x01,0x03,0xeb,0x63,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x0a,0x00,0x80,0x92,0x4b,0x01,0x09,0xcb,0x43,0x02,0x00,0xb4,0x6c,0x09,0xc3,0x9a,0xbf,0x00,0x0c,0xeb,0x49,0x00,0x00,0x54,0x26,0x00,0x80,0xd2,0xaa,0x7c,0x03,0x9b,0x45,0x01,0x09,0x8b,0x84,0x04,0x00,0x91,0xcd,0xff,0xff,0x17,0x66,0x00,0x00,0xb4,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x45,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x41,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x61,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17,0x81,0x00,0x80,0xd2,0xf8,0xff,0xff,0x17,0x1f,0xc0,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0xe4,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x20,0x00,0x02,0x8a,0xc0,0x03,0x5f,0xd6,0x1f,0x7c,0x01,0xf1,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x04,0x01,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0x68,0x01,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0x1f,0x84,0x01,0xf1,0xe4,0x37,0x9f,0x9a,0x1f,0xe8,0x01,0xf1,0xe5,0x87,0x9f,0x9a,0x86,0x00,0x05,0x8a,0x60,0x00,0x06,0xaa,0xc0,0x03,0x5f,0xd6,0x3f,0x28,0x00,0xf1,0x69,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x02,0x00,0x80,0xd2,0x03,0x00,0x80,0xd2,0x04,0x00,0x80,0xd2,0x05,0x00,0x80,0xd2,0x9f,0x00,0x01,0xeb,0x82,0x02,0x00,0x54,0xbf,0x28,0x00,0xf1,0x62,0x37,0x00,0x54,0xa5,0x04,0x00,0x91,0x9f,0x20,0x00,0xf1,0xe2,0x00,0x00,0x54,0x46,0xdc,0x78,0xd3,0x9f,0x00,0x01,0xeb,0x62,0x36,0x00,0x54,0x08,0x68,0x64,0x38,0xc2,0x00,0x08,0xaa,0x07,0x00,0x00,0x14,0x66,0xdc,0x78,0xd3,0xc6,0x7c,0x40,0xd3,0x9f,0x00,0x01,0xeb,0x82,0x35,0x00,0x54,0x08,0x68,0x64,0x38,0xc3,0x00,0x08,0xaa,0x84,0x04,0x00,0x91,0xec,0xff,0xff,0x17,0x7f,0x00,0x00,0xf1,0x80,0x03,0x00,0x54,0x25,0x8d,0x8d,0xd2,0x25,0x4d,0xac,0xf2,0x25,0x0c,0xce,0xf2,0x25,0x6c,0xec,0xf2,0x5f,0x00,0x05,0xeb,0xe6,0x17,0x9f,0x9a,0x28,0x8f,0x8e,0xd2,0x7f,0x00,0x08,0xeb,0xe9,0x17,0x9f,0x9a,0xca,0x00,0x09,0x8a,0x6a,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0x2e,0x8d,0xd2,0x45,0xee,0xad,0xf2,0x05,0x8d,0xce,0xf2,0xa5,0x2e,0xec,0xf2,0x5f,0x00,0x05,0xeb,0xe6,0x17,0x9f,0x9a,0x7f,0xe4,0x01,0xf1,0xe8,0x17,0x9f,0x9a,0xc9,0x00,0x08,0x8a,0x69,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0xcd,0x8c,0xd2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xae,0x8c,0xd2,0x85,0x0d,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xae,0x8e,0xd2,0xa5,0x0d,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xc0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0xed,0x8e,0xd2,0xe5,0x0d,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xe0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0xec,0x8d,0xd2,0x85,0x8d,0xad,0xf2,0x25,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0x2c,0x8d,0xd2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x20,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0x6c,0x8e,0xd2,0x85,0xad,0xac,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x40,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0x8c,0x8d,0xd2,0x25,0x0d,0xad,0xf2,0xe5,0x0e,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xcc,0x8d,0xd2,0xa5,0xee,0xad,0xf2,0x45,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x80,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x45,0xee,0x8d,0xd2,0xc5,0x0c,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xa0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0x2d,0x8d,0xd2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xc0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0x4d,0x8e,0xd2,0xa5,0x8e,0xae,0xf2,0xa5,0x4c,0xce,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xe0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0xae,0x8c,0xd2,0x45,0x2e,0xad,0xf2,0xa5,0x2e,0xce,0xf2,0xa5,0x4c,0xee,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x00,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0xae,0x8c,0xd2,0x45,0xae,0xae,0xf2,0x65,0xce,0xcd,0xf2,0xa5,0x0c,0xe0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x20,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0x2e,0x8c,0xd2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x40,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0xac,0x8e,0xd2,0x45,0x8e,0xae,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0x6c,0x8e,0xd2,0x85,0x2d,0xac,0xf2,0xc5,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x80,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0xa7,0x8e,0xd2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xa0,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0x26,0x86,0xd2,0xa5,0x0e,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xc0,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x45,0x66,0x86,0xd2,0xa5,0x0e,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xe0,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xc6,0x86,0xd2,0xa5,0x0e,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x00,0x03,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0x27,0x8d,0xd2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x20,0x03,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0x26,0x86,0xd2,0x25,0x0d,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x40,0x03,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x45,0x66,0x86,0xd2,0x25,0x0d,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x03,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xc6,0x86,0xd2,0x25,0x0d,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x80,0x03,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xed,0x8d,0xd2,0xe5,0x4d,0xac,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xa0,0x03,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0x6e,0x8c,0xd2,0xa5,0x4e,0xae,0xf2,0x85,0x6e,0xce,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xc0,0x07,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x25,0xcc,0x8d,0xd2,0xa5,0x4c,0xae,0xf2,0x25,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x00,0x08,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xed,0x8d,0xd2,0xe5,0x0d,0xae,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x20,0x08,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0x8c,0x8d,0xd2,0x85,0xcc,0xad,0xf2,0x25,0x0c,0xcd,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x40,0x08,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0x4e,0x8e,0xd2,0xe5,0x0d,0xae,0xf2,0xa5,0x2d,0xcd,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x08,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0xae,0x8c,0xd2,0x85,0x2e,0xaf,0xf2,0x45,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x80,0x08,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0x8e,0x8d,0xd2,0x85,0xad,0xac,0xf2,0x65,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0xa0,0x08,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0xac,0x8c,0xd2,0x45,0xce,0xac,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0xee,0x8d,0xd2,0x45,0x8e,0xac,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0x8c,0x8e,0xd2,0xa5,0x8c,0xad,0xf2,0xa5,0x8c,0xcc,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0xec,0x8d,0xd2,0x85,0x8d,0xad,0xf2,0x25,0xac,0xcc,0xf2,0x85,0x0c,0xe0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0x6e,0x8c,0xd2,0xa5,0xcc,0xac,0xf2,0xc5,0xac,0xcc,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0x2e,0x8c,0xd2,0x65,0x0c,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xce,0x8d,0xd2,0x25,0xad,0xad,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0x6c,0x8d,0xd2,0xe5,0xcd,0xae,0xf2,0xa5,0x4c,0xce,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xce,0x8d,0xd2,0x25,0x4c,0xae,0xf2,0xe5,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0x6d,0x8e,0xd2,0x25,0x8d,0xad,0xf2,0x45,0xac,0xce,0xf2,0x05,0x0e,0xe0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0x8c,0x8e,0xd2,0xe5,0xad,0xad,0xf2,0xe5,0x4d,0xce,0xf2,0x05,0x0e,0xe0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0x2d,0x8d,0xd2,0xa5,0x8d,0xac,0xf2,0x25,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0x8d,0x8d,0xd2,0x25,0x6c,0xac,0xf2,0x65,0x2e,0xcf,0xf2,0x65,0x0e,0xe0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe5,0x2d,0x8d,0xd2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0xce,0x8d,0xd2,0x25,0x4d,0xae,0xf2,0x05,0x0e,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0x4d,0x8e,0xd2,0xa5,0x8c,0xae,0xf2,0x05,0xaf,0xcc,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0xcc,0x8c,0xd2,0x25,0x6c,0xae,0xf2,0xc5,0xad,0xce,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0x6d,0x8e,0xd2,0x25,0x0c,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0xee,0x8d,0xd2,0xe5,0x8d,0xad,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x05,0x6d,0x8c,0xd2,0x85,0x2e,0xac,0xf2,0xa5,0x0d,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0xad,0x8e,0xd2,0xc5,0xad,0xac,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x45,0x2e,0x8c,0xd2,0xc5,0x0e,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x85,0x6e,0x8e,0xd2,0xc5,0xed,0xad,0xf2,0x65,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc5,0x8c,0x8d,0xd2,0xa5,0x6c,0xae,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0xac,0x8c,0xd2,0x45,0x0e,0xa0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0x2d,0x8c,0xd2,0xa5,0x4c,0xae,0xf2,0x45,0x0c,0xc0,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa5,0xac,0x8e,0xd2,0xc5,0x2d,0xad,0xf2,0x85,0xce,0xcd,0xf2,0xe5,0x6d,0xec,0xf2,0x5f,0x00,0x05,0xeb,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x61,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x81,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17,0xc1,0xa7,0x85,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0xe0,0x04,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc1,0xc5,0x85,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0x00,0x05,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc1,0xc4,0x84,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0x80,0x06,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x81,0x8f,0x8f,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0xa0,0x06,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x81,0x87,0x87,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0xc0,0x06,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xc1,0xc7,0x87,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0xe0,0x06,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa1,0xa7,0x87,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0x00,0x07,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa1,0x27,0x84,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0x20,0x07,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa1,0x87,0x87,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0x60,0x07,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa1,0xc7,0x87,0xd2,0x1f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0xa0,0x07,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xa0,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x03,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xa4,0x00,0xf1,0x61,0x00,0x00,0x54,0xe0,0x03,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xec,0x01,0xf1,0x61,0x00,0x00,0x54,0x00,0x04,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xf4,0x01,0xf1,0x61,0x00,0x00,0x54,0x20,0x04,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x6c,0x01,0xf1,0x61,0x00,0x00,0x54,0x40,0x04,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x74,0x01,0xf1,0x61,0x00,0x00,0x54,0x60,0x04,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xb0,0x00,0xf1,0x61,0x00,0x00,0x54,0x80,0x04,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xec,0x00,0xf1,0x61,0x00,0x00,0x54,0xa0,0x04,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xe8,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x04,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xf4,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x05,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xac,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x05,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xb4,0x00,0xf1,0x61,0x00,0x00,0x54,0x60,0x05,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xa8,0x00,0xf1,0x61,0x00,0x00,0x54,0x80,0x05,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xbc,0x00,0xf1,0x61,0x00,0x00,0x54,0xa0,0x05,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x94,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x05,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x98,0x00,0xf1,0x61,0x00,0x00,0x54,0xe0,0x05,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xf0,0x01,0xf1,0x61,0x00,0x00,0x54,0x00,0x06,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x78,0x01,0xf1,0x61,0x00,0x00,0x54,0x20,0x06,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xf8,0x01,0xf1,0x61,0x00,0x00,0x54,0x40,0x06,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x84,0x00,0xf1,0x61,0x00,0x00,0x54,0x60,0x06,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xf0,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x07,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xf8,0x00,0xf1,0x61,0x00,0x00,0x54,0x80,0x07,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xb8,0x00,0xf1,0x61,0x00,0x00,0x54,0xe0,0x07,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x04,0x00,0x80,0xd2,0x43,0x68,0x64,0xf8,0x05,0x03,0x80,0xd2,0x44,0x68,0x65,0xb8,0x86,0x03,0x80,0xd2,0x45,0x68,0x66,0xb8,0x06,0x00,0x80,0xd2,0x7f,0x00,0x01,0xeb,0x82,0x0d,0x00,0x54,0xe8,0xff,0x9f,0xd2,0xe8,0xff,0xbf,0xf2,0xe8,0xff,0xdf,0xf2,0xe8,0xff,0xef,0xf2,0xdf,0x00,0x08,0xeb,0x62,0x0e,0x00,0x54,0xc6,0x04,0x00,0x91,0x7f,0x00,0x01,0xeb,0xc2,0x0d,0x00,0x54,0x08,0x68,0x63,0x38,0x1f,0x29,0x00,0xf1,0xa1,0x00,0x00,0x54,0x84,0x04,0x00,0x11,0x25,0x00,0x80,0xd2,0x63,0x04,0x00,0x91,0xee,0xfd,0xff,0x54,0x1f,0x81,0x00,0xf1,0xe9,0x17,0x9f,0x9a,0x1f,0x25,0x00,0xf1,0xea,0x17,0x9f,0x9a,0x1f,0x35,0x00,0xf1,0xeb,0x17,0x9f,0x9a,0x4c,0x01,0x0b,0xaa,0x2d,0x01,0x0c,0xaa,0x8d,0x00,0x00,0xb4,0xa5,0x04,0x00,0x11,0x63,0x04,0x00,0x91,0x6e,0xfc,0xff,0x54,0x1f,0xbd,0x00,0xf1,0x40,0x00,0x00,0x54,0xae,0x09,0x00,0x54,0x69,0x04,0x00,0x91,0x3f,0x01,0x01,0xeb,0x41,0x00,0x00,0x54,0x2e,0x09,0x00,0x54,0x6a,0x04,0x00,0x91,0x5f,0x01,0x01,0xeb,0x22,0x0a,0x00,0x54,0x09,0x68,0x6a,0x38,0x3f,0xbd,0x00,0xf1,0xa1,0x02,0x00,0x54,0x0a,0x00,0x80,0xd2,0x7f,0x00,0x01,0xeb,0x22,0x02,0x00,0x54,0xeb,0xff,0x9f,0xd2,0xeb,0xff,0xbf,0xf2,0xeb,0xff,0xdf,0xf2,0xeb,0xff,0xef,0xf2,0x5f,0x01,0x0b,0xeb,0xe2,0x08,0x00,0x54,0x4a,0x05,0x00,0x91,0x7f,0x00,0x01,0xeb,0x42,0x08,0x00,0x54,0x0b,0x68,0x63,0x38,0x7f,0x29,0x00,0xf1,0x41,0x00,0x00,0x54,0x8e,0x00,0x00,0x54,0x63,0x04,0x00,0x91,0xa5,0x04,0x00,0x11,0xef,0xff,0xff,0x17,0x4e,0xf8,0xff,0x54,0x3f,0xa9,0x00,0xf1,0x40,0x00,0x00,0x54,0x8e,0x05,0x00,0x54,0x0a,0x03,0x80,0xd2,0x44,0x68,0x2a,0xb8,0x8a,0x03,0x80,0xd2,0x45,0x68,0x2a,0xb8,0x63,0x08,0x00,0x91,0xa5,0x08,0x00,0x11,0x0a,0x00,0x80,0xd2,0x2b,0x00,0x80,0xd2,0x4b,0x04,0x00,0xb4,0xec,0xff,0x9f,0xd2,0xec,0xff,0xbf,0xf2,0xec,0xff,0xdf,0xf2,0xec,0xff,0xef,0xf2,0x5f,0x01,0x0c,0xeb,0x42,0x05,0x00,0x54,0x4a,0x05,0x00,0x91,0x7f,0x00,0x01,0xeb,0x61,0x00,0x00,0x54,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x7f,0x00,0x01,0xeb,0x22,0x04,0x00,0x54,0x08,0x68,0x63,0x38,0x63,0x04,0x00,0x91,0xa5,0x04,0x00,0x11,0x1f,0xa9,0x00,0xf1,0x61,0x01,0x00,0x54,0x7f,0x00,0x01,0xeb,0x22,0x01,0x00,0x54,0x7f,0x00,0x01,0xeb,0x02,0x03,0x00,0x54,0x0b,0x68,0x63,0x38,0x7f,0xbd,0x00,0xf1,0x81,0x00,0x00,0x54,0x63,0x04,0x00,0x91,0xa5,0x04,0x00,0x11,0xce,0x00,0x00,0x54,0x1f,0x29,0x00,0xf1,0x61,0x00,0x00,0x54,0x84,0x04,0x00,0x11,0x25,0x00,0x80,0xd2,0xde,0xff,0xff,0x17,0x94,0xff,0xff,0x17,0x06,0x00,0x80,0xd2,0x43,0x68,0x26,0xf8,0x06,0x03,0x80,0xd2,0x44,0x68,0x26,0xb8,0x86,0x03,0x80,0xd2,0x45,0x68,0x26,0xb8,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x61,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x81,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17,0x06,0x00,0x80,0xd2,0xff,0x43,0x00,0xd1,0xe5,0x03,0x00,0x91,0x08,0x00,0x80,0xd2,0xa6,0x78,0x28,0xf8,0x08,0x05,0x00,0x91,0x1f,0x05,0x00,0xf1,0xa3,0xff,0xff,0x54,0x86,0x03,0x80,0xd2,0x48,0x68,0x66,0xb8,0x09,0x04,0x80,0xd2,0x4a,0x68,0x69,0xb8,0x0b,0x01,0x0a,0x0b,0x8c,0x03,0x80,0xd2,0x4b,0x68,0x2c,0xb8,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0x63,0xff,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xc8,0x00,0x40,0xd2,0x88,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xff,0x43,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x7f,0x00,0x00,0xf1,0x81,0x00,0x00,0x54,0x80,0x00,0x80,0xd2,0xff,0x43,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x08,0x00,0x80,0xd2,0x46,0x68,0x68,0xf8,0x08,0x01,0x80,0xd2,0x46,0x68,0x28,0xf8,0x08,0x00,0x80,0xd2,0x09,0x04,0x80,0xd2,0x48,0x68,0x29,0xb8,0x08,0x00,0x80,0xd2,0x09,0x02,0x80,0xd2,0x48,0x68,0x29,0xf8,0x08,0x00,0x80,0xd2,0x89,0x04,0x80,0xd2,0x48,0x68,0x29,0xb8,0xdf,0x00,0x01,0xeb,0x81,0x00,0x00,0x54,0x00,0x00,0x80,0xd2,0xff,0x43,0x00,0x91,0xc0,0x03,0x5f,0xd6,0xdf,0x00,0x01,0xeb,0x42,0x2c,0x00,0x54,0x08,0x68,0x66,0x38,0xc9,0x04,0x00,0x91,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xfe,0x27,0x00,0xf9,0xe0,0x1f,0x40,0xf9,0xc3,0xfc,0xff,0x97,0xea,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xfe,0x27,0x40,0xf9,0xff,0x43,0x01,0x91,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xfe,0x2b,0x00,0xf9,0xe0,0x1f,0x40,0xf9,0xa3,0xfc,0xff,0x97,0xeb,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xea,0x27,0x40,0xf9,0xfe,0x2b,0x40,0xf9,0xff,0x83,0x01,0x91,0x4c,0x01,0x0b,0xaa,0x6c,0x1a,0x00,0xb4,0x0a,0x00,0x80,0xd2,0x3f,0x01,0x01,0xeb,0xa2,0x09,0x00,0x54,0xeb,0xff,0x9f,0xd2,0xeb,0xff,0xbf,0xf2,0xeb,0xff,0xdf,0xf2,0xeb,0xff,0xef,0xf2,0x5f,0x01,0x0b,0xeb,0x62,0x24,0x00,0x54,0x4a,0x05,0x00,0x91,0x3f,0x01,0x01,0xeb,0xc2,0x23,0x00,0x54,0x0b,0x68,0x69,0x38,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xeb,0x2b,0x00,0xf9,0xfe,0x2f,0x00,0xf9,0xe0,0x2b,0x40,0xf9,0x7e,0xfc,0xff,0x97,0xec,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xea,0x27,0x40,0xf9,0xeb,0x2b,0x40,0xf9,0xfe,0x2f,0x40,0xf9,0xff,0x83,0x01,0x91,0xff,0xc3,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xeb,0x2b,0x00,0xf9,0xec,0x2f,0x00,0xf9,0xfe,0x33,0x00,0xf9,0xe0,0x2b,0x40,0xf9,0x5a,0xfc,0xff,0x97,0xed,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xea,0x27,0x40,0xf9,0xeb,0x2b,0x40,0xf9,0xec,0x2f,0x40,0xf9,0xfe,0x33,0x40,0xf9,0xff,0xc3,0x01,0x91,0x8e,0x01,0x0d,0xaa,0xcf,0x01,0x40,0xd2,0x4f,0x00,0x00,0xb4,0x6e,0x00,0x00,0x54,0x29,0x05,0x00,0x91,0xb3,0xff,0xff,0x17,0x2a,0x01,0x06,0xcb,0x0b,0x00,0x80,0xd2,0x49,0x68,0x2b,0xf8,0x4b,0xfd,0x60,0xd3,0x4b,0x1b,0x00,0xb5,0x0c,0x04,0x80,0xd2,0x4a,0x68,0x2c,0xb8,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xfe,0x2b,0x00,0xf9,0xe0,0x1f,0x40,0xf9,0x30,0xfc,0xff,0x97,0xeb,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xea,0x27,0x40,0xf9,0xfe,0x2b,0x40,0xf9,0xff,0x83,0x01,0x91,0x4b,0x06,0x00,0xb4,0xdf,0x00,0x01,0xeb,0xc8,0x16,0x00,0x54,0x2c,0x00,0x06,0xcb,0x5f,0x01,0x0c,0xeb,0x68,0x16,0x00,0x54,0x0c,0x00,0x06,0x8b,0xff,0xc3,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xeb,0x2b,0x00,0xf9,0xec,0x2f,0x00,0xf9,0xfe,0x33,0x00,0xf9,0xe0,0x2f,0x40,0xf9,0xe1,0x27,0x40,0xf9,0xe2,0x17,0x40,0xf9,0xa8,0xfb,0xff,0x97,0xeb,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xea,0x27,0x40,0xf9,0xfe,0x33,0x40,0xf9,0xff,0xc3,0x01,0x91,0x7f,0x01,0x00,0xf1,0x80,0x00,0x00,0x54,0xe0,0x03,0x0b,0xaa,0xff,0x43,0x00,0x91,0xc0,0x03,0x5f,0xd6,0xac,0x00,0x40,0xf9,0x0d,0x02,0x80,0xd2,0x4c,0x68,0x2d,0xf8,0x4c,0x00,0x80,0xd2,0x8d,0x04,0x80,0xd2,0x4c,0x68,0x2d,0xb8,0x2d,0x00,0x00,0x14,0x4b,0xfd,0x60,0xd3,0x2b,0x11,0x00,0xb5,0x5f,0x01,0x04,0xeb,0x89,0x00,0x00,0x54,0xa0,0x00,0x80,0xd2,0xff,0x43,0x00,0x91,0xc0,0x03,0x5f,0xd6,0xdf,0x00,0x01,0xeb,0xc8,0x0f,0x00,0x54,0x2b,0x00,0x06,0xcb,0x5f,0x01,0x0b,0xeb,0x68,0x0f,0x00,0x54,0x0b,0x00,0x06,0x8b,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xeb,0x2b,0x00,0xf9,0xfe,0x2f,0x00,0xf9,0xe0,0x2b,0x40,0xf9,0xe1,0x27,0x40,0xf9,0xea,0xfb,0xff,0x97,0xeb,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xea,0x27,0x40,0xf9,0xfe,0x2f,0x40,0xf9,0xff,0x83,0x01,0x91,0x8c,0x04,0x80,0xd2,0x4b,0x68,0x2c,0xb8,0x00,0x00,0x80,0xd2,0xff,0x43,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x0a,0x00,0x80,0xd2,0x3f,0x01,0x01,0xeb,0x62,0x04,0x00,0x54,0x0c,0xdd,0x78,0xd3,0x8c,0x7d,0x40,0xd3,0x3f,0x01,0x01,0xeb,0x22,0x0a,0x00,0x54,0x0d,0x68,0x69,0x38,0x8b,0x01,0x0d,0xaa,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xeb,0x2b,0x00,0xf9,0xfe,0x2f,0x00,0xf9,0xe0,0x2b,0x40,0xf9,0x88,0xfd,0xff,0x97,0xea,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xeb,0x2b,0x40,0xf9,0xfe,0x2f,0x40,0xf9,0xff,0x83,0x01,0x91,0x5f,0x01,0x00,0xf1,0x60,0x00,0x00,0x54,0x29,0x05,0x00,0x91,0x20,0x00,0x00,0x14,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xfe,0x2b,0x00,0xf9,0xe0,0x1f,0x40,0xf9,0x9d,0xfd,0xff,0x97,0xea,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xfe,0x2b,0x40,0xf9,0xff,0x83,0x01,0x91,0x5f,0x01,0x00,0xf1,0x81,0x00,0x00,0x54,0xc0,0x00,0x80,0xd2,0xff,0x43,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x8b,0x04,0x80,0xd2,0x4a,0x68,0x2b,0xb8,0x0b,0x00,0x80,0xd2,0x49,0x68,0x2b,0xf8,0x2b,0x01,0x06,0xcb,0x6c,0xfd,0x60,0xd3,0xac,0x01,0x00,0xb5,0x0d,0x04,0x80,0xd2,0x4b,0x68,0x2d,0xb8,0x00,0x00,0x80,0xd2,0xff,0x43,0x00,0x91,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x61,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x81,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17,0xa1,0x00,0x80,0xd2,0xf8,0xff,0xff,0x17\n.previous\n"); +static const char ombr2_ident_osc_literal[] = "omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=a3fa19176dbf6193b157f84e4b7330e7065215e2ea0bccb0f9dfe706645267fb omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; __attribute__((visibility("default"))) const char *omega2_ident_osc_literal(void) { return ombr2_ident_osc_literal; @@ -1971,6 +1971,31 @@ __attribute__((visibility("default"))) uint32_t omega2_osc_parse_literal(uint64_ return OMEGA_BAD_ARG; return ombr2_run(ombr2_entry_osc_parse_literal, a, result, 1, ou, no); } +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_lex_next\n.hidden ombr2_entry_osc_lex_next\nombr2_entry_osc_lex_next:\nhint #34\nb ombr2_code_osc_literal+4\n.previous\n"); +extern const unsigned char ombr2_entry_osc_lex_next[] __attribute__((visibility("hidden"))); +/* export fn osc_lex_next src view uchar * cursor edit lexstate room ulong namemax ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_lex_next(uint64_t *result, const uint8_t *o_src, uint64_t o_src_len, uint8_t *o_cursor, uint64_t o_room, uint64_t o_namemax) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + if (ombr2_view(sp, &ns, o_src, o_src_len, 1u, 0)) + return OMEGA_BAD_ARG; + a[0] = (uint64_t)(uintptr_t)o_src; + a[1] = o_src_len; + if (ombr2_fixed(sp, &ns, o_cursor, 40u, 1u, 1)) + return OMEGA_BAD_ARG; + a[2] = (uint64_t)(uintptr_t)o_cursor; + a[3] = o_room; + a[4] = o_namemax; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_lex_next, a, result, 1, ou, no); +} /* Generated by omega-bridge src/native.om: the definitions of the C API declared in * omega_api_decl.h (output apic). Each calls omega2_ and calls abort() on a nonzero status. * Regenerate it; do not edit it. */ @@ -2552,3 +2577,11 @@ uint64_t osc_parse_literal(const uint8_t *o_spelling, size_t o_spelling_len, uin abort(); return r; } +/* export fn osc_lex_next src view uchar * cursor edit lexstate room ulong namemax ulong to ulong */ +uint64_t osc_lex_next(const uint8_t *o_src, size_t o_src_len, OscLexState *o_cursor, uint64_t o_room, uint64_t o_namemax) +{ + uint64_t r = 0; + if (omega2_osc_lex_next(&r, o_src, o_src_len, (uint8_t *)o_cursor, (uint64_t)o_room, (uint64_t)o_namemax) != OMEGA_OK) + abort(); + return r; +} diff --git a/src/omega_om_units.ident b/src/omega_om_units.ident index e86139fb7..268a29e0a 100644 --- a/src/omega_om_units.ident +++ b/src/omega_om_units.ident @@ -23,4 +23,4 @@ omega-ident 1 unit=rx_route_core abi=2 profile=OM-2 src=4d45fdbb7089300c5a9f7889 omega-ident 1 unit=rx_world_core abi=2 profile=OM-2 src=fe6656a9770cd0721dd5d5e885bc506ec68ca34d67243cf4b7da57d5e46a0611 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_world_core.om omega-ident 1 unit=rx_skillroute_core abi=2 profile=OM-2 src=568e2a8345feaffe9d1c119697426be1564d2b2317f8bdd192ad7756c39a6c3d omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_skillroute_core.om omega-ident 1 unit=rx_fusion_core abi=2 profile=OM-2 src=aab22272005a4d65c2ada2b9754906cdaa7736ae127042f84457d548875d1ee6 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_fusion_core.om -omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=c61bdcbb9f71b01df86fba045b4206809091e709eba208939a4270b67dabbce2 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_literal.om +omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=a3fa19176dbf6193b157f84e4b7330e7065215e2ea0bccb0f9dfe706645267fb omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_literal.om diff --git a/tests/compiler/osc_lex_reference.c b/tests/compiler/osc_lex_reference.c new file mode 100644 index 000000000..61cfa1aa8 --- /dev/null +++ b/tests/compiler/osc_lex_reference.c @@ -0,0 +1,192 @@ +/* SPDX-License-Identifier: Apache-2.0 + * Copyright 2026 Drake Stapleton (AIEN / aien-dev) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Test oracle: the C lexer before the integer literal migration (parent of acbdf0b67). + * OSC-1 slice; not a general Omega compiler; no self-hosting. + */ +#include "osc_lex.h" + +#include + +static const struct { const char *w; int k; } keywords[] = { + {"fn", OT_FN}, {"let", OT_LET}, {"mut", OT_MUT}, {"own", OT_OWN}, {"alloc", OT_ALLOC}, + {"if", OT_IF}, {"else", OT_ELSE}, {"while", OT_WHILE}, {"bound", OT_BOUND}, {"for", OT_FOR}, + {"in", OT_IN}, {"return", OT_RETURN}, {"requires", OT_REQUIRES}, {"ensures", OT_ENSURES}, + {"as", OT_AS}, {"true", OT_TRUE}, {"false", OT_FALSE}, {"u8", OT_U8}, {"u16", OT_U16}, + {"u32", OT_U32}, {"u64", OT_U64}, {"i8", OT_I8}, {"i16", OT_I16}, {"i32", OT_I32}, + {"i64", OT_I64}, {"bool", OT_BOOL}, {"struct", OT_STRUCT}, {"arena", OT_ARENA}, + {"pool", OT_POOL}, {"handle", OT_HANDLE}, {"import", OT_IMPORT}, + {"bytes", OT_BYTES}, {"cells", OT_CELLS}, +}; + +/* Reserved: destruction words (destruction has no surface syntax, III.8) and + * the V0 effect / authority / control-flow words. Never names. */ +static const char *const reserved[] = { + "free", "drop", "delete", "dealloc", + "effect", "cap", "capability", "mint", "revoke", "grant", "publish", "promote", "authority", "admin", + "syscall", "io", "print", "extern", "unsafe", "asm", "loop", "match", "enum", + "var", "const", "self", "rec", "break", "continue", +}; + +static int is_alpha(int c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'; } +static int is_digit(int c) { return c >= '0' && c <= '9'; } +static int digit_val(int c) +{ + if (c >= '0' && c <= '9') return c - '0'; + if (c >= 'a' && c <= 'f') return c - 'a' + 10; + if (c >= 'A' && c <= 'F') return c - 'A' + 10; + return 99; +} + +int osc_lex_reference(const char *src, size_t len, OscToken *toks, uint32_t cap, uint32_t *ntok, OscDiag *d) +{ + size_t i = 0; + uint32_t line = 1, col = 1, n = 0; +#define ADV() do { if (src[i] == '\n') { line++; col = 1; } else col++; i++; } while (0) + for (;;) { + /* skip whitespace and comments */ + while (i < len) { + char c = src[i]; + if (c == ' ' || c == '\t' || c == '\r' || c == '\n') { ADV(); continue; } + if (c == '/' && i + 1 < len && src[i + 1] == '/') { + while (i < len && src[i] != '\n') ADV(); + continue; + } + if (c == '/' && i + 1 < len && src[i + 1] == '*') { + uint32_t sl = line, sc = col; + ADV(); ADV(); + while (i < len && !(src[i] == '*' && i + 1 < len && src[i + 1] == '/')) ADV(); + if (i >= len) { + osc_diag_set(d, OSC_DIAG_SYNTAX, sl, sc, "/*", 0, NULL, "unterminated comment", + "unterminated /* comment"); + return -1; + } + ADV(); ADV(); + continue; + } + break; + } + if (n >= cap) { + osc_diag_set(d, OSC_DIAG_CAPACITY, line, col, "unit", 0, NULL, "token capacity", + "more than %u tokens", cap); + return -1; + } + OscToken *t = &toks[n]; + memset(t, 0, sizeof *t); + t->line = line; + t->col = col; + t->off = (uint32_t)i; + if (i >= len) { t->kind = OT_EOF; n++; break; } + char c = src[i]; + if (is_alpha(c)) { + size_t s = i; + while (i < len && (is_alpha(src[i]) || is_digit(src[i]))) ADV(); + t->len = (uint32_t)(i - s); + char buf[OSC_LEX_NAME_MAX + 1]; + if (t->len > OSC_LEX_NAME_MAX) { + osc_tok_text(src, t, buf, sizeof buf); + osc_diag_set(d, OSC_DIAG_CAPACITY, t->line, t->col, buf, 0, NULL, "identifier length", + "identifier longer than %d characters", OSC_LEX_NAME_MAX); + return -1; + } + osc_tok_text(src, t, buf, sizeof buf); + t->kind = OT_NAME; + for (size_t k = 0; k < sizeof keywords / sizeof keywords[0]; k++) + if (strcmp(buf, keywords[k].w) == 0) t->kind = (uint16_t)keywords[k].k; + for (size_t k = 0; k < sizeof reserved / sizeof reserved[0]; k++) + if (strcmp(buf, reserved[k]) == 0) t->kind = OT_RESERVED; + n++; + continue; + } + if (is_digit(c)) { + size_t s = i; + unsigned base = 10; + if (c == '0' && i + 1 < len && (src[i + 1] == 'x' || src[i + 1] == 'b')) { + base = src[i + 1] == 'x' ? 16 : 2; + ADV(); ADV(); + } + size_t ds = i; + int overflow = 0; + uint64_t v = 0; + while (i < len && (is_alpha(src[i]) || is_digit(src[i]))) { + int dv = digit_val(src[i]); + if (dv >= (int)base) break; + if (v > (UINT64_MAX - (uint64_t)dv) / base) overflow = 1; + v = v * base + (uint64_t)dv; + ADV(); + } + t->len = (uint32_t)(i - s); + char buf[64]; + if (i == ds || (i < len && (is_alpha(src[i]) || is_digit(src[i])))) { + while (i < len && (is_alpha(src[i]) || is_digit(src[i]))) ADV(); + t->len = (uint32_t)(i - s); + osc_tok_text(src, t, buf, sizeof buf); + osc_diag_set(d, OSC_DIAG_SYNTAX, t->line, t->col, buf, 0, NULL, "malformed literal", + "malformed integer literal '%s'", buf); + return -1; + } + if (overflow) { + osc_tok_text(src, t, buf, sizeof buf); + osc_diag_set(d, OSC_DIAG_OVERFLOW_UNSAFE, t->line, t->col, buf, 0, NULL, "literal wider than 64 bits", + "integer literal does not fit in 64 bits"); + return -1; + } + t->kind = OT_INT; + t->ival = v; + n++; + continue; + } + /* punctuation: longest match first */ + static const struct { const char *s; int k; } punct[] = { + {"->", OT_ARROW}, {"..", OT_DOTDOT}, {"&&", OT_ANDAND}, {"||", OT_OROR}, {"<<", OT_SHL}, + {">>", OT_SHR}, {"==", OT_EQ}, {"!=", OT_NE}, {"<=", OT_LE}, {">=", OT_GE}, + {"(", OT_LPAREN}, {")", OT_RPAREN}, {"{", OT_LBRACE}, {"}", OT_RBRACE}, {"[", OT_LBRACK}, + {"]", OT_RBRACK}, {",", OT_COMMA}, {";", OT_SEMI}, {":", OT_COLON}, {"=", OT_ASSIGN}, + {"+", OT_PLUS}, {"-", OT_MINUS}, {"*", OT_STAR}, {"/", OT_SLASH}, {"%", OT_PERCENT}, + {"&", OT_AMP}, {"|", OT_PIPE}, {"^", OT_CARET}, {"~", OT_TILDE}, {"!", OT_BANG}, + {"<", OT_LT}, {">", OT_GT}, {".", OT_DOT}, + }; + int found = 0; + for (size_t k = 0; k < sizeof punct / sizeof punct[0]; k++) { + size_t pl = strlen(punct[k].s); + if (i + pl <= len && memcmp(src + i, punct[k].s, pl) == 0) { + t->kind = (uint16_t)punct[k].k; + t->len = (uint32_t)pl; + for (size_t q = 0; q < pl; q++) ADV(); + found = 1; + break; + } + } + if (!found) { + char buf[8]; + unsigned char uc = (unsigned char)c; + if (uc >= 0x20 && uc < 0x7f) { buf[0] = (char)uc; buf[1] = 0; } + else + { + static const char hx[] = "0123456789abcdef"; + buf[0] = '\\'; buf[1] = 'x'; buf[2] = hx[uc >> 4]; buf[3] = hx[uc & 15]; buf[4] = 0; + } + osc_diag_set(d, OSC_DIAG_SYNTAX, line, col, buf, 0, NULL, "unexpected character", + "unexpected character '%s'", buf); + return -1; + } + n++; + } +#undef ADV + *ntok = n; + return 0; +} diff --git a/tests/compiler/test_osc_lex.c b/tests/compiler/test_osc_lex.c new file mode 100644 index 000000000..ed6927e3e --- /dev/null +++ b/tests/compiler/test_osc_lex.c @@ -0,0 +1,108 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Run the production entry point and the independent C lexer on identical + * length-delimited bytes. Compare partial output and guard slots on errors. */ +#include "osc_lex.h" + +#include +#include +#include + +int osc_lex_reference(const char *, size_t, OscToken *, uint32_t, uint32_t *, OscDiag *); + +static unsigned cases; + +static void compare(const char *label, const char *src, size_t len, uint32_t cap) +{ + size_t bytes = (cap + (size_t)1) * sizeof(OscToken); + OscToken *want = malloc(bytes), *got = malloc(bytes); + if (!want || !got) abort(); + memset(want, 0xa5, bytes); + memset(got, 0xa5, bytes); + uint32_t nw = UINT32_MAX, ng = UINT32_MAX; + OscDiag dw, dg; + memset(&dw, 0xa5, sizeof dw); + memset(&dg, 0xa5, sizeof dg); + int rw = osc_lex_reference(src, len, want, cap, &nw, &dw); + int rg = osc_lex(src, len, got, cap, &ng, &dg); + if (rw != rg || nw != ng || memcmp(&dw, &dg, sizeof dw) || memcmp(want, got, bytes)) { + fprintf(stderr, "FAIL lexer case %u (%s) len=%zu cap=%u, return %d/%d count %u/%u\n", + cases, label, len, cap, rw, rg, nw, ng); + if (rw) fprintf(stderr, "C diagnostic: %u:%u %s\n", dw.line, dw.col, dw.message); + if (rg) fprintf(stderr, "Omega diagnostic: %u:%u %s\n", dg.line, dg.col, dg.message); + for (uint32_t i = 0; i <= cap; ++i) { + if (memcmp(&want[i], &got[i], sizeof *want)) { + fprintf(stderr, "first differing token %u: kind %u/%u, offset %u/%u, width %u/%u\n", + i, want[i].kind, got[i].kind, want[i].off, got[i].off, want[i].len, got[i].len); + break; + } + } + exit(1); + } + ++cases; + free(want); + free(got); +} + +static void file_case(const char *path) +{ + FILE *f = fopen(path, "rb"); + if (!f || fseek(f, 0, SEEK_END)) { perror(path); exit(1); } + long len = ftell(f); + if (len < 0 || fseek(f, 0, SEEK_SET)) { perror(path); exit(1); } + char *src = malloc((size_t)len + 1); + if (!src || fread(src, 1, (size_t)len, f) != (size_t)len) abort(); + fclose(f); + compare(path, src, (size_t)len, len < OSC_LEX_MAX_TOKENS ? (uint32_t)len + 1 : OSC_LEX_MAX_TOKENS); + free(src); +} + +int main(int argc, char **argv) +{ + static const char *const inputs[] = { + "", " \r\t\n\n", "//", "/**/", "a/* first\nsecond **/\tb// tail\r\n c", + "/***/a", "/* /* */ */", "x\n /*", "x//\n/*abc*", "*/", "x /*/ ", + "fn let mut own alloc if else while bound for in return requires ensures as true false " + "u8 u16 u32 u64 i8 i16 i32 i64 bool struct arena pool handle import bytes cells", + "free drop delete dealloc effect cap capability mint revoke grant publish promote authority admin " + "syscall io print extern unsafe asm loop match enum var const self rec break continue", + "_ _1 _fn fn0 xif Fn IF XAuthority capabilityX requires1 authorityy authoritx capability_", + "( ) { } [ ] , ; : -> .. = + - * / % & | ^ ~ ! && || << >> == != < <= > >= .", + "...->> &&& ||| !== <<==", "0 42 0xff 0b10 18446744073709551615", + "00x", "0x", "0b2", "1_a", "18446744073709551616", "18446744073709551616z", + "x \n @", "x \n /* unfinished", "x\t// trivia before EOF" + }; + for (size_t i = 0; i < sizeof inputs / sizeof *inputs; ++i) { + size_t len = strlen(inputs[i]); + for (uint32_t cap = 0; cap <= len + 1; ++cap) + compare(inputs[i], inputs[i], len, cap); + } + compare("empty null span", NULL, 0, 1); + for (unsigned i = 0; i <= 255; ++i) { + char s[] = {'a', '\n', ' ', (char)i, 'z'}; + compare("all byte values", s, sizeof s, sizeof s + 1); + s[0] = '/'; s[1] = '*'; s[3] = (char)i; s[4] = '*'; + compare("byte in unfinished comment", s, sizeof s, 0); + } + char name[OSC_LEX_NAME_MAX + 2]; + memset(name, 'a', sizeof name); + for (size_t n = sizeof name - 3; n <= sizeof name; ++n) + compare("identifier limit", name, n, 2); + char wide[256]; + memset(wide, '0', sizeof wide); + wide[sizeof wide - 1] = '1'; + compare("leading zeroes", wide, sizeof wide, 2); + memset(wide, '9', sizeof wide); + compare("long overflow", wide, sizeof wide, 2); + wide[sizeof wide - 1] = '_'; + compare("long malformed", wide, sizeof wide, 2); + + char *dense = malloc(OSC_LEX_MAX_TOKENS); + if (!dense) abort(); + memset(dense, ';', OSC_LEX_MAX_TOKENS); + compare("last slot for EOF", dense, OSC_LEX_MAX_TOKENS - 1, OSC_LEX_MAX_TOKENS); + compare("no slot for EOF", dense, OSC_LEX_MAX_TOKENS, OSC_LEX_MAX_TOKENS); + free(dense); + for (int i = 1; i < argc; ++i) file_case(argv[i]); + printf("OSC_LEX_PARITY_PASS cases=%u files=%d\n", cases, argc - 1); + return 0; +} From 613e366fb75f1aef7dd60a128b98402b633297d2 Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Fri, 20 Nov 2026 09:03:04 -0600 Subject: [PATCH 2/4] Parse OSC type syntax in seeded Omega --- CONTRIBUTORS.md | 1 + mk/compiler.mk | 20 +++ om/compiler/osc_type.om | 188 +++++++++++++++++++++++++ om/units.sh | 2 +- src/compiler/osc_parse.c | 144 ++++++++----------- src/omega_api_decl.h | 31 ++++ src/omega_native.h | 4 + src/omega_om_units.c | 42 ++++++ src/omega_om_units.ident | 1 + tests/compiler/test_osc_parse_parity.c | 88 ++++++++++++ 10 files changed, 434 insertions(+), 87 deletions(-) create mode 100644 om/compiler/osc_type.om create mode 100644 tests/compiler/test_osc_parse_parity.c diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 3173071d3..b4376c0b6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -362,3 +362,4 @@ Update this table in the same commit as the work it credits. | Codex (under Drake Stapleton’s direction) | Replayed the nine-check Spark GB10 Q38 stress suite on `371a882a5` and published the [November 20 measurements](docs/gpu/Q38_27B_GB10_STRESS_20261120.md). | | Codex (under Drake Stapleton’s direction) | Implemented the seeded Omega training harness for native tokenization, CPU and GB10 fine-tuning and held-out evaluation. | | Codex (under Drake Stapleton's direction) | Migrated OSC token scanning to seeded Omega and added differential tests against the C lexer. | +| Codex (under Drake Stapleton's direction) | Moved OSC scalar, array, reference and parameter type recognition into the seeded Omega parser. | diff --git a/mk/compiler.mk b/mk/compiler.mk index 51e98df79..fc4fa91c5 100644 --- a/mk/compiler.mk +++ b/mk/compiler.mk @@ -40,6 +40,26 @@ test-osc-lex: $(OSC_DIR)/test_osc_lex test-compiler test-compiler-quick: test-osc-lex +# Optional differential run for source checkouts with Git history. Compile the +# last all-C parser independently and keep it out of the production link. +OSC_PARSE_BASE = 9fccf02150db99662c02863ff6426f4b922f7ee1 +OSC_PARSE_ORACLE = $(OSC_DIR)/osc_parse_$(OSC_PARSE_BASE) +$(OSC_PARSE_ORACLE).c: + @mkdir -p $(OSC_DIR) + git show $(OSC_PARSE_BASE):src/compiler/osc_parse.c > $@.tmp && mv $@.tmp $@ + +$(OSC_PARSE_ORACLE).o: $(OSC_PARSE_ORACLE).c $(OSC_HDRS) + $(CC) $(OSC_CFLAGS) -Dosc_parse=osc_parse_reference -Dosc_node_name=osc_node_name_reference -c $< -o $@ + +OSC_PARSE_PARITY_SRC = tests/compiler/test_osc_parse_parity.c src/compiler/osc_parse.c \ + src/compiler/osc_lex.c src/compiler/osc_diag.c src/omega_om_units.c +$(OSC_DIR)/test_osc_parse_parity: $(OSC_PARSE_PARITY_SRC) $(OSC_PARSE_ORACLE).o $(OSC_HDRS) src/omega_api_decl.h + $(CC) $(OSC_CFLAGS) -o $@ $(OSC_PARSE_PARITY_SRC) $(OSC_PARSE_ORACLE).o + +.PHONY: test-osc-parse-parity +test-osc-parse-parity: $(OSC_DIR)/test_osc_parse_parity + @$(OSC_DIR)/test_osc_parse_parity $(OSC_LEX_FIXTURES) + $(OSC_DIR)/test_osc_model: tests/compiler/test_osc_model.c $(OSC_MODEL) $(OSC_MODEL_GEN) $(OSC_HDRS) @mkdir -p $(OSC_DIR) $(CC) $(OSC_CFLAGS) -o $@ tests/compiler/test_osc_model.c $(OSC_MODEL) $(OSC_MODEL_GEN) diff --git a/om/compiler/osc_type.om b/om/compiler/osc_type.om new file mode 100644 index 000000000..cccc2666c --- /dev/null +++ b/om/compiler/osc_type.om @@ -0,0 +1,188 @@ +note SPDX-License-Identifier: Apache-2.0 +note Parse a scalar, fixed array, reference body or parameter type. The longest +note production is "& mut [ scalar ; INT ]". Input beyond EOF is padded with OT_EOF. +note used counts consumed tokens, including on failure. Named references stop +note at NAME so the caller can resolve it against the current declaration table. +note bridge c-define OSC_TYPE_WINDOW 7 +note bridge c-define OSC_TYPE_SCALAR 1 +note bridge c-define OSC_TYPE_ARRAY 2 +note bridge c-define OSC_TYPE_REF_BODY 3 +note bridge c-define OSC_TYPE_PARAM 4 +note bridge c-define OSC_TYPE_EXPECT_SCALAR 1 +note bridge c-define OSC_TYPE_SLICE_ESCAPE 2 +note bridge c-define OSC_TYPE_EXPECT_OPEN 3 +note bridge c-define OSC_TYPE_EXPECT_SEMI 4 +note bridge c-define OSC_TYPE_EXPECT_LENGTH 5 +note bridge c-define OSC_TYPE_ZERO_LENGTH 6 +note bridge c-define OSC_TYPE_LONG_ARRAY 7 +note bridge c-define OSC_TYPE_EXPECT_CLOSE 8 +note bridge c-define OSC_TYPE_NAMED_REF 9 +note bridge c-define OSC_TYPE_BARE_NAME 10 +note bridge c-define OSC_TYPE_LOCAL_ONLY 11 +note bridge c-type typerec OscParsedType +om2 + +layout typerec 24 +field used uint at 0 little +field scalar uint at 4 little +field refkind uint at 8 little +field elem uint at 12 little +field count ulong at 16 little +end + +note Token and type IDs are the public enums in osc_lex.h and osc_ir.h. +const OT_NAME ushort 1 +const OT_INT ushort 2 +const OT_MUT ushort 6 +const OT_OWN ushort 7 +const OT_U8 ushort 21 +const OT_I64 ushort 28 +const OT_BOOL ushort 29 +const OT_LBRACK ushort 34 +const OT_RBRACK ushort 35 +const OT_SEMI ushort 37 +const OT_AMP ushort 47 +const OT_HANDLE ushort 66 +const OT_POOL ushort 65 +const OT_BYTES ushort 68 +const OT_CELLS ushort 69 +const OSC_TYPE_SCALAR ulong 1 +const OSC_TYPE_ARRAY ulong 2 +const OSC_TYPE_REF_BODY ulong 3 +const OSC_TYPE_PARAM ulong 4 +const OSC_TYPE_EXPECT_SCALAR ulong 1 +const OSC_TYPE_SLICE_ESCAPE ulong 2 +const OSC_TYPE_EXPECT_OPEN ulong 3 +const OSC_TYPE_EXPECT_SEMI ulong 4 +const OSC_TYPE_EXPECT_LENGTH ulong 5 +const OSC_TYPE_ZERO_LENGTH ulong 6 +const OSC_TYPE_LONG_ARRAY ulong 7 +const OSC_TYPE_EXPECT_CLOSE ulong 8 +const OSC_TYPE_NAMED_REF ulong 9 +const OSC_TYPE_BARE_NAME ulong 10 +const OSC_TYPE_LOCAL_ONLY ulong 11 +const TYPE_BOOL uint 1 +const TYPE_U8 uint 2 +const TYPE_REF uint 10 +const TYPE_BYTES uint 11 +const TYPE_CELLS uint 12 +const REF_OWN uint 1 +const REF_SHARED uint 2 +const REF_MUT uint 3 + +fn type_scalar kind ushort to uint +if eq kind OT_BOOL + ret TYPE_BOOL +end +if and ge kind OT_U8 le kind OT_I64 + ret add TYPE_U8 uint sub kind OT_U8 +end +ret 0 +end + +fn type_scalar_error kind ushort to ulong +if or eq kind OT_BYTES eq kind OT_CELLS + ret OSC_TYPE_SLICE_ESCAPE +end +ret OSC_TYPE_EXPECT_SCALAR +end + +fn type_array kinds view ushort 7 values view ulong 7 pos ulong limit ulong result edit typerec to ulong +if ne get kinds pos OT_LBRACK + ret OSC_TYPE_EXPECT_OPEN +end +pos = add pos 1 +put result used uint pos +kind = get kinds pos +scalar = type_scalar kind +if eq scalar 0 + ret type_scalar_error kind +end +pos = add pos 1 +put result used uint pos +if ne get kinds pos OT_SEMI + ret OSC_TYPE_EXPECT_SEMI +end +pos = add pos 1 +put result used uint pos +if ne get kinds pos OT_INT + ret OSC_TYPE_EXPECT_LENGTH +end +size = get values pos +if eq size 0 + ret OSC_TYPE_ZERO_LENGTH +end +if gt size limit + ret OSC_TYPE_LONG_ARRAY +end +pos = add pos 1 +put result used uint pos +if ne get kinds pos OT_RBRACK + ret OSC_TYPE_EXPECT_CLOSE +end +put result used uint add pos 1 +put result scalar TYPE_REF +put result elem scalar +put result count size +ret 0 +end + +export fn osc_read_type kinds view ushort 7 values view ulong 7 form ulong refkind ulong limit ulong result edit typerec to ulong +put result used 0 +put result scalar 0 +put result refkind uint refkind +put result elem 0 +put result count 0 +pos = ulong 0 +kind = get kinds pos +if eq form OSC_TYPE_PARAM + if eq kind OT_OWN + put result refkind REF_OWN + pos = 1 + form = OSC_TYPE_REF_BODY + end + if eq kind OT_AMP + put result refkind REF_SHARED + pos = 1 + if eq get kinds pos OT_MUT + put result refkind REF_MUT + pos = 2 + end + form = OSC_TYPE_REF_BODY + end + put result used uint pos + if eq form OSC_TYPE_PARAM + if eq kind OT_NAME + ret OSC_TYPE_BARE_NAME + end + if or eq kind OT_HANDLE eq kind OT_POOL + ret OSC_TYPE_LOCAL_ONLY + end + if or eq kind OT_BYTES eq kind OT_CELLS + if eq kind OT_BYTES + put result scalar TYPE_BYTES + else + put result scalar TYPE_CELLS + end + put result used 1 + ret 0 + end + end +end +if eq form OSC_TYPE_REF_BODY + if eq get kinds pos OT_NAME + ret OSC_TYPE_NAMED_REF + end + form = OSC_TYPE_ARRAY +end +if eq form OSC_TYPE_ARRAY + ret type_array kinds values pos limit result +end +scalar = type_scalar kind +if eq scalar 0 + ret type_scalar_error kind +end +put result scalar scalar +put result used 1 +ret 0 +end diff --git a/om/units.sh b/om/units.sh index 43b622c65..39c8ee111 100755 --- a/om/units.sh +++ b/om/units.sh @@ -28,7 +28,7 @@ NATIVE_PIN=2c1bf63798336e899704217d98f909b31e567289650751a55d83255c7eb8f27d ROOT=$(cd "$(dirname "$0")/.." && pwd) # One generated library for all units: the bindings share one ABI runtime (ombr_enter). # om/encoder/bw_enc_sm121.om: the sm_121 instruction encoder, twin of aien-dev/CUDApp's (mk/om-encoder.mk). -UNITS="${OMEGA_UNITS:-om/sha256/sha256-om2.om om/blake3/b3unit.om om/encoder/bw_enc_sm121.om om/gpu/bw_qmd.om om/gpu/bw_sched.om om/gpu/q38_plan.om om/gpu/cg_pf.om om/gpu/cg_bf16.om om/gpu/cg_gemm.om om/gpu/cg_moe2.om om/gpu/cg_moe.om om/gpu/cg_qmma.om om/gpu/cg_pfhost.om om/gpu/cg_gpu_attn.om om/runtime/rx_regulate.om om/runtime/rx_mid.om om/runtime/rx_cortex_rec.om om/runtime/rx_plan_core.om om/runtime/rx_projection.om om/runtime/rx_capq_core.om om/runtime/rx_costmodel_core.om om/runtime/rx_route_core.om om/runtime/rx_world_core.om om/runtime/rx_skillroute_core.om om/runtime/rx_fusion_core.om om/compiler/osc_literal.om}" +UNITS="${OMEGA_UNITS:-om/sha256/sha256-om2.om om/blake3/b3unit.om om/encoder/bw_enc_sm121.om om/gpu/bw_qmd.om om/gpu/bw_sched.om om/gpu/q38_plan.om om/gpu/cg_pf.om om/gpu/cg_bf16.om om/gpu/cg_gemm.om om/gpu/cg_moe2.om om/gpu/cg_moe.om om/gpu/cg_qmma.om om/gpu/cg_pfhost.om om/gpu/cg_gpu_attn.om om/runtime/rx_regulate.om om/runtime/rx_mid.om om/runtime/rx_cortex_rec.om om/runtime/rx_plan_core.om om/runtime/rx_projection.om om/runtime/rx_capq_core.om om/runtime/rx_costmodel_core.om om/runtime/rx_route_core.om om/runtime/rx_world_core.om om/runtime/rx_skillroute_core.om om/runtime/rx_fusion_core.om om/compiler/osc_literal.om om/compiler/osc_type.om}" # The units the freestanding GPU link needs (the encoder, codegen, matmul and realize files hash with sha256_*; qmd packs QMDs). FS_UNITS="om/sha256/sha256-om2.om om/gpu/bw_qmd.om om/gpu/cg_gpu_attn.om" DEST="${OMEGA_UNITS_DEST:-$ROOT/src}" diff --git a/src/compiler/osc_parse.c b/src/compiler/osc_parse.c index 62313a0b6..13ad3f932 100644 --- a/src/compiler/osc_parse.c +++ b/src/compiler/osc_parse.c @@ -20,8 +20,10 @@ * OSC-1 slice; not a general Omega compiler; no self-hosting. */ #include "osc_parse.h" +#include "omega_api_decl.h" #include +#include #include #define LOOP_BOUND_MAX 1000000 @@ -97,62 +99,6 @@ static int enter(P *p) } static void leave(P *p) { p->depth--; } -static int scalar_of(int k) -{ - switch (k) { - case OT_U8: return OSC_T_U8; case OT_U16: return OSC_T_U16; case OT_U32: return OSC_T_U32; - case OT_U64: return OSC_T_U64; case OT_I8: return OSC_T_I8; case OT_I16: return OSC_T_I16; - case OT_I32: return OSC_T_I32; case OT_I64: return OSC_T_I64; case OT_BOOL: return OSC_T_BOOL; - default: return 0; - } -} - -static int parse_scalar(P *p, OscType *ty) -{ - int s = scalar_of(cur(p)->kind); - if (at(p, OT_BYTES) || at(p, OT_CELLS)) { - const OscToken *t = cur(p); - osc_diag_set(p->d, OSC_DIAG_SLICE_ESCAPE, t->line, t->col, at(p, OT_BYTES) ? "bytes" : "cells", 0, NULL, - "slice type outside a parameter", "'%s' is a parameter type only: a slice is never a local, field, element or result", - at(p, OT_BYTES) ? "bytes" : "cells"); - return -1; - } - if (!s) return syntax(p, "a type (u8 u16 u32 u64 i8 i16 i32 i64 bool)"); - memset(ty, 0, sizeof *ty); - ty->s = (OscScalar)s; - adv(p); - return 0; -} - -/* "[" type ";" INT "]" with ref kind already consumed */ -static int parse_arr_body(P *p, OscType *ty, OscRefKind rk) -{ - OscType el; - if (expect(p, OT_LBRACK)) return -1; - if (parse_scalar(p, &el)) return -1; - if (expect(p, OT_SEMI)) return -1; - if (!at(p, OT_INT)) return syntax(p, "array length INT"); - const OscToken *lt = cur(p); - if (lt->ival == 0) { - osc_diag_set(p->d, OSC_DIAG_UNSUPPORTED, lt->line, lt->col, "array", 0, NULL, "array length 0", - "array length must be 1..%d", OSC_MAX_ARRAY_LEN); - return -1; - } - if (lt->ival > OSC_MAX_ARRAY_LEN) { - osc_diag_set(p->d, OSC_DIAG_CAPACITY, lt->line, lt->col, "array", 0, NULL, "array length", - "array length %llu > %d", (unsigned long long)lt->ival, OSC_MAX_ARRAY_LEN); - return -1; - } - adv(p); - if (expect(p, OT_RBRACK)) return -1; - memset(ty, 0, sizeof *ty); - ty->s = OSC_T_REF; - ty->ref = rk; - ty->elem = el.s; - ty->len = (uint16_t)lt->ival; - return 0; -} - static int parse_expr(P *p); /* ---- OSC-2 structs (docs/osc/OSC-2-DESIGN.md section 2) ---------------- */ @@ -215,13 +161,6 @@ static int parse_struct_ref(P *p, OscType *ty, OscRefKind rk) return 0; } -/* "[" ... (array) or NAME (struct), ref kind already consumed */ -static int parse_ref_body(P *p, OscType *ty, OscRefKind rk) -{ - if (at(p, OT_NAME)) return parse_struct_ref(p, ty, rk); - return parse_arr_body(p, ty, rk); -} - /* OSC-3 item 2: pools and handles are function-local (never parameters or * results) */ static int local_only(P *p) @@ -233,24 +172,57 @@ static int local_only(P *p) return -1; } -/* ptype: scalar | own[..] | &[..] | &mut[..] | own S | &S | &mut S */ -static int parse_ptype(P *p, OscType *ty) +/* The longest type spelling has OSC_TYPE_WINDOW tokens. A zero kind pads + * the end of the stream with EOF, as peek_kind does. The grammar consumes + * only its prefix and returns the offset of the exact failure token. */ +static int parse_type(P *p, OscType *ty, unsigned form, OscRefKind ref) { - if (at(p, OT_OWN)) { adv(p); return parse_ref_body(p, ty, OSC_REF_OWN); } - if (at(p, OT_AMP)) { - adv(p); - if (at(p, OT_MUT)) { adv(p); return parse_ref_body(p, ty, OSC_REF_MUT); } - return parse_ref_body(p, ty, OSC_REF_SHARED); + uint16_t kinds[OSC_TYPE_WINDOW] = {0}; + uint64_t values[OSC_TYPE_WINDOW] = {0}; + uint32_t remaining = p->ast->ntok - p->pos; + for (unsigned i = 0; i < remaining && i < OSC_TYPE_WINDOW; ++i) { + kinds[i] = p->ast->toks[p->pos + i].kind; + values[i] = p->ast->toks[p->pos + i].ival; } - if (at(p, OT_NAME) && find_struct(p, cur(p)) >= 0) return struct_by_value(p, cur(p), "struct by value"); - if (at(p, OT_BYTES) || at(p, OT_CELLS)) { /* external byte slice: pointer + length registers */ - memset(ty, 0, sizeof *ty); - ty->s = at(p, OT_BYTES) ? OSC_T_BYTES : OSC_T_CELLS; - adv(p); + OscParsedType parsed; + uint64_t status = osc_read_type(kinds, values, form, ref, OSC_MAX_ARRAY_LEN, &parsed); + p->pos += parsed.used; + if (status == 0) { + *ty = (OscType){.s = (OscScalar)parsed.scalar, .ref = (OscRefKind)parsed.refkind, + .elem = (OscScalar)parsed.elem, .len = (uint16_t)parsed.count}; return 0; } - if (at(p, OT_HANDLE) || at(p, OT_POOL)) return local_only(p); - return parse_scalar(p, ty); + const OscToken *t = cur(p); + switch (status) { + case OSC_TYPE_NAMED_REF: + return parse_struct_ref(p, ty, (OscRefKind)parsed.refkind); + case OSC_TYPE_BARE_NAME: + if (find_struct(p, t) >= 0) return struct_by_value(p, t, "struct by value"); + /* fall through */ + case OSC_TYPE_EXPECT_SCALAR: + return syntax(p, "a type (u8 u16 u32 u64 i8 i16 i32 i64 bool)"); + case OSC_TYPE_LOCAL_ONLY: + return local_only(p); + case OSC_TYPE_SLICE_ESCAPE: { + const char *name = osc_tok_kind_name(t->kind); + osc_diag_set(p->d, OSC_DIAG_SLICE_ESCAPE, t->line, t->col, name, 0, NULL, + "slice type outside a parameter", "'%s' is a parameter type only: a slice is never a local, field, element or result", name); + return -1; + } + case OSC_TYPE_EXPECT_OPEN: return syntax(p, osc_tok_kind_name(OT_LBRACK)); + case OSC_TYPE_EXPECT_SEMI: return syntax(p, osc_tok_kind_name(OT_SEMI)); + case OSC_TYPE_EXPECT_LENGTH: return syntax(p, "array length INT"); + case OSC_TYPE_EXPECT_CLOSE: return syntax(p, osc_tok_kind_name(OT_RBRACK)); + case OSC_TYPE_ZERO_LENGTH: + osc_diag_set(p->d, OSC_DIAG_UNSUPPORTED, t->line, t->col, "array", 0, NULL, "array length 0", + "array length must be 1..%d", OSC_MAX_ARRAY_LEN); + return -1; + case OSC_TYPE_LONG_ARRAY: + osc_diag_set(p->d, OSC_DIAG_CAPACITY, t->line, t->col, "array", 0, NULL, "array length", + "array length %llu > %d", (unsigned long long)t->ival, OSC_MAX_ARRAY_LEN); + return -1; + default: abort(); + } } /* struct_decl = "struct" NAME "{" field { "," field } [","] "}" ; @@ -325,12 +297,12 @@ static int parse_struct(P *p) } if (at(p, OT_LBRACK)) { OscType at_; - if (parse_arr_body(p, &at_, OSC_REF_OWN)) return -1; + if (parse_type(p, &at_, OSC_TYPE_ARRAY, OSC_REF_OWN)) return -1; fd->s = at_.elem; fd->alen = at_.len; } else { OscType sc; - if (parse_scalar(p, &sc)) return -1; + if (parse_type(p, &sc, OSC_TYPE_SCALAR, OSC_REF_NONE)) return -1; fd->s = sc.s; } fd->off = (uint16_t)cells; @@ -576,7 +548,7 @@ static int parse_postfix(P *p) int n = new_node(p, ON_CAST, cur(p)); if (n < 0) return -1; adv(p); - if (parse_scalar(p, &N(n)->ty)) return -1; + if (parse_type(p, &N(n)->ty, OSC_TYPE_SCALAR, OSC_REF_NONE)) return -1; N(n)->a = e; N(n)->line = N(e)->line; N(n)->col = N(e)->col; @@ -715,7 +687,7 @@ static int parse_stmt(P *p) return -1; } adv(p); - if (parse_ref_body(p, &N(n)->ty, OSC_REF_OWN)) return -1; + if (parse_type(p, &N(n)->ty, OSC_TYPE_REF_BODY, OSC_REF_OWN)) return -1; int in_arena = -1; /* OSC-2 arenas: "in NAME" */ if (at(p, OT_IN)) { adv(p); @@ -760,7 +732,7 @@ static int parse_stmt(P *p) adv(p); OscRefKind rk = OSC_REF_SHARED; if (at(p, OT_MUT)) { rk = OSC_REF_MUT; adv(p); } - if (parse_ref_body(p, &N(n)->ty, rk)) return -1; + if (parse_type(p, &N(n)->ty, OSC_TYPE_REF_BODY, rk)) return -1; if (expect(p, OT_ASSIGN)) return -1; if (!at(p, OT_AMP)) return syntax(p, "a borrow '&name' or '&mut name'"); int b = parse_borrow(p); @@ -769,7 +741,7 @@ static int parse_stmt(P *p) } else { N(n)->mut = (uint8_t)mut; if (at(p, OT_NAME) && find_struct(p, cur(p)) >= 0) return struct_by_value(p, cur(p), "struct by value"); - if (parse_scalar(p, &N(n)->ty)) return -1; + if (parse_type(p, &N(n)->ty, OSC_TYPE_SCALAR, OSC_REF_NONE)) return -1; if (expect(p, OT_ASSIGN)) return -1; int e = parse_expr(p); if (e < 0) return -1; @@ -855,7 +827,7 @@ static int parse_stmt(P *p) if (parse_name_tok(p, n)) return -1; if (expect(p, OT_COLON)) return -1; if (expect(p, OT_LBRACK)) return -1; - if (parse_scalar(p, &N(n)->ty)) return -1; + if (parse_type(p, &N(n)->ty, OSC_TYPE_SCALAR, OSC_REF_NONE)) return -1; if (expect(p, OT_SEMI)) return -1; if (!at(p, OT_INT)) return syntax(p, "a slot count INT"); const OscToken *kt = cur(p); @@ -1080,7 +1052,7 @@ static int parse_fn(P *p) if (pn < 0) return -1; if (parse_name_tok(p, pn)) return -1; if (expect(p, OT_COLON)) return -1; - if (parse_ptype(p, &N(pn)->ty)) return -1; + if (parse_type(p, &N(pn)->ty, OSC_TYPE_PARAM, OSC_REF_NONE)) return -1; int is_slice = N(pn)->ty.s == OSC_T_BYTES || N(pn)->ty.s == OSC_T_CELLS; nslice += is_slice; np += is_slice ? 2 : 1; /* parameter registers: a slice is pointer + length */ @@ -1118,7 +1090,7 @@ static int parse_fn(P *p) "array return type", "OSC-1 functions return a scalar only"); return -1; } - if (parse_scalar(p, &N(f)->ty)) return -1; + if (parse_type(p, &N(f)->ty, OSC_TYPE_SCALAR, OSC_REF_NONE)) return -1; } uint32_t fi = a->nfns; a->req[fi][0] = a->ens[fi][0] = 0; diff --git a/src/omega_api_decl.h b/src/omega_api_decl.h index 635eb28d5..45f535100 100644 --- a/src/omega_api_decl.h +++ b/src/omega_api_decl.h @@ -193,6 +193,37 @@ OMBR_ASSERT(offsetof(OscLexState, kind) == 36, "layout lexstate field kind"); uint64_t osc_parse_literal(const uint8_t *o_spelling, size_t o_spelling_len, uint64_t o_value[1]); /* export fn osc_lex_next src view uchar * cursor edit lexstate room ulong namemax ulong to ulong */ uint64_t osc_lex_next(const uint8_t *o_src, size_t o_src_len, OscLexState *o_cursor, uint64_t o_room, uint64_t o_namemax); +#define OSC_TYPE_WINDOW 7 +#define OSC_TYPE_SCALAR 1 +#define OSC_TYPE_ARRAY 2 +#define OSC_TYPE_REF_BODY 3 +#define OSC_TYPE_PARAM 4 +#define OSC_TYPE_EXPECT_SCALAR 1 +#define OSC_TYPE_SLICE_ESCAPE 2 +#define OSC_TYPE_EXPECT_OPEN 3 +#define OSC_TYPE_EXPECT_SEMI 4 +#define OSC_TYPE_EXPECT_LENGTH 5 +#define OSC_TYPE_ZERO_LENGTH 6 +#define OSC_TYPE_LONG_ARRAY 7 +#define OSC_TYPE_EXPECT_CLOSE 8 +#define OSC_TYPE_NAMED_REF 9 +#define OSC_TYPE_BARE_NAME 10 +#define OSC_TYPE_LOCAL_ONLY 11 +typedef struct { + uint32_t used; + uint32_t scalar; + uint32_t refkind; + uint32_t elem; + uint64_t count; +} OscParsedType; +OMBR_ASSERT(sizeof(OscParsedType) == 24, "layout typerec size"); +OMBR_ASSERT(offsetof(OscParsedType, used) == 0, "layout typerec field used"); +OMBR_ASSERT(offsetof(OscParsedType, scalar) == 4, "layout typerec field scalar"); +OMBR_ASSERT(offsetof(OscParsedType, refkind) == 8, "layout typerec field refkind"); +OMBR_ASSERT(offsetof(OscParsedType, elem) == 12, "layout typerec field elem"); +OMBR_ASSERT(offsetof(OscParsedType, count) == 16, "layout typerec field count"); +/* export fn osc_read_type kinds view ushort 7 values view ulong 7 form ulong refkind ulong limit ulong result edit typerec to ulong */ +uint64_t osc_read_type(const uint16_t o_kinds[7], const uint64_t o_values[7], uint64_t o_form, uint64_t o_refkind, uint64_t o_limit, OscParsedType *o_result); #ifdef __cplusplus } #endif diff --git a/src/omega_native.h b/src/omega_native.h index adfbc22e2..fdc78be38 100644 --- a/src/omega_native.h +++ b/src/omega_native.h @@ -213,6 +213,10 @@ const char *omega2_ident_osc_literal(void); uint32_t omega2_osc_parse_literal(uint64_t *result, const uint8_t *o_spelling, uint64_t o_spelling_len, uint64_t *o_value); /* export fn osc_lex_next src view uchar * cursor edit lexstate room ulong namemax ulong to ulong */ uint32_t omega2_osc_lex_next(uint64_t *result, const uint8_t *o_src, uint64_t o_src_len, uint8_t *o_cursor, uint64_t o_room, uint64_t o_namemax); +#define OMEGA2_IDENT_osc_type "omega-ident 1 unit=osc_type abi=2 profile=OM-2 src=a33e7745e4cdb1a968b06aff6016de192ef8a2a9d0d2946f5b1f79c91c7f2cba omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" +const char *omega2_ident_osc_type(void); +/* export fn osc_read_type kinds view ushort 7 values view ulong 7 form ulong refkind ulong limit ulong result edit typerec to ulong */ +uint32_t omega2_osc_read_type(uint64_t *result, const uint16_t *o_kinds, uint64_t o_kinds_len, const uint64_t *o_values, uint64_t o_values_len, uint64_t o_form, uint64_t o_refkind, uint64_t o_limit, uint8_t *o_result); #ifdef __cplusplus } #endif diff --git a/src/omega_om_units.c b/src/omega_om_units.c index 5f6420022..1158376f8 100644 --- a/src/omega_om_units.c +++ b/src/omega_om_units.c @@ -1996,6 +1996,40 @@ __attribute__((visibility("default"))) uint32_t omega2_osc_lex_next(uint64_t *re return OMEGA_BAD_ARG; return ombr2_run(ombr2_entry_osc_lex_next, a, result, 1, ou, no); } +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_type\n.hidden ombr2_code_osc_type\nombr2_code_osc_type:\n.byte 0x99,0x00,0x00,0x14,0x1f,0x74,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x54,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0x70,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0xc3,0x00,0x00,0xb4,0x01,0x54,0x00,0xd1,0x21,0x3c,0x40,0xd3,0x42,0x00,0x80,0xd2,0x40,0x00,0x01,0x0b,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x10,0x01,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0x14,0x01,0xf1,0xe2,0x17,0x9f,0x9a,0x23,0x00,0x02,0xaa,0x63,0x00,0x00,0xb4,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x5f,0x1c,0x00,0xf1,0x02,0x0f,0x00,0x54,0x05,0x78,0x62,0x78,0xbf,0x88,0x00,0xf1,0x60,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x42,0x04,0x00,0x91,0x45,0xfc,0x60,0xd3,0x45,0x0e,0x00,0xb5,0x06,0x00,0x80,0xd2,0x82,0x68,0x26,0xb8,0x5f,0x1c,0x00,0xf1,0x82,0x0d,0x00,0x54,0x05,0x78,0x62,0x78,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xfe,0x1f,0x00,0xf9,0xe0,0x17,0x40,0xf9,0xcc,0xff,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1f,0x40,0xf9,0xff,0x03,0x01,0x91,0xdf,0x00,0x00,0xf1,0xa1,0x02,0x00,0x54,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xfe,0x1f,0x00,0xf9,0xe0,0x17,0x40,0xf9,0xc7,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xfe,0x1f,0x40,0xf9,0xff,0x03,0x01,0x91,0xc0,0x03,0x5f,0xd6,0x42,0x04,0x00,0x91,0x48,0xfc,0x60,0xd3,0x08,0x08,0x00,0xb5,0x09,0x00,0x80,0xd2,0x82,0x68,0x29,0xb8,0x5f,0x1c,0x00,0xf1,0x42,0x07,0x00,0x54,0x08,0x78,0x62,0x78,0x1f,0x95,0x00,0xf1,0x60,0x00,0x00,0x54,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x42,0x04,0x00,0x91,0x48,0xfc,0x60,0xd3,0x88,0x06,0x00,0xb5,0x09,0x00,0x80,0xd2,0x82,0x68,0x29,0xb8,0x5f,0x1c,0x00,0xf1,0xc2,0x05,0x00,0x54,0x08,0x78,0x62,0x78,0x1f,0x09,0x00,0xf1,0x60,0x00,0x00,0x54,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x5f,0x1c,0x00,0xf1,0xe2,0x04,0x00,0x54,0x28,0x78,0x62,0xf8,0x1f,0x01,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x01,0x03,0xeb,0x69,0x00,0x00,0x54,0xe0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x42,0x04,0x00,0x91,0x49,0xfc,0x60,0xd3,0xa9,0x03,0x00,0xb5,0x0a,0x00,0x80,0xd2,0x82,0x68,0x2a,0xb8,0x5f,0x1c,0x00,0xf1,0xe2,0x02,0x00,0x54,0x09,0x78,0x62,0x78,0x3f,0x8d,0x00,0xf1,0x60,0x00,0x00,0x54,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x49,0x04,0x00,0x91,0x2a,0xfd,0x60,0xd3,0x2a,0x02,0x00,0xb5,0x0b,0x00,0x80,0xd2,0x89,0x68,0x2b,0xb8,0x49,0x01,0x80,0xd2,0x8a,0x00,0x80,0xd2,0x89,0x68,0x2a,0xb8,0x89,0x01,0x80,0xd2,0x86,0x68,0x29,0xb8,0x09,0x02,0x80,0xd2,0x88,0x68,0x29,0xf8,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x61,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xa1,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17,0x06,0x00,0x80,0xd2,0x08,0x00,0x80,0xd2,0xa6,0x68,0x28,0xb8,0x06,0x00,0x80,0xd2,0x88,0x00,0x80,0xd2,0xa6,0x68,0x28,0xb8,0x66,0xfc,0x60,0xd3,0x06,0x16,0x00,0xb5,0x08,0x01,0x80,0xd2,0xa3,0x68,0x28,0xb8,0x06,0x00,0x80,0xd2,0x88,0x01,0x80,0xd2,0xa6,0x68,0x28,0xb8,0x06,0x00,0x80,0xd2,0x08,0x02,0x80,0xd2,0xa6,0x68,0x28,0xf8,0x06,0x00,0x80,0xd2,0xdf,0x1c,0x00,0xf1,0x62,0x14,0x00,0x54,0x08,0x78,0x66,0x78,0x5f,0x10,0x00,0xf1,0xc1,0x07,0x00,0x54,0x1f,0x1d,0x00,0xf1,0xc1,0x00,0x00,0x54,0x29,0x00,0x80,0xd2,0x0a,0x01,0x80,0xd2,0xa9,0x68,0x2a,0xb8,0x26,0x00,0x80,0xd2,0x62,0x00,0x80,0xd2,0x1f,0xbd,0x00,0xf1,0xe1,0x01,0x00,0x54,0x49,0x00,0x80,0xd2,0x0a,0x01,0x80,0xd2,0xa9,0x68,0x2a,0xb8,0x26,0x00,0x80,0xd2,0xdf,0x1c,0x00,0xf1,0x22,0x12,0x00,0x54,0x09,0x78,0x66,0x78,0x3f,0x19,0x00,0xf1,0xa1,0x00,0x00,0x54,0x69,0x00,0x80,0xd2,0x0a,0x01,0x80,0xd2,0xa9,0x68,0x2a,0xb8,0x46,0x00,0x80,0xd2,0x62,0x00,0x80,0xd2,0xc9,0xfc,0x60,0xd3,0x29,0x11,0x00,0xb5,0x0a,0x00,0x80,0xd2,0xa6,0x68,0x2a,0xb8,0x5f,0x10,0x00,0xf1,0x21,0x04,0x00,0x54,0x1f,0x05,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x09,0x01,0xf1,0xe9,0x17,0x9f,0x9a,0x1f,0x05,0x01,0xf1,0xea,0x17,0x9f,0x9a,0x2b,0x01,0x0a,0xaa,0x6b,0x00,0x00,0xb4,0x60,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x11,0x01,0xf1,0xe9,0x17,0x9f,0x9a,0x1f,0x15,0x01,0xf1,0xea,0x17,0x9f,0x9a,0x2b,0x01,0x0a,0xaa,0xeb,0x01,0x00,0xb4,0x1f,0x11,0x01,0xf1,0xa1,0x00,0x00,0x54,0x69,0x01,0x80,0xd2,0x8a,0x00,0x80,0xd2,0xa9,0x68,0x2a,0xb8,0x04,0x00,0x00,0x14,0x89,0x01,0x80,0xd2,0x8a,0x00,0x80,0xd2,0xa9,0x68,0x2a,0xb8,0x29,0x00,0x80,0xd2,0x0a,0x00,0x80,0xd2,0xa9,0x68,0x2a,0xb8,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x5f,0x0c,0x00,0xf1,0x21,0x01,0x00,0x54,0xdf,0x1c,0x00,0xf1,0xe2,0x0b,0x00,0x54,0x09,0x78,0x66,0x78,0x3f,0x05,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x42,0x00,0x80,0xd2,0x5f,0x08,0x00,0xf1,0x61,0x03,0x00,0x54,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xfe,0x23,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x1b,0x40,0xf9,0xe3,0x13,0x40,0xf9,0xe4,0x17,0x40,0xf9,0x15,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xfe,0x23,0x40,0xf9,0xff,0x43,0x01,0x91,0xc0,0x03,0x5f,0xd6,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xfe,0x27,0x00,0xf9,0xe0,0x1f,0x40,0xf9,0xe3,0xfe,0xff,0x97,0xe9,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xfe,0x27,0x40,0xf9,0xff,0x43,0x01,0x91,0x3f,0x01,0x00,0xf1,0x21,0x03,0x00,0x54,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xfe,0x27,0x00,0xf9,0xe0,0x1f,0x40,0xf9,0xda,0xfe,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xfe,0x27,0x40,0xf9,0xff,0x43,0x01,0x91,0xc0,0x03,0x5f,0xd6,0x8a,0x00,0x80,0xd2,0xa9,0x68,0x2a,0xb8,0x2a,0x00,0x80,0xd2,0x0b,0x00,0x80,0xd2,0xaa,0x68,0x2b,0xb8,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x61,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xa1,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17\n.previous\n"); +static const char ombr2_ident_osc_type[] = "omega-ident 1 unit=osc_type abi=2 profile=OM-2 src=a33e7745e4cdb1a968b06aff6016de192ef8a2a9d0d2946f5b1f79c91c7f2cba omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; +__attribute__((visibility("default"))) const char *omega2_ident_osc_type(void) +{ + return ombr2_ident_osc_type; +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_read_type\n.hidden ombr2_entry_osc_read_type\nombr2_entry_osc_read_type:\nhint #34\nb ombr2_code_osc_type+0\n.previous\n"); +extern const unsigned char ombr2_entry_osc_read_type[] __attribute__((visibility("hidden"))); +/* export fn osc_read_type kinds view ushort 7 values view ulong 7 form ulong refkind ulong limit ulong result edit typerec to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_read_type(uint64_t *result, const uint16_t *o_kinds, uint64_t o_kinds_len, const uint64_t *o_values, uint64_t o_values_len, uint64_t o_form, uint64_t o_refkind, uint64_t o_limit, uint8_t *o_result) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + if (ombr_span_add(sp, &ns, o_kinds, o_kinds_len, 7u, 2u, 0)) + return OMEGA_BAD_ARG; + a[0] = (uint64_t)(uintptr_t)o_kinds; + if (ombr_span_add(sp, &ns, o_values, o_values_len, 7u, 8u, 0)) + return OMEGA_BAD_ARG; + a[1] = (uint64_t)(uintptr_t)o_values; + a[2] = o_form; + a[3] = o_refkind; + a[4] = o_limit; + if (ombr2_fixed(sp, &ns, o_result, 24u, 1u, 1)) + return OMEGA_BAD_ARG; + a[5] = (uint64_t)(uintptr_t)o_result; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_read_type, a, result, 1, ou, no); +} /* Generated by omega-bridge src/native.om: the definitions of the C API declared in * omega_api_decl.h (output apic). Each calls omega2_ and calls abort() on a nonzero status. * Regenerate it; do not edit it. */ @@ -2585,3 +2619,11 @@ uint64_t osc_lex_next(const uint8_t *o_src, size_t o_src_len, OscLexState *o_cur abort(); return r; } +/* export fn osc_read_type kinds view ushort 7 values view ulong 7 form ulong refkind ulong limit ulong result edit typerec to ulong */ +uint64_t osc_read_type(const uint16_t o_kinds[7], const uint64_t o_values[7], uint64_t o_form, uint64_t o_refkind, uint64_t o_limit, OscParsedType *o_result) +{ + uint64_t r = 0; + if (omega2_osc_read_type(&r, o_kinds, 7, o_values, 7, (uint64_t)o_form, (uint64_t)o_refkind, (uint64_t)o_limit, (uint8_t *)o_result) != OMEGA_OK) + abort(); + return r; +} diff --git a/src/omega_om_units.ident b/src/omega_om_units.ident index 268a29e0a..ca70ff884 100644 --- a/src/omega_om_units.ident +++ b/src/omega_om_units.ident @@ -24,3 +24,4 @@ omega-ident 1 unit=rx_world_core abi=2 profile=OM-2 src=fe6656a9770cd0721dd5d5e8 omega-ident 1 unit=rx_skillroute_core abi=2 profile=OM-2 src=568e2a8345feaffe9d1c119697426be1564d2b2317f8bdd192ad7756c39a6c3d omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_skillroute_core.om omega-ident 1 unit=rx_fusion_core abi=2 profile=OM-2 src=aab22272005a4d65c2ada2b9754906cdaa7736ae127042f84457d548875d1ee6 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_fusion_core.om omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=a3fa19176dbf6193b157f84e4b7330e7065215e2ea0bccb0f9dfe706645267fb omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_literal.om +omega-ident 1 unit=osc_type abi=2 profile=OM-2 src=a33e7745e4cdb1a968b06aff6016de192ef8a2a9d0d2946f5b1f79c91c7f2cba omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_type.om diff --git a/tests/compiler/test_osc_parse_parity.c b/tests/compiler/test_osc_parse_parity.c new file mode 100644 index 000000000..e5065c67c --- /dev/null +++ b/tests/compiler/test_osc_parse_parity.c @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Both parsers receive the same tokens, source and initial AST contents. */ +#include "osc_parse.h" + +#include +#include +#include + +int osc_parse_reference(OscAst *, OscDiag *); + +static OscAst old_ast, new_ast; +static OscToken tokens[OSC_LEX_MAX_TOKENS]; +static unsigned passed, lex_refusals; + +static void compare(const char *label, const char *src, size_t size) +{ + OscDiag old_diag = {0}, new_diag = {0}; + uint32_t count; + if (osc_lex(src, size, tokens, OSC_LEX_MAX_TOKENS, &count, &new_diag)) { + ++lex_refusals; + return; + } + memset(&old_ast, 0, sizeof old_ast); + old_ast.src = src; + old_ast.toks = tokens; + old_ast.ntok = count; + memcpy(&new_ast, &old_ast, sizeof old_ast); + int want = osc_parse_reference(&old_ast, &old_diag); + int got = osc_parse(&new_ast, &new_diag); + if (want != got || memcmp(&old_diag, &new_diag, sizeof old_diag) || + memcmp(&old_ast, &new_ast, sizeof old_ast)) { + fprintf(stderr, "FAIL %s\nC (%d) %u:%u %s\nOmega (%d) %u:%u %s\n", + label, want, old_diag.line, old_diag.col, old_diag.message, + got, new_diag.line, new_diag.col, new_diag.message); + exit(1); + } + ++passed; +} + +static void file_case(const char *path) +{ + FILE *f = fopen(path, "rb"); + if (!f || fseek(f, 0, SEEK_END)) { perror(path); exit(1); } + long size = ftell(f); + if (size < 0 || fseek(f, 0, SEEK_SET)) { perror(path); exit(1); } + char *src = malloc((size_t)size + 1); + if (!src || fread(src, 1, (size_t)size, f) != (size_t)size) abort(); + fclose(f); + compare(path, src, (size_t)size); + free(src); +} + +int main(int argc, char **argv) +{ + static const char *const contexts[] = { + "struct S { v:u8 } fn f(x:\n %s) {}", + "struct S { v:u8 } fn f() ->\n %s {}", + "struct S { v:u8 } struct T { member:\n %s }", + "struct S { v:u8 } fn f() { let x:\n %s = 1; }", + "fn f() -> u8 { return 1 as\n %s; }" + }; + static const char *const types[] = { + "u8", "u16", "u32", "u64", "i8", "i16", "i32", "i64", "bool", "bytes", + "cells", "S", "Missing", "pool", "handle", "unsafe", "mut", "", "[", + "[bool", "[u8 1]", "[u8;", "[u8;n]", "[u8;0]", "[u8;1]", "[u8;64]", + "[u8;65]", "[u8;18446744073709551615]", "[bytes;1]", "[cells;1]", + "[free;1]", "[u8;1 free", "own", "own S", "own Missing", "own [u8;3]", + "&", "& S", "& Missing", "&mut", "&mut S", "&mut Missing", + "&mut [", "&mut [i64", "&mut [i64;", "&mut [i64;2", "&mut [i64;2]", + "&mut [u8;0]", "&mut [u8;65]", "&mut [i64;2 free", "& mut pool" + }; + for (int i = 1; i < argc; ++i) file_case(argv[i]); + unsigned before = lex_refusals; + char src[256]; + for (size_t i = 0; i < sizeof types / sizeof *types; ++i) { + for (size_t j = 0; j < sizeof contexts / sizeof *contexts; ++j) { + int n = snprintf(src, sizeof src, contexts[j], types[i]); + if (n < 0 || (size_t)n >= sizeof src) abort(); + compare(src, src, (size_t)n); + } + int n = snprintf(src, sizeof src, "fn f(x:\n %s", types[i]); + if (n < 0 || (size_t)n >= sizeof src) abort(); + compare(src, src, (size_t)n); + } + if (lex_refusals != before) abort(); /* All constructed cases must reach the parser. */ + printf("OSC_PARSE_PARITY_PASS parsed=%u lexer_refusals=%u files=%d\n", passed, lex_refusals, argc - 1); + return 0; +} From 6fa94804914852080b41e6fae8b006a86d5c40b4 Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Fri, 20 Nov 2026 09:03:32 -0600 Subject: [PATCH 3/4] Reduce OSC binary expressions in seeded Omega --- CONTRIBUTORS.md | 1 + om/compiler/osc_expr.om | 96 ++++++++++++++++++++++++++ om/units.sh | 2 +- src/compiler/osc_parse.c | 66 ++++++++---------- src/omega_api_decl.h | 21 ++++++ src/omega_native.h | 4 ++ src/omega_om_units.c | 35 ++++++++++ src/omega_om_units.ident | 1 + tests/compiler/test_osc_parse_parity.c | 33 +++++++++ 9 files changed, 219 insertions(+), 40 deletions(-) create mode 100644 om/compiler/osc_expr.om diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index b4376c0b6..7abb2908d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -363,3 +363,4 @@ Update this table in the same commit as the work it credits. | Codex (under Drake Stapleton’s direction) | Implemented the seeded Omega training harness for native tokenization, CPU and GB10 fine-tuning and held-out evaluation. | | Codex (under Drake Stapleton's direction) | Migrated OSC token scanning to seeded Omega and added differential tests against the C lexer. | | Codex (under Drake Stapleton's direction) | Moved OSC scalar, array, reference and parameter type recognition into the seeded Omega parser. | +| Codex (under Drake Stapleton's direction) | Converted OSC binary-expression precedence, associativity and comparison-chain refusal to seeded Omega. | diff --git a/om/compiler/osc_expr.om b/om/compiler/osc_expr.om new file mode 100644 index 000000000..68dab071e --- /dev/null +++ b/om/compiler/osc_expr.om @@ -0,0 +1,96 @@ +note SPDX-License-Identifier: Apache-2.0 +note OSC infix expressions. Pending operators are strictly increasing in precedence. +note Thus nine precedence levels need nine slots regardless of expression length. +note The caller supplies one parsed unary operand at a time, allocates AST nodes +note on shift, and attaches their edges on reduction. No syntax tree is buffered. +note bridge c-type exprstk OscExprStack +note bridge c-define OSC_EXPR_DONE 0 +note bridge c-define OSC_EXPR_SHIFT 1 +note bridge c-define OSC_EXPR_REDUCE 2 +note bridge c-define OSC_EXPR_CHAINED 3 +om2 + +layout exprstk 120 +field depth uint at 0 little +field rank uint 9 at 4 little +field node int 9 at 40 little +field lhs int 9 at 76 little +field parent int at 112 little +field left int at 116 little +end + +const OT_PLUS uint 42 +const OT_MINUS uint 43 +const OT_STAR uint 44 +const OT_SLASH uint 45 +const OT_PERCENT uint 46 +const OT_AMP uint 47 +const OT_PIPE uint 48 +const OT_CARET uint 49 +const OT_ANDAND uint 52 +const OT_OROR uint 53 +const OT_SHL uint 54 +const OT_SHR uint 55 +const OT_EQ uint 56 +const OT_GE uint 61 +const CMP_RANK uint 3 +const EXPR_DONE ulong 0 +const EXPR_SHIFT ulong 1 +const EXPR_REDUCE ulong 2 +const EXPR_CHAINED ulong 3 + +fn expr_rank kind uint to uint +if eq kind OT_OROR + ret 1 +end +if eq kind OT_ANDAND + ret 2 +end +if and ge kind OT_EQ le kind OT_GE + ret CMP_RANK +end +if eq kind OT_PIPE + ret 4 +end +if eq kind OT_CARET + ret 5 +end +if eq kind OT_AMP + ret 6 +end +if or eq kind OT_SHL eq kind OT_SHR + ret 7 +end +if or eq kind OT_PLUS eq kind OT_MINUS + ret 8 +end +if or eq kind OT_STAR or eq kind OT_SLASH eq kind OT_PERCENT + ret 9 +end +ret 0 +end + +export fn osc_expr_step stack edit exprstk look ulong operand ulong to ulong +rank = expr_rank uint look +depth = get stack depth +if ne depth 0 + top = ulong sub depth 1 + pending = get stack rank top + if ge pending rank + put stack depth sub depth 1 + put stack parent get stack node top + put stack left get stack lhs top + if and eq pending CMP_RANK eq rank CMP_RANK + ret EXPR_CHAINED + end + ret EXPR_REDUCE + end +end +if eq rank 0 + ret EXPR_DONE +end +put stack rank ulong depth rank +put stack lhs ulong depth int operand +put stack depth add depth 1 +ret EXPR_SHIFT +end diff --git a/om/units.sh b/om/units.sh index 39c8ee111..086796ed8 100755 --- a/om/units.sh +++ b/om/units.sh @@ -28,7 +28,7 @@ NATIVE_PIN=2c1bf63798336e899704217d98f909b31e567289650751a55d83255c7eb8f27d ROOT=$(cd "$(dirname "$0")/.." && pwd) # One generated library for all units: the bindings share one ABI runtime (ombr_enter). # om/encoder/bw_enc_sm121.om: the sm_121 instruction encoder, twin of aien-dev/CUDApp's (mk/om-encoder.mk). -UNITS="${OMEGA_UNITS:-om/sha256/sha256-om2.om om/blake3/b3unit.om om/encoder/bw_enc_sm121.om om/gpu/bw_qmd.om om/gpu/bw_sched.om om/gpu/q38_plan.om om/gpu/cg_pf.om om/gpu/cg_bf16.om om/gpu/cg_gemm.om om/gpu/cg_moe2.om om/gpu/cg_moe.om om/gpu/cg_qmma.om om/gpu/cg_pfhost.om om/gpu/cg_gpu_attn.om om/runtime/rx_regulate.om om/runtime/rx_mid.om om/runtime/rx_cortex_rec.om om/runtime/rx_plan_core.om om/runtime/rx_projection.om om/runtime/rx_capq_core.om om/runtime/rx_costmodel_core.om om/runtime/rx_route_core.om om/runtime/rx_world_core.om om/runtime/rx_skillroute_core.om om/runtime/rx_fusion_core.om om/compiler/osc_literal.om om/compiler/osc_type.om}" +UNITS="${OMEGA_UNITS:-om/sha256/sha256-om2.om om/blake3/b3unit.om om/encoder/bw_enc_sm121.om om/gpu/bw_qmd.om om/gpu/bw_sched.om om/gpu/q38_plan.om om/gpu/cg_pf.om om/gpu/cg_bf16.om om/gpu/cg_gemm.om om/gpu/cg_moe2.om om/gpu/cg_moe.om om/gpu/cg_qmma.om om/gpu/cg_pfhost.om om/gpu/cg_gpu_attn.om om/runtime/rx_regulate.om om/runtime/rx_mid.om om/runtime/rx_cortex_rec.om om/runtime/rx_plan_core.om om/runtime/rx_projection.om om/runtime/rx_capq_core.om om/runtime/rx_costmodel_core.om om/runtime/rx_route_core.om om/runtime/rx_world_core.om om/runtime/rx_skillroute_core.om om/runtime/rx_fusion_core.om om/compiler/osc_literal.om om/compiler/osc_type.om om/compiler/osc_expr.om}" # The units the freestanding GPU link needs (the encoder, codegen, matmul and realize files hash with sha256_*; qmd packs QMDs). FS_UNITS="om/sha256/sha256-om2.om om/gpu/bw_qmd.om om/gpu/cg_gpu_attn.om" DEST="${OMEGA_UNITS_DEST:-$ROOT/src}" diff --git a/src/compiler/osc_parse.c b/src/compiler/osc_parse.c index 13ad3f932..b76c1888f 100644 --- a/src/compiler/osc_parse.c +++ b/src/compiler/osc_parse.c @@ -576,54 +576,42 @@ static int parse_unary(P *p) return parse_postfix(p); } -/* binary precedence levels, lowest first */ -static const int levels[][3] = { - {OT_OROR, 0, 0}, {OT_ANDAND, 0, 0}, {0, 0, 0} /* cmp */, {OT_PIPE, 0, 0}, {OT_CARET, 0, 0}, - {OT_AMP, 0, 0}, {OT_SHL, OT_SHR, 0}, {OT_PLUS, OT_MINUS, 0}, {OT_STAR, OT_SLASH, OT_PERCENT}, -}; -#define NLEVELS ((int)(sizeof levels / sizeof levels[0])) -#define CMP_LEVEL 2 - -static int is_cmp(int k) { return k == OT_EQ || k == OT_NE || k == OT_LT || k == OT_LE || k == OT_GT || k == OT_GE; } - -static int parse_level(P *p, int lv) +/* Omega decides when to consume the next operator and when to finish an + * existing node. Allocate at the operator token and attach edges only after + * the right operand parses, preserving the AST prefix on syntax errors. */ +static int parse_expr(P *p) { - if (lv >= NLEVELS) return parse_unary(p); - int l = parse_level(p, lv + 1); - if (l < 0) return -1; - if (lv == CMP_LEVEL) { - if (is_cmp(cur(p)->kind)) { + OscExprStack stack = {0}; + int operand = parse_unary(p); + while (operand >= 0) { + uint64_t action = osc_expr_step(&stack, cur(p)->kind, (uint64_t)operand); + switch (action) { + case OSC_EXPR_DONE: + return operand; + case OSC_EXPR_SHIFT: { int n = new_node(p, ON_BIN, cur(p)); if (n < 0) return -1; + stack.node[stack.depth - 1] = n; N(n)->op = cur(p)->kind; adv(p); - int r = parse_level(p, lv + 1); - if (r < 0) return -1; - N(n)->a = l; - N(n)->b = r; - l = n; - if (is_cmp(cur(p)->kind)) return syntax(p, "no second comparison (comparisons do not chain)"); + operand = parse_unary(p); + break; + } + case OSC_EXPR_REDUCE: + case OSC_EXPR_CHAINED: + N(stack.parent)->a = stack.left; + N(stack.parent)->b = operand; + if (action == OSC_EXPR_CHAINED) + return syntax(p, "no second comparison (comparisons do not chain)"); + operand = stack.parent; + break; + default: + abort(); } - return l; - } - for (;;) { - int k = cur(p)->kind; - if (k == 0 || !(k == levels[lv][0] || k == levels[lv][1] || k == levels[lv][2])) break; - int n = new_node(p, ON_BIN, cur(p)); - if (n < 0) return -1; - N(n)->op = (uint16_t)k; - adv(p); - int r = parse_level(p, lv + 1); - if (r < 0) return -1; - N(n)->a = l; - N(n)->b = r; - l = n; } - return l; + return -1; } -static int parse_expr(P *p) { return parse_level(p, 0); } - static int parse_name_tok(P *p, int n) { if (!at(p, OT_NAME)) return syntax(p, "a name"); diff --git a/src/omega_api_decl.h b/src/omega_api_decl.h index 45f535100..b5c4ef71f 100644 --- a/src/omega_api_decl.h +++ b/src/omega_api_decl.h @@ -224,6 +224,27 @@ OMBR_ASSERT(offsetof(OscParsedType, elem) == 12, "layout typerec field elem"); OMBR_ASSERT(offsetof(OscParsedType, count) == 16, "layout typerec field count"); /* export fn osc_read_type kinds view ushort 7 values view ulong 7 form ulong refkind ulong limit ulong result edit typerec to ulong */ uint64_t osc_read_type(const uint16_t o_kinds[7], const uint64_t o_values[7], uint64_t o_form, uint64_t o_refkind, uint64_t o_limit, OscParsedType *o_result); +#define OSC_EXPR_DONE 0 +#define OSC_EXPR_SHIFT 1 +#define OSC_EXPR_REDUCE 2 +#define OSC_EXPR_CHAINED 3 +typedef struct { + uint32_t depth; + uint32_t rank[9]; + int32_t node[9]; + int32_t lhs[9]; + int32_t parent; + int32_t left; +} OscExprStack; +OMBR_ASSERT(sizeof(OscExprStack) == 120, "layout exprstk size"); +OMBR_ASSERT(offsetof(OscExprStack, depth) == 0, "layout exprstk field depth"); +OMBR_ASSERT(offsetof(OscExprStack, rank) == 4, "layout exprstk field rank"); +OMBR_ASSERT(offsetof(OscExprStack, node) == 40, "layout exprstk field node"); +OMBR_ASSERT(offsetof(OscExprStack, lhs) == 76, "layout exprstk field lhs"); +OMBR_ASSERT(offsetof(OscExprStack, parent) == 112, "layout exprstk field parent"); +OMBR_ASSERT(offsetof(OscExprStack, left) == 116, "layout exprstk field left"); +/* export fn osc_expr_step stack edit exprstk look ulong operand ulong to ulong */ +uint64_t osc_expr_step(OscExprStack *o_stack, uint64_t o_look, uint64_t o_operand); #ifdef __cplusplus } #endif diff --git a/src/omega_native.h b/src/omega_native.h index fdc78be38..8b1ecfc8a 100644 --- a/src/omega_native.h +++ b/src/omega_native.h @@ -217,6 +217,10 @@ uint32_t omega2_osc_lex_next(uint64_t *result, const uint8_t *o_src, uint64_t o_ const char *omega2_ident_osc_type(void); /* export fn osc_read_type kinds view ushort 7 values view ulong 7 form ulong refkind ulong limit ulong result edit typerec to ulong */ uint32_t omega2_osc_read_type(uint64_t *result, const uint16_t *o_kinds, uint64_t o_kinds_len, const uint64_t *o_values, uint64_t o_values_len, uint64_t o_form, uint64_t o_refkind, uint64_t o_limit, uint8_t *o_result); +#define OMEGA2_IDENT_osc_expr "omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=253f0e1162235b4bda264d8e6d6b7953f0cf6f38fcc254523961502a6ca93207 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" +const char *omega2_ident_osc_expr(void); +/* export fn osc_expr_step stack edit exprstk look ulong operand ulong to ulong */ +uint32_t omega2_osc_expr_step(uint64_t *result, uint8_t *o_stack, uint64_t o_look, uint64_t o_operand); #ifdef __cplusplus } #endif diff --git a/src/omega_om_units.c b/src/omega_om_units.c index 1158376f8..d3f53fded 100644 --- a/src/omega_om_units.c +++ b/src/omega_om_units.c @@ -2030,6 +2030,33 @@ __attribute__((visibility("default"))) uint32_t omega2_osc_read_type(uint64_t *r return OMEGA_BAD_ARG; return ombr2_run(ombr2_entry_osc_read_type, a, result, 1, ou, no); } +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_expr\n.hidden ombr2_code_osc_expr\nombr2_code_osc_expr:\n.byte 0x3a,0x00,0x00,0x14,0x1f,0xd4,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xd0,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xe0,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0xf4,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0x63,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xc0,0x00,0xf1,0x61,0x00,0x00,0x54,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xc4,0x00,0xf1,0x61,0x00,0x00,0x54,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xbc,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xd8,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xdc,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x23,0x00,0x02,0xaa,0x63,0x00,0x00,0xb4,0xe0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xa8,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xac,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x23,0x00,0x02,0xaa,0x63,0x00,0x00,0xb4,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xb0,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xb4,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x1f,0xb8,0x00,0xf1,0xe3,0x17,0x9f,0x9a,0x44,0x00,0x03,0xaa,0x25,0x00,0x04,0xaa,0x65,0x00,0x00,0xb4,0x20,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x24,0xfc,0x60,0xd3,0x84,0x0a,0x00,0xb5,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xbd,0xff,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0x05,0x00,0x80,0xd2,0x04,0x68,0x65,0xb8,0x9f,0x00,0x00,0xf1,0xe0,0x04,0x00,0x54,0x86,0x04,0x00,0x51,0xe5,0x03,0x06,0xaa,0xbf,0x24,0x00,0xf1,0x62,0x07,0x00,0x54,0x88,0x00,0x80,0xd2,0x08,0x09,0x05,0x8b,0x06,0x68,0x68,0xb8,0xdf,0x00,0x03,0xeb,0xc3,0x03,0x00,0x54,0x88,0x04,0x00,0x51,0x09,0x00,0x80,0xd2,0x08,0x68,0x29,0xb8,0xbf,0x24,0x00,0xf1,0x22,0x06,0x00,0x54,0x08,0x05,0x80,0xd2,0x08,0x09,0x05,0x8b,0x09,0x68,0x68,0xb8,0x29,0x7d,0x40,0x93,0x0a,0x0e,0x80,0xd2,0x09,0x68,0x2a,0xb8,0xbf,0x24,0x00,0xf1,0x22,0x05,0x00,0x54,0x88,0x09,0x80,0xd2,0x08,0x09,0x05,0x8b,0x09,0x68,0x68,0xb8,0x29,0x7d,0x40,0x93,0x8a,0x0e,0x80,0xd2,0x09,0x68,0x2a,0xb8,0xdf,0x0c,0x00,0xf1,0xe8,0x17,0x9f,0x9a,0x7f,0x0c,0x00,0xf1,0xe9,0x17,0x9f,0x9a,0x0a,0x01,0x09,0x8a,0x6a,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x7f,0x00,0x00,0xf1,0x61,0x00,0x00,0x54,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x9f,0x24,0x00,0xf1,0x62,0x02,0x00,0x54,0x85,0x00,0x80,0xd2,0xa5,0x08,0x04,0x8b,0x03,0x68,0x25,0xb8,0x45,0xfc,0x5f,0xd3,0x05,0x02,0x00,0xb5,0x9f,0x24,0x00,0xf1,0x82,0x01,0x00,0x54,0x86,0x09,0x80,0xd2,0xc6,0x08,0x04,0x8b,0x02,0x68,0x26,0xb8,0x85,0x04,0x00,0x11,0x06,0x00,0x80,0xd2,0x05,0x68,0x26,0xb8,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x61,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xa1,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17\n.previous\n"); +static const char ombr2_ident_osc_expr[] = "omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=253f0e1162235b4bda264d8e6d6b7953f0cf6f38fcc254523961502a6ca93207 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; +__attribute__((visibility("default"))) const char *omega2_ident_osc_expr(void) +{ + return ombr2_ident_osc_expr; +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_expr_step\n.hidden ombr2_entry_osc_expr_step\nombr2_entry_osc_expr_step:\nhint #34\nb ombr2_code_osc_expr+0\n.previous\n"); +extern const unsigned char ombr2_entry_osc_expr_step[] __attribute__((visibility("hidden"))); +/* export fn osc_expr_step stack edit exprstk look ulong operand ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_expr_step(uint64_t *result, uint8_t *o_stack, uint64_t o_look, uint64_t o_operand) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + if (ombr2_fixed(sp, &ns, o_stack, 120u, 1u, 1)) + return OMEGA_BAD_ARG; + a[0] = (uint64_t)(uintptr_t)o_stack; + a[1] = o_look; + a[2] = o_operand; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_expr_step, a, result, 1, ou, no); +} /* Generated by omega-bridge src/native.om: the definitions of the C API declared in * omega_api_decl.h (output apic). Each calls omega2_ and calls abort() on a nonzero status. * Regenerate it; do not edit it. */ @@ -2627,3 +2654,11 @@ uint64_t osc_read_type(const uint16_t o_kinds[7], const uint64_t o_values[7], ui abort(); return r; } +/* export fn osc_expr_step stack edit exprstk look ulong operand ulong to ulong */ +uint64_t osc_expr_step(OscExprStack *o_stack, uint64_t o_look, uint64_t o_operand) +{ + uint64_t r = 0; + if (omega2_osc_expr_step(&r, (uint8_t *)o_stack, (uint64_t)o_look, (uint64_t)o_operand) != OMEGA_OK) + abort(); + return r; +} diff --git a/src/omega_om_units.ident b/src/omega_om_units.ident index ca70ff884..910925c36 100644 --- a/src/omega_om_units.ident +++ b/src/omega_om_units.ident @@ -25,3 +25,4 @@ omega-ident 1 unit=rx_skillroute_core abi=2 profile=OM-2 src=568e2a8345feaffe9d1 omega-ident 1 unit=rx_fusion_core abi=2 profile=OM-2 src=aab22272005a4d65c2ada2b9754906cdaa7736ae127042f84457d548875d1ee6 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_fusion_core.om omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=a3fa19176dbf6193b157f84e4b7330e7065215e2ea0bccb0f9dfe706645267fb omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_literal.om omega-ident 1 unit=osc_type abi=2 profile=OM-2 src=a33e7745e4cdb1a968b06aff6016de192ef8a2a9d0d2946f5b1f79c91c7f2cba omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_type.om +omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=253f0e1162235b4bda264d8e6d6b7953f0cf6f38fcc254523961502a6ca93207 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_expr.om diff --git a/tests/compiler/test_osc_parse_parity.c b/tests/compiler/test_osc_parse_parity.c index e5065c67c..4cc2b1cf1 100644 --- a/tests/compiler/test_osc_parse_parity.c +++ b/tests/compiler/test_osc_parse_parity.c @@ -50,6 +50,38 @@ static void file_case(const char *path) free(src); } +static void expression_cases(void) +{ + static const char *const operators[] = { + "||", "&&", "==", "!=", "<", "<=", ">", ">=", "|", "^", "&", + "<<", ">>", "+", "-", "*", "/", "%" + }; + static const char *const forms[] = { + "a %s b %s c", "(a %s b) %s c", "a %s (b %s c)", "a %s -b %s" + }; + char src[256]; + for (size_t i = 0; i < sizeof operators / sizeof *operators; ++i) { + for (size_t j = 0; j < sizeof operators / sizeof *operators; ++j) { + for (size_t k = 0; k < sizeof forms / sizeof *forms; ++k) { + char expr[64]; + int ne = snprintf(expr, sizeof expr, forms[k], operators[i], operators[j]); + int n = snprintf(src, sizeof src, "fn f() -> u64 { return %s; }", expr); + if (ne < 0 || (size_t)ne >= sizeof expr || n < 0 || (size_t)n >= sizeof src) abort(); + compare(src, src, (size_t)n); + } + } + } + static const char *const edge[] = { + "fn f() -> u64 { return a || b && c == d | e ^ f & g << h + i * j; }", + "fn f() -> u64 { return a * b + c << d & e ^ f | g == h && i || j; }", + "fn f() -> u64 { return a == b * c < d; }", + "fn f() -> u64 { return a == b && c == d; }", + "fn f() -> u64 { return a * (b + c", "fn f() -> u64 { return -(-a) << ~b; }" + }; + for (size_t i = 0; i < sizeof edge / sizeof *edge; ++i) + compare(edge[i], edge[i], strlen(edge[i])); +} + int main(int argc, char **argv) { static const char *const contexts[] = { @@ -82,6 +114,7 @@ int main(int argc, char **argv) if (n < 0 || (size_t)n >= sizeof src) abort(); compare(src, src, (size_t)n); } + expression_cases(); if (lex_refusals != before) abort(); /* All constructed cases must reach the parser. */ printf("OSC_PARSE_PARITY_PASS parsed=%u lexer_refusals=%u files=%d\n", passed, lex_refusals, argc - 1); return 0; From 1ad59530e61f1d99fc1b929f74149e0e4bb5ccb7 Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Fri, 20 Nov 2026 09:16:33 -0600 Subject: [PATCH 4/4] Move OSC operands, scalar semantics and AArch64 instruction fields to Omega --- CONTRIBUTORS.md | 1 + mk/compiler.mk | 14 + om/compiler/osc_a64_fields.om | 276 +++++++++++++++++ om/compiler/osc_expr.om | 114 +++++++ om/compiler/osc_scalar.om | 313 +++++++++++++++++++ om/units.sh | 2 +- src/compiler/osc_a64.c | 173 ++++------- src/compiler/osc_check.c | 217 +++---------- src/compiler/osc_interp.c | 118 ++----- src/compiler/osc_lower.c | 34 +-- src/compiler/osc_parse.c | 178 ++++++----- src/omega_api_decl.h | 89 ++++++ src/omega_native.h | 32 +- src/omega_om_units.c | 390 +++++++++++++++++++++++- src/omega_om_units.ident | 4 +- tests/compiler/test_osc_parse_parity.c | 5 + tests/compiler/test_osc_scalar_parity.c | 92 ++++++ 17 files changed, 1543 insertions(+), 509 deletions(-) create mode 100644 om/compiler/osc_a64_fields.om create mode 100644 om/compiler/osc_scalar.om create mode 100644 tests/compiler/test_osc_scalar_parity.c diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 7abb2908d..48800e0e0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -364,3 +364,4 @@ Update this table in the same commit as the work it credits. | Codex (under Drake Stapleton's direction) | Migrated OSC token scanning to seeded Omega and added differential tests against the C lexer. | | Codex (under Drake Stapleton's direction) | Moved OSC scalar, array, reference and parameter type recognition into the seeded Omega parser. | | Codex (under Drake Stapleton's direction) | Converted OSC binary-expression precedence, associativity and comparison-chain refusal to seeded Omega. | +| Codex (under Drake Stapleton's direction) | Migrated OSC operand recognition, prefix and cast parsing, scalar arithmetic and traps, constant folding and contract arithmetic, scalar opcode selection, and AArch64 instruction fields to seeded Omega. | diff --git a/mk/compiler.mk b/mk/compiler.mk index fc4fa91c5..dc96fbdd0 100644 --- a/mk/compiler.mk +++ b/mk/compiler.mk @@ -60,6 +60,20 @@ $(OSC_DIR)/test_osc_parse_parity: $(OSC_PARSE_PARITY_SRC) $(OSC_PARSE_ORACLE).o test-osc-parse-parity: $(OSC_DIR)/test_osc_parse_parity @$(OSC_DIR)/test_osc_parse_parity $(OSC_LEX_FIXTURES) +# The frozen interpreter supplies the arithmetic oracle, including its native +# C trap path, only when running differential tests from a source checkout. +$(OSC_DIR)/osc_interp_reference.c: + @mkdir -p $(OSC_DIR) + git show $(OSC_PARSE_BASE):src/compiler/osc_interp.c > $@.tmp && mv $@.tmp $@ + +OSC_SCALAR_PARITY_LIB = $(filter-out src/compiler/osc_interp.c,$(OSC_LIB)) +$(OSC_DIR)/test_osc_scalar_parity: tests/compiler/test_osc_scalar_parity.c $(OSC_DIR)/osc_interp_reference.c $(OSC_SCALAR_PARITY_LIB) $(OSC_HDRS) src/omega_api_decl.h + $(CC) $(OSC_CFLAGS) -I$(OSC_DIR) -o $@ $< $(OSC_SCALAR_PARITY_LIB) + +.PHONY: test-osc-scalar-parity +test-osc-scalar-parity: $(OSC_DIR)/test_osc_scalar_parity + @$(OSC_DIR)/test_osc_scalar_parity + $(OSC_DIR)/test_osc_model: tests/compiler/test_osc_model.c $(OSC_MODEL) $(OSC_MODEL_GEN) $(OSC_HDRS) @mkdir -p $(OSC_DIR) $(CC) $(OSC_CFLAGS) -o $@ tests/compiler/test_osc_model.c $(OSC_MODEL) $(OSC_MODEL_GEN) diff --git a/om/compiler/osc_a64_fields.om b/om/compiler/osc_a64_fields.om new file mode 100644 index 000000000..803665dfe --- /dev/null +++ b/om/compiler/osc_a64_fields.om @@ -0,0 +1,276 @@ +note SPDX-License-Identifier: Apache-2.0 +note Encode/decode the variable fields of OSC's supported 64-bit AArch64 forms. +note The opcode table supplies base bits and the class. Register kind, canonical +note operands and range checks precede packing. Negative offsets use low field bits. +note bridge c-type a64field OscA64Fields +note bridge c-define OSC_A64_ERR_UNUSED_SHIFT 1 +note bridge c-define OSC_A64_ERR_UNUSED_COND 2 +note bridge c-define OSC_A64_ERR_UNUSED_IMM2 3 +note bridge c-define OSC_A64_ERR_UNUSED_IMM 4 +note bridge c-define OSC_A64_ERR_SHIFT_KIND 5 +note bridge c-define OSC_A64_ERR_SHIFT_AMOUNT 6 +note bridge c-define OSC_A64_ERR_IMM12 7 +note bridge c-define OSC_A64_ERR_LSL12 8 +note bridge c-define OSC_A64_ERR_IMMR 9 +note bridge c-define OSC_A64_ERR_IMMS 10 +note bridge c-define OSC_A64_ERR_COND 11 +note bridge c-define OSC_A64_ERR_IMM16 12 +note bridge c-define OSC_A64_ERR_MOV_SHIFT 13 +note bridge c-define OSC_A64_ERR_MEM_OFFSET 14 +note bridge c-define OSC_A64_ERR_PAIR_OFFSET 15 +note bridge c-define OSC_A64_ERR_WRITEBACK_ALIAS 16 +note bridge c-define OSC_A64_ERR_LOAD_ALIAS 17 +note bridge c-define OSC_A64_ERR_BRANCH_OFFSET 18 +note bridge c-define OSC_A64_ERR_BRANCH_COND 19 +om2 +layout a64field 40 +field rd uint at 0 little +field rn uint at 4 little +field rm uint at 8 little +field ra uint at 12 little +field shift uint at 16 little +field cond uint at 20 little +field imm long at 24 little +field imm2 long at 32 little +end + +const CLS_NONE ulong 0 +const CLS_RRR_SH ulong 1 +const CLS_RI ulong 2 +const CLS_R4 ulong 3 +const CLS_MULH ulong 4 +const CLS_R3 ulong 5 +const CLS_BFM ulong 6 +const CLS_CSINC ulong 7 +const CLS_MOV16 ulong 8 +const CLS_MEM ulong 9 +const CLS_PAIR ulong 10 +const CLS_B26 ulong 11 +const CLS_BCOND ulong 12 +const CLS_CB ulong 13 +const CLS_BREG ulong 14 +const CLS_BRK ulong 15 + +export fn osc_a64_pack_fields form ulong base ulong f view a64field to ulong +rd = ulong get f rd +rn = shl ulong get f rn 5 +rm = shl ulong get f rm 16 +ra = shl ulong get f ra 10 +imm = bitcast ulong get f imm +second = bitcast ulong get f imm2 +if eq form CLS_RRR_SH + regs = or rd or rn rm + returnbits = or shl ulong get f shift 22 shl imm 10 + ret or base or regs returnbits +end +if eq form CLS_RI + ret or base or or rd rn or shl second 22 shl imm 10 +end +if eq form CLS_R4 + ret or base or or rd rn or rm ra +end +if or eq form CLS_MULH eq form CLS_R3 + ret or base or rd or rn rm +end +if eq form CLS_BFM + ret or base or or rd rn or shl imm 16 shl second 10 +end +if eq form CLS_CSINC + regs = or rd or rn rm + ret or base or regs shl ulong get f cond 12 +end +if eq form CLS_MOV16 + ret or base or rd or shl shr second 4 21 shl imm 5 +end +if eq form CLS_MEM + ret or base or or rd rn shl shr imm 3 10 +end +if eq form CLS_PAIR + offset = shl and shr imm 3 0x7f 15 + ret or base or or rd rn or ra offset +end +if eq form CLS_B26 + ret or base and shr imm 2 0x03ffffff +end +if or eq form CLS_BCOND eq form CLS_CB + offset = shl and shr imm 2 0x7ffff 5 + if eq form CLS_BCOND + ret or base or offset ulong get f cond + end + ret or base or offset rd +end +if eq form CLS_BREG + ret or base rn +end +if eq form CLS_BRK + ret or base shl imm 5 +end +trap 5 +end + +fn a64_scaled_signed fieldbits ulong signbit ulong scale ulong to long +ret bitcast long shl sub xor fieldbits signbit signbit scale +end + +export fn osc_a64_unpack_fields form ulong word ulong f edit a64field to void +put f rd uint and word 31 +put f rn uint and shr word 5 31 +put f rm uint and shr word 16 31 +put f ra uint and shr word 10 31 +put f shift 0 +put f cond 0 +put f imm 0 +put f imm2 0 +if eq form CLS_RRR_SH + put f shift uint and shr word 22 3 + put f imm long and shr word 10 63 +end +if eq form CLS_RI + put f imm long and shr word 10 0xfff + put f imm2 long and shr word 22 1 +end +if eq form CLS_BFM + put f imm long and shr word 16 63 + put f imm2 long and shr word 10 63 +end +if eq form CLS_CSINC + put f cond uint and shr word 12 15 +end +if eq form CLS_MOV16 + put f imm long and shr word 5 0xffff + put f imm2 long shl and shr word 21 3 4 +end +if eq form CLS_MEM + put f imm long shl and shr word 10 0xfff 3 +end +if eq form CLS_PAIR + put f imm a64_scaled_signed and shr word 15 0x7f 0x40 3 +end +if eq form CLS_B26 + put f imm a64_scaled_signed and word 0x03ffffff 0x02000000 2 +end +if or eq form CLS_BCOND eq form CLS_CB + put f imm a64_scaled_signed and shr word 5 0x7ffff 0x40000 2 + if eq form CLS_BCOND + put f cond uint and word 15 + end +end +if eq form CLS_BRK + put f imm long and shr word 5 0xffff +end +end +const ERR_UNUSED_SHIFT ulong 1 +const ERR_UNUSED_COND ulong 2 +const ERR_UNUSED_IMM2 ulong 3 +const ERR_UNUSED_IMM ulong 4 +const ERR_SHIFT_KIND ulong 5 +const ERR_SHIFT_AMOUNT ulong 6 +const ERR_IMM12 ulong 7 +const ERR_LSL12 ulong 8 +const ERR_IMMR ulong 9 +const ERR_IMMS ulong 10 +const ERR_COND ulong 11 +const ERR_IMM16 ulong 12 +const ERR_MOV_SHIFT ulong 13 +const ERR_MEM_OFFSET ulong 14 +const ERR_PAIR_OFFSET ulong 15 +const ERR_WRITEBACK_ALIAS ulong 16 +const ERR_LOAD_ALIAS ulong 17 +const ERR_BRANCH_OFFSET ulong 18 +const ERR_BRANCH_COND ulong 19 + +note Pair flags come from the opcode table. Encoded base register 31 is SP +note for the pair class, so it cannot alias a transfer even when that is XZR. +export fn osc_a64_check_fields cls ulong f view a64field writeback ulong loadpair ulong to ulong +imm = get f imm +second = get f imm2 +if and ne cls CLS_RRR_SH ne get f shift 0 + ret ERR_UNUSED_SHIFT +end +if and ne get f cond 0 and ne cls CLS_CSINC ne cls CLS_BCOND + ret ERR_UNUSED_COND +end +if ne second 0 + if and ne cls CLS_RI and ne cls CLS_BFM ne cls CLS_MOV16 + ret ERR_UNUSED_IMM2 + end +end +if ne imm 0 + if or eq cls CLS_R4 or eq cls CLS_MULH eq cls CLS_R3 + ret ERR_UNUSED_IMM + end + if or eq cls CLS_CSINC eq cls CLS_BREG + ret ERR_UNUSED_IMM + end +end +if eq cls CLS_RRR_SH + if gt get f shift 2 + ret ERR_SHIFT_KIND + end + if or lt imm 0 gt imm 63 + ret ERR_SHIFT_AMOUNT + end +end +if eq cls CLS_RI + if or lt imm 0 gt imm 4095 + ret ERR_IMM12 + end + if and ne second 0 ne second 1 + ret ERR_LSL12 + end +end +if eq cls CLS_BFM + if or lt imm 0 gt imm 63 + ret ERR_IMMR + end + if or lt second 0 gt second 63 + ret ERR_IMMS + end +end +if and eq cls CLS_CSINC gt get f cond 14 + ret ERR_COND +end +if or eq cls CLS_MOV16 eq cls CLS_BRK + if or lt imm 0 gt imm 65535 + ret ERR_IMM16 + end + if eq cls CLS_MOV16 + if or lt second 0 or gt second 48 ne and second 15 0 + ret ERR_MOV_SHIFT + end + end +end +if eq cls CLS_MEM + if or lt imm 0 or gt imm 32760 ne and imm 7 0 + ret ERR_MEM_OFFSET + end +end +if eq cls CLS_PAIR + if or lt imm -512 or gt imm 504 ne and imm 7 0 + ret ERR_PAIR_OFFSET + end + if and ne writeback 0 ne get f rn 31 + base = get f rn + if or eq base get f rd eq base get f ra + ret ERR_WRITEBACK_ALIAS + end + end + if and ne loadpair 0 eq get f rd get f ra + ret ERR_LOAD_ALIAS + end +end +if eq cls CLS_B26 + if or lt imm -134217728 or gt imm 134217724 ne and imm 3 0 + ret ERR_BRANCH_OFFSET + end +end +if or eq cls CLS_BCOND eq cls CLS_CB + if and eq cls CLS_BCOND gt get f cond 13 + ret ERR_BRANCH_COND + end + if or lt imm -1048576 or gt imm 1048572 ne and imm 3 0 + ret ERR_BRANCH_OFFSET + end +end +ret 0 +end diff --git a/om/compiler/osc_expr.om b/om/compiler/osc_expr.om index 68dab071e..d23884489 100644 --- a/om/compiler/osc_expr.om +++ b/om/compiler/osc_expr.om @@ -8,6 +8,23 @@ note bridge c-define OSC_EXPR_DONE 0 note bridge c-define OSC_EXPR_SHIFT 1 note bridge c-define OSC_EXPR_REDUCE 2 note bridge c-define OSC_EXPR_CHAINED 3 +note bridge c-type opstate OscOperandState +note bridge c-define OSC_OPERAND_DONE 0 +note bridge c-define OSC_OPERAND_PREFIX 1 +note bridge c-define OSC_OPERAND_INTEGER 2 +note bridge c-define OSC_OPERAND_TRUE 3 +note bridge c-define OSC_OPERAND_FALSE 4 +note bridge c-define OSC_OPERAND_NAME 5 +note bridge c-define OSC_OPERAND_CALL 6 +note bridge c-define OSC_OPERAND_FIELD 7 +note bridge c-define OSC_OPERAND_INDEX 8 +note bridge c-define OSC_OPERAND_POOL 9 +note bridge c-define OSC_OPERAND_GROUP 10 +note bridge c-define OSC_OPERAND_BORROW_ERROR 11 +note bridge c-define OSC_OPERAND_SYNTAX 12 +note bridge c-define OSC_OPERAND_CAST 13 +note bridge c-define OSC_OPERAND_CAST_ERROR 14 +note bridge c-define OSC_OPERAND_UNWIND 15 om2 layout exprstk 120 @@ -19,6 +36,31 @@ field parent int at 112 little field left int at 116 little end +note Prefix nodes are consecutive until the primary begins. Unwind links them +note only after a successful primary and cast, preserving partial ASTs on errors. +layout opstate 12 +field phase uint at 0 little +field prefixes uint at 4 little +field pending uint at 8 little +end + +const OP_DONE ulong 0 +const OP_PREFIX ulong 1 +const OP_INTEGER ulong 2 +const OP_TRUE ulong 3 +const OP_FALSE ulong 4 +const OP_NAME ulong 5 +const OP_CALL ulong 6 +const OP_FIELD ulong 7 +const OP_INDEX ulong 8 +const OP_POOL ulong 9 +const OP_GROUP ulong 10 +const OP_BORROW_ERROR ulong 11 +const OP_SYNTAX ulong 12 +const OP_CAST ulong 13 +const OP_CAST_ERROR ulong 14 +const OP_UNWIND ulong 15 + const OT_PLUS uint 42 const OT_MINUS uint 43 const OT_STAR uint 44 @@ -94,3 +136,75 @@ put stack lhs ulong depth int operand put stack depth add depth 1 ret EXPR_SHIFT end +const OT_LPAREN uint 30 +const OT_LBRACK uint 34 +const OT_DOT uint 63 +const OT_ALLOC uint 8 +const OT_AS uint 18 +const OT_INT uint 2 +const OT_NAME uint 1 +const OT_TRUE uint 19 +const OT_FALSE uint 20 +const OT_BANG uint 51 +const OT_TILDE uint 50 + +note phase 0 scans prefixes and selects the primary, phase 1 permits one cast, +note phase 2 refuses a second cast, phase 3 attaches the pending prefix nodes. +export fn osc_operand_step state edit opstate kind ulong nextkind ulong third ulong to ulong +phase = get state phase +if eq phase 0 + if or eq uint kind OT_MINUS or eq uint kind OT_TILDE eq uint kind OT_BANG + put state prefixes add get state prefixes 1 + ret OP_PREFIX + end + put state phase 1 + if eq uint kind OT_INT + ret OP_INTEGER + end + if eq uint kind OT_TRUE + ret OP_TRUE + end + if eq uint kind OT_FALSE + ret OP_FALSE + end + if eq uint kind OT_NAME + if eq uint nextkind OT_LPAREN + ret OP_CALL + end + if eq uint nextkind OT_LBRACK + ret OP_INDEX + end + if eq uint nextkind OT_DOT + if eq uint third OT_ALLOC + ret OP_POOL + end + ret OP_FIELD + end + ret OP_NAME + end + if eq uint kind OT_LPAREN + ret OP_GROUP + end + if eq uint kind OT_AMP + ret OP_BORROW_ERROR + end + ret OP_SYNTAX +end +if eq uint kind OT_AS + if eq phase 1 + put state phase 2 + ret OP_CAST + end + if eq phase 2 + ret OP_CAST_ERROR + end +end +put state phase 3 +count = get state prefixes +if ne count 0 + put state pending sub count 1 + put state prefixes sub count 1 + ret OP_UNWIND +end +ret OP_DONE +end diff --git a/om/compiler/osc_scalar.om b/om/compiler/osc_scalar.om new file mode 100644 index 000000000..1ae2613b6 --- /dev/null +++ b/om/compiler/osc_scalar.om @@ -0,0 +1,313 @@ +note SPDX-License-Identifier: Apache-2.0 +note Scalar semantics of validated OSC IR. Checked operations return the OSC +note trap code as data. The host delivers that trap through the program runtime. +om2 + +note IDs from osc_ir.h. Operands enter in their canonical 64-bit representation. +const T_BOOL ulong 1 +const T_U8 ulong 2 +const T_U64 ulong 5 +const T_I8 ulong 6 +const T_I64 ulong 9 +const SIGN64 ulong 0x8000000000000000 +const OVERFLOW ulong 1 +const DIV_ZERO ulong 2 +const CAST_RANGE ulong 5 +const BAD_SHIFT ulong 7 +const BAD_OPCODE ulong 8 + +fn alu_signed t ulong to bool +ret and ge t T_I8 le t T_I64 +end + +export fn osc_alu_width t ulong to ulong +if eq t T_BOOL + ret 1 +end +if and ge t T_U8 le t T_U64 + ret shl ulong 8 sub t T_U8 +end +if alu_signed t + ret shl ulong 8 sub t T_I8 +end +ret 0 +end + +fn alu_mask width ulong to ulong +if eq width 64 + ret 0xffffffffffffffff +end +ret sub shl ulong 1 width 1 +end + +export fn osc_alu_canon t ulong v ulong to ulong +w = osc_alu_width t +v = and v alu_mask w +if alu_signed t + sign = shl ulong 1 sub w 1 + v = sub xor v sign sign +end +ret v +end + +fn alu_mag v ulong to ulong +if ge v SIGN64 + ret sub ulong 0 v +end +ret v +end + +fn alu_limit width ulong negative bool to ulong +top = shl ulong 1 sub width 1 +if negative + ret top +end +ret sub top 1 +end + +fn alu_addsub op ulong t ulong a ulong b ulong value edit ulong 1 to ulong +w = osc_alu_width t +signedop = alu_signed t +r = add a b +if eq op 2 + r = sub a b +end +if signedop + sign = shl ulong 1 sub w 1 + changed = and xor r a sign + diff = and xor a b sign + if ne changed 0 + if eq eq op 1 eq diff 0 + ret OVERFLOW + end + end +end +put value 0 osc_alu_canon t r +ret 0 +end + +fn alu_mul t ulong a ulong b ulong value edit ulong 1 to ulong +w = osc_alu_width t +signedop = alu_signed t +if signedop + limit = alu_limit w ge xor a b SIGN64 + bm = alu_mag b + if ne bm 0 + if gt alu_mag a div limit bm + ret OVERFLOW + end + end +end +put value 0 osc_alu_canon t mul a b +ret 0 +end + +fn alu_divrem op ulong t ulong a ulong b ulong value edit ulong 1 to ulong +w = osc_alu_width t +signedop = alu_signed t +if eq b 0 + ret DIV_ZERO +end +am = a +bm = b +if signedop + am = alu_mag a + bm = alu_mag b +end +if eq op 4 + r = div am bm + if signedop + negative = ge xor a b SIGN64 + if gt r alu_limit w negative + ret OVERFLOW + end + if negative + r = sub ulong 0 r + end + end + put value 0 r +else + r = rem am bm + if and signedop ge a SIGN64 + r = sub ulong 0 r + end + put value 0 r +end +ret 0 +end + +fn alu_shift op ulong t ulong a ulong b ulong value edit ulong 1 to ulong +w = osc_alu_width t +signedop = alu_signed t +note A negative canonical count is unsigned-greater than every valid width. +if ge b w + ret BAD_SHIFT +end +if eq op 9 + if signedop + limit = alu_limit w ge a SIGN64 + if gt alu_mag a shr limit b + ret OVERFLOW + end + end + put value 0 osc_alu_canon t shl a b +else + r = shr a b + if and signedop ge a SIGN64 + r = not shr not a b + end + put value 0 r +end +ret 0 +end + +export fn osc_alu_bin op ulong t ulong a ulong b ulong value out ulong 1 to ulong +put value 0 0 +if eq osc_alu_width t 0 + ret BAD_OPCODE +end +if or eq op 1 eq op 2 + ret alu_addsub op t a b value +end +if eq op 3 + ret alu_mul t a b value +end +if or eq op 4 eq op 5 + ret alu_divrem op t a b value +end +if eq op 6 + put value 0 and a b + ret 0 +end +if eq op 7 + put value 0 or a b + ret 0 +end +if eq op 8 + put value 0 xor a b + ret 0 +end +if or eq op 9 eq op 10 + ret alu_shift op t a b value +end +ret BAD_OPCODE +end + +export fn osc_alu_un op ulong t ulong a ulong value out ulong 1 to ulong +put value 0 0 +if eq op 1 + if alu_signed t + if ge a SIGN64 + if gt alu_mag a alu_limit osc_alu_width t false + ret OVERFLOW + end + end + end + put value 0 osc_alu_canon t sub ulong 0 a + ret 0 +end +if eq op 2 + put value 0 osc_alu_canon t not a + ret 0 +end +if eq op 3 + put value 0 xor a 1 + ret 0 +end +ret BAD_OPCODE +end + +fn alu_truth flag bool to ulong +if flag + ret 1 +end +ret 0 +end + +export fn osc_alu_cmp cc ulong t ulong a ulong b ulong to ulong +if alu_signed t + a = xor a SIGN64 + b = xor b SIGN64 +end +if eq cc 1 + ret alu_truth eq a b +end +if eq cc 2 + ret alu_truth ne a b +end +if eq cc 3 + ret alu_truth lt a b +end +if eq cc 4 + ret alu_truth le a b +end +if eq cc 5 + ret alu_truth gt a b +end +if eq cc 6 + ret alu_truth ge a b +end +ret 0 +end + +export fn osc_alu_cast target ulong src ulong a ulong value out ulong 1 to ulong +put value 0 0 +negative = and alu_signed src ge a SIGN64 +width = osc_alu_width target +if alu_signed target + magnitude = a + if negative + magnitude = alu_mag a + end + if gt magnitude alu_limit width negative + ret CAST_RANGE + end +else + if or negative gt a alu_mask width + ret CAST_RANGE + end +end +put value 0 a +ret 0 +end + +note OSC surface token numbers from osc_lex.h and scalar sub-opcodes from osc_ir.h. +const TOK_PLUS ulong 42 +const TOK_XOR ulong 49 +const TOK_SHL ulong 54 +const TOK_SHR ulong 55 +const TOK_EQ ulong 56 +const TOK_GE ulong 61 + +export fn osc_binary_opcode tok ulong to ulong +if and ge tok TOK_PLUS le tok TOK_XOR + ret add sub tok TOK_PLUS 1 +end +if eq tok TOK_SHL + ret 9 +end +if eq tok TOK_SHR + ret 10 +end +ret 0 +end + +export fn osc_compare_opcode tok ulong to ulong +if and ge tok TOK_EQ le tok TOK_GE + ret add sub tok TOK_EQ 1 +end +ret 0 +end + +note The minus of a literal may denote the signed minimum directly, even +note though its positive magnitude cannot stand alone as that signed type. +export fn osc_literal_fits t ulong magnitude ulong negative ulong to ulong +w = osc_alu_width t +if alu_signed t + ret alu_truth le magnitude alu_limit w ne negative 0 +end +if ne negative 0 + ret alu_truth eq magnitude 0 +end +ret alu_truth le magnitude alu_mask w +end diff --git a/om/units.sh b/om/units.sh index 086796ed8..4d2f7e36c 100755 --- a/om/units.sh +++ b/om/units.sh @@ -28,7 +28,7 @@ NATIVE_PIN=2c1bf63798336e899704217d98f909b31e567289650751a55d83255c7eb8f27d ROOT=$(cd "$(dirname "$0")/.." && pwd) # One generated library for all units: the bindings share one ABI runtime (ombr_enter). # om/encoder/bw_enc_sm121.om: the sm_121 instruction encoder, twin of aien-dev/CUDApp's (mk/om-encoder.mk). -UNITS="${OMEGA_UNITS:-om/sha256/sha256-om2.om om/blake3/b3unit.om om/encoder/bw_enc_sm121.om om/gpu/bw_qmd.om om/gpu/bw_sched.om om/gpu/q38_plan.om om/gpu/cg_pf.om om/gpu/cg_bf16.om om/gpu/cg_gemm.om om/gpu/cg_moe2.om om/gpu/cg_moe.om om/gpu/cg_qmma.om om/gpu/cg_pfhost.om om/gpu/cg_gpu_attn.om om/runtime/rx_regulate.om om/runtime/rx_mid.om om/runtime/rx_cortex_rec.om om/runtime/rx_plan_core.om om/runtime/rx_projection.om om/runtime/rx_capq_core.om om/runtime/rx_costmodel_core.om om/runtime/rx_route_core.om om/runtime/rx_world_core.om om/runtime/rx_skillroute_core.om om/runtime/rx_fusion_core.om om/compiler/osc_literal.om om/compiler/osc_type.om om/compiler/osc_expr.om}" +UNITS="${OMEGA_UNITS:-om/sha256/sha256-om2.om om/blake3/b3unit.om om/encoder/bw_enc_sm121.om om/gpu/bw_qmd.om om/gpu/bw_sched.om om/gpu/q38_plan.om om/gpu/cg_pf.om om/gpu/cg_bf16.om om/gpu/cg_gemm.om om/gpu/cg_moe2.om om/gpu/cg_moe.om om/gpu/cg_qmma.om om/gpu/cg_pfhost.om om/gpu/cg_gpu_attn.om om/runtime/rx_regulate.om om/runtime/rx_mid.om om/runtime/rx_cortex_rec.om om/runtime/rx_plan_core.om om/runtime/rx_projection.om om/runtime/rx_capq_core.om om/runtime/rx_costmodel_core.om om/runtime/rx_route_core.om om/runtime/rx_world_core.om om/runtime/rx_skillroute_core.om om/runtime/rx_fusion_core.om om/compiler/osc_literal.om om/compiler/osc_type.om om/compiler/osc_expr.om om/compiler/osc_scalar.om om/compiler/osc_a64_fields.om}" # The units the freestanding GPU link needs (the encoder, codegen, matmul and realize files hash with sha256_*; qmd packs QMDs). FS_UNITS="om/sha256/sha256-om2.om om/gpu/bw_qmd.om om/gpu/cg_gpu_attn.om" DEST="${OMEGA_UNITS_DEST:-$ROOT/src}" diff --git a/src/compiler/osc_a64.c b/src/compiler/osc_a64.c index 8cb76f809..979836b95 100644 --- a/src/compiler/osc_a64.c +++ b/src/compiler/osc_a64.c @@ -21,6 +21,7 @@ * range-checked and an out-of-range or wrong-kind operand is refused. */ #include "osc_a64.h" +#include "omega_api_decl.h" #include #include @@ -137,8 +138,6 @@ static int unreg(int kind, uint32_t f) { return 255; /* not encodable: re-encode check refuses */ } -static int is_sp(int r) { return r == OSC_A64_SP; } - int osc_a64_encode(const OscA64Insn *in, uint32_t *word, char *err, size_t n) { if (!in || !word) return fail(err, n, "null"); int op = in->op; @@ -146,7 +145,7 @@ int osc_a64_encode(const OscA64Insn *in, uint32_t *word, char *err, size_t n) { return fail(err, n, "unknown op %d", op); const OpInfo *oi = &OPS[op]; const char *nm = oi->name; - uint32_t w = oi->base, rd = 0, rn = 0, rm = 0, ra = 0; + uint32_t rd = 0, rn = 0, rm = 0, ra = 0; /* unused register / field positions must be zero (canonical form) */ if (oi->kd == K_NONE && in->rd) return fail(err, n, "%s: rd unused but set", nm); if (oi->kn == K_NONE && in->rn) return fail(err, n, "%s: rn unused but set", nm); @@ -156,95 +155,53 @@ int osc_a64_encode(const OscA64Insn *in, uint32_t *word, char *err, size_t n) { if (oi->kn != K_NONE && regfield(oi->kn, in->rn, &rn, "rn", nm, err, n)) return -1; if (oi->km != K_NONE && regfield(oi->km, in->rm, &rm, "rm", nm, err, n)) return -1; if (oi->ka != K_NONE && regfield(oi->ka, in->ra, &ra, "ra", nm, err, n)) return -1; - int uses_shift = oi->cls == CLS_RRR_SH; - int uses_cond = oi->cls == CLS_CSINC || oi->cls == CLS_BCOND; - int uses_imm2 = oi->cls == CLS_RI || oi->cls == CLS_BFM || oi->cls == CLS_MOV16; - int uses_imm = !(oi->cls == CLS_R4 || oi->cls == CLS_MULH || oi->cls == CLS_R3 || - oi->cls == CLS_CSINC || oi->cls == CLS_BREG); - if (!uses_shift && in->shift) return fail(err, n, "%s: shift unused but set", nm); - if (!uses_cond && in->cond) return fail(err, n, "%s: cond unused but set", nm); - if (!uses_imm2 && in->imm2) return fail(err, n, "%s: imm2 unused but set", nm); - if (!uses_imm && in->imm) return fail(err, n, "%s: imm unused but set", nm); - int64_t imm = in->imm, imm2 = in->imm2; - - switch (oi->cls) { - case CLS_RRR_SH: - if (in->shift > OSC_A64_ASR) return fail(err, n, "%s: shift type %u refused", nm, in->shift); - if (imm < 0 || imm > 63) return fail(err, n, "%s: shift amount %lld out of range", nm, (long long)imm); - w |= ((uint32_t)in->shift << 22) | (rm << 16) | ((uint32_t)imm << 10) | (rn << 5) | rd; - break; - case CLS_RI: - if (imm < 0 || imm > 4095) return fail(err, n, "%s: imm12 %lld out of range", nm, (long long)imm); - if (imm2 != 0 && imm2 != 1) return fail(err, n, "%s: lsl12 flag %lld invalid", nm, (long long)imm2); - w |= ((uint32_t)imm2 << 22) | ((uint32_t)imm << 10) | (rn << 5) | rd; - break; - case CLS_R4: - w |= (rm << 16) | (ra << 10) | (rn << 5) | rd; - break; - case CLS_MULH: - case CLS_R3: - w |= (rm << 16) | (rn << 5) | rd; - break; - case CLS_BFM: - if (imm < 0 || imm > 63) return fail(err, n, "%s: immr %lld out of range", nm, (long long)imm); - if (imm2 < 0 || imm2 > 63) return fail(err, n, "%s: imms %lld out of range", nm, (long long)imm2); - w |= ((uint32_t)imm << 16) | ((uint32_t)imm2 << 10) | (rn << 5) | rd; - break; - case CLS_CSINC: - if (in->cond > OSC_A64_AL) return fail(err, n, "%s: cond %u refused", nm, in->cond); - w |= (rm << 16) | ((uint32_t)in->cond << 12) | (rn << 5) | rd; - break; - case CLS_MOV16: - if (imm < 0 || imm > 0xFFFF) return fail(err, n, "%s: imm16 %lld out of range", nm, (long long)imm); - if (imm2 != 0 && imm2 != 16 && imm2 != 32 && imm2 != 48) - return fail(err, n, "%s: shift %lld invalid", nm, (long long)imm2); - w |= ((uint32_t)(imm2 / 16) << 21) | ((uint32_t)imm << 5) | rd; - break; - case CLS_MEM: - if (imm < 0 || imm > 4095 * 8 || (imm & 7)) - return fail(err, n, "%s: offset %lld not a multiple of 8 in 0..32760", nm, (long long)imm); - w |= ((uint32_t)(imm / 8) << 10) | (rn << 5) | rd; - break; - case CLS_PAIR: { - if (imm < -512 || imm > 504 || (imm & 7)) - return fail(err, n, "%s: offset %lld not a multiple of 8 in -512..504", nm, (long long)imm); - int wb = op == OSC_A64_STP_PRE || op == OSC_A64_STP_POST || op == OSC_A64_LDP_PRE || op == OSC_A64_LDP_POST; - int load = op == OSC_A64_LDP_OFF || op == OSC_A64_LDP_PRE || op == OSC_A64_LDP_POST; - if (wb && !is_sp(in->rn) && (in->rn == in->rd || in->rn == in->ra)) - return fail(err, n, "%s: writeback base equals a transfer register (unpredictable)", nm); - if (load && in->rd == in->ra) - return fail(err, n, "%s: Rt == Rt2 (unpredictable)", nm); - uint32_t i7 = (uint32_t)((imm / 8) & 0x7F); - w |= (i7 << 15) | (ra << 10) | (rn << 5) | rd; - break; - } - case CLS_B26: - if ((imm & 3) || imm < -(1LL << 27) || imm > (1LL << 27) - 4) - return fail(err, n, "%s: offset %lld out of range or misaligned", nm, (long long)imm); - w |= (uint32_t)((imm / 4) & 0x03FFFFFF); - break; - case CLS_BCOND: - if (in->cond > 13) return fail(err, n, "%s: cond %u refused (AL/NV not used)", nm, in->cond); - if ((imm & 3) || imm < -(1LL << 20) || imm > (1LL << 20) - 4) - return fail(err, n, "%s: offset %lld out of range or misaligned", nm, (long long)imm); - w |= ((uint32_t)((imm / 4) & 0x7FFFF) << 5) | in->cond; - break; - case CLS_CB: - if ((imm & 3) || imm < -(1LL << 20) || imm > (1LL << 20) - 4) - return fail(err, n, "%s: offset %lld out of range or misaligned", nm, (long long)imm); - w |= ((uint32_t)((imm / 4) & 0x7FFFF) << 5) | rd; - break; - case CLS_BREG: - w |= rn << 5; - break; - case CLS_BRK: - if (imm < 0 || imm > 0xFFFF) return fail(err, n, "%s: imm16 %lld out of range", nm, (long long)imm); - w |= (uint32_t)imm << 5; - break; - default: - return fail(err, n, "bad class"); + const OscA64Fields f = {.rd = rd, .rn = rn, .rm = rm, .ra = ra, .shift = in->shift, + .cond = in->cond, .imm = in->imm, .imm2 = in->imm2}; + int writeback = op == OSC_A64_STP_PRE || op == OSC_A64_STP_POST || op == OSC_A64_LDP_PRE || op == OSC_A64_LDP_POST; + int loadpair = op == OSC_A64_LDP_OFF || op == OSC_A64_LDP_PRE || op == OSC_A64_LDP_POST; + switch (osc_a64_check_fields(oi->cls, &f, writeback, loadpair)) { + case 0: break; + case OSC_A64_ERR_UNUSED_SHIFT: + return fail(err, n, "%s: shift unused but set", nm); + case OSC_A64_ERR_UNUSED_COND: + return fail(err, n, "%s: cond unused but set", nm); + case OSC_A64_ERR_UNUSED_IMM2: + return fail(err, n, "%s: imm2 unused but set", nm); + case OSC_A64_ERR_UNUSED_IMM: + return fail(err, n, "%s: imm unused but set", nm); + case OSC_A64_ERR_SHIFT_KIND: + return fail(err, n, "%s: shift type %u refused", nm, in->shift); + case OSC_A64_ERR_SHIFT_AMOUNT: + return fail(err, n, "%s: shift amount %lld out of range", nm, (long long)in->imm); + case OSC_A64_ERR_IMM12: + return fail(err, n, "%s: imm12 %lld out of range", nm, (long long)in->imm); + case OSC_A64_ERR_LSL12: + return fail(err, n, "%s: lsl12 flag %lld invalid", nm, (long long)in->imm2); + case OSC_A64_ERR_IMMR: + return fail(err, n, "%s: immr %lld out of range", nm, (long long)in->imm); + case OSC_A64_ERR_IMMS: + return fail(err, n, "%s: imms %lld out of range", nm, (long long)in->imm2); + case OSC_A64_ERR_COND: + return fail(err, n, "%s: cond %u refused", nm, in->cond); + case OSC_A64_ERR_IMM16: + return fail(err, n, "%s: imm16 %lld out of range", nm, (long long)in->imm); + case OSC_A64_ERR_MOV_SHIFT: + return fail(err, n, "%s: shift %lld invalid", nm, (long long)in->imm2); + case OSC_A64_ERR_MEM_OFFSET: + return fail(err, n, "%s: offset %lld not a multiple of 8 in 0..32760", nm, (long long)in->imm); + case OSC_A64_ERR_PAIR_OFFSET: + return fail(err, n, "%s: offset %lld not a multiple of 8 in -512..504", nm, (long long)in->imm); + case OSC_A64_ERR_WRITEBACK_ALIAS: + return fail(err, n, "%s: writeback base equals a transfer register (unpredictable)", nm); + case OSC_A64_ERR_LOAD_ALIAS: + return fail(err, n, "%s: Rt == Rt2 (unpredictable)", nm); + case OSC_A64_ERR_BRANCH_OFFSET: + return fail(err, n, "%s: offset %lld out of range or misaligned", nm, (long long)in->imm); + case OSC_A64_ERR_BRANCH_COND: + return fail(err, n, "%s: cond %u refused (AL/NV not used)", nm, in->cond); + default: return fail(err, n, "bad class"); } - *word = w; + *word = (uint32_t)osc_a64_pack_fields(oi->cls, oi->base, &f); return 0; } @@ -252,11 +209,6 @@ int osc_a64_reencode(const OscA64Insn *in, uint32_t *word) { return osc_a64_encode(in, word, NULL, 0); } -static int64_t sext(uint32_t v, unsigned bits) { - uint64_t m = 1ULL << (bits - 1); - return (int64_t)(((uint64_t)v ^ m) - m); -} - int osc_a64_decode(uint32_t w, OscA64Insn *out) { for (int op = 1; op < OSC_A64_NOPS; op++) { const OpInfo *oi = &OPS[op]; @@ -265,25 +217,16 @@ int osc_a64_decode(uint32_t w, OscA64Insn *out) { OscA64Insn d; memset(&d, 0, sizeof d); d.op = (uint8_t)op; - uint32_t f_rd = w & 31, f_rn = (w >> 5) & 31, f_rm = (w >> 16) & 31, f_ra = (w >> 10) & 31; - if (oi->kd != K_NONE) d.rd = (uint8_t)unreg(oi->kd, f_rd); - if (oi->kn != K_NONE) d.rn = (uint8_t)unreg(oi->kn, f_rn); - if (oi->km != K_NONE) d.rm = (uint8_t)unreg(oi->km, f_rm); - if (oi->ka != K_NONE) d.ra = (uint8_t)unreg(oi->ka, f_ra); - switch (oi->cls) { - case CLS_RRR_SH: d.shift = (uint8_t)((w >> 22) & 3); d.imm = (w >> 10) & 63; break; - case CLS_RI: d.imm = (w >> 10) & 0xFFF; d.imm2 = (w >> 22) & 1; break; - case CLS_BFM: d.imm = (w >> 16) & 63; d.imm2 = (w >> 10) & 63; break; - case CLS_CSINC: d.cond = (uint8_t)((w >> 12) & 15); break; - case CLS_MOV16: d.imm = (w >> 5) & 0xFFFF; d.imm2 = ((w >> 21) & 3) * 16; break; - case CLS_MEM: d.imm = (int64_t)((w >> 10) & 0xFFF) * 8; break; - case CLS_PAIR: d.imm = sext((w >> 15) & 0x7F, 7) * 8; break; - case CLS_B26: d.imm = sext(w & 0x03FFFFFF, 26) * 4; break; - case CLS_BCOND: d.imm = sext((w >> 5) & 0x7FFFF, 19) * 4; d.cond = (uint8_t)(w & 15); break; - case CLS_CB: d.imm = sext((w >> 5) & 0x7FFFF, 19) * 4; break; - case CLS_BRK: d.imm = (w >> 5) & 0xFFFF; break; - default: break; - } + OscA64Fields f; + osc_a64_unpack_fields(oi->cls, w, &f); + if (oi->kd != K_NONE) d.rd = (uint8_t)unreg(oi->kd, f.rd); + if (oi->kn != K_NONE) d.rn = (uint8_t)unreg(oi->kn, f.rn); + if (oi->km != K_NONE) d.rm = (uint8_t)unreg(oi->km, f.rm); + if (oi->ka != K_NONE) d.ra = (uint8_t)unreg(oi->ka, f.ra); + d.shift = (uint8_t)f.shift; + d.cond = (uint8_t)f.cond; + d.imm = f.imm; + d.imm2 = f.imm2; uint32_t re; if (osc_a64_encode(&d, &re, NULL, 0) != 0 || re != w) continue; if (out) *out = d; diff --git a/src/compiler/osc_check.c b/src/compiler/osc_check.c index 3e33434a6..3fd2cf488 100644 --- a/src/compiler/osc_check.c +++ b/src/compiler/osc_check.c @@ -22,6 +22,7 @@ */ #include "osc_alloc.h" #include "osc_check.h" +#include "omega_api_decl.h" #include #include @@ -575,30 +576,6 @@ static void snap_restore(C *c, const Snap *s) } /* ------------------------------------------------------------ integer helpers */ -typedef __int128 i128; - -static int fits(OscScalar t, i128 v) -{ - unsigned w = osc_scalar_width(t); - if (osc_scalar_signed(t)) { - i128 lo = -((i128)1 << (w - 1)), hi = ((i128)1 << (w - 1)) - 1; - return v >= lo && v <= hi; - } - return v >= 0 && v <= (((i128)1 << w) - 1); -} -static i128 wrapu(OscScalar t, i128 v) -{ - unsigned w = osc_scalar_width(t); - unsigned __int128 m = (((unsigned __int128)1) << w) - 1; - return (i128)((unsigned __int128)v & m); -} -static uint64_t canon(OscScalar t, i128 v) -{ - if (t == OSC_T_BOOL) return v ? 1 : 0; - if (osc_scalar_signed(t)) return (uint64_t)(int64_t)v; - return (uint64_t)wrapu(t, v); -} - static int is_shift(int op) { return op == OT_SHL || op == OT_SHR; } static int is_arith(int op) { @@ -639,107 +616,76 @@ static int ovf(C *c, const OscNode *n, const char *transition, const char *msg) return -1; } -/* fold constant expression i at type t; value as mathematical integer in range of t */ -static int fold(C *c, int i, OscScalar t, i128 *out) +/* Fold using the same OSC scalar semantics as the reference interpreter. + * Constant negation of a nonzero unsigned value is refused by the front end. */ +static int fold(C *c, int i, OscScalar t, uint64_t *out) { OscNode *n = NODE(i); char msg[320]; if (t == OSC_T_BOOL) return tmismatch(c, n, "bool", "integer literal where bool is required"); - int sg = osc_scalar_signed(t); - unsigned w = osc_scalar_width(t); - i128 v, a, b; + uint64_t v, a, b; switch (n->kind) { case ON_INT: - v = (i128)n->ival; - if (!fits(t, v)) { + v = n->ival; + if (!osc_literal_fits(t, v, 0)) { snprintf(msg, sizeof msg, "literal %llu does not fit %s", (unsigned long long)n->ival, tname(t)); return ovf(c, n, "literal does not fit type", msg); } break; case ON_UN: if (n->op == OT_MINUS && NODE(n->a)->kind == ON_INT) { - const OscNode *l = NODE(n->a); - v = -(i128)l->ival; - if (!sg && l->ival != 0) { + OscNode *l = NODE(n->a); + if (!osc_scalar_signed(t) && l->ival) { snprintf(msg, sizeof msg, "negative literal -%llu for unsigned %s", (unsigned long long)l->ival, tname(t)); return ovf(c, n, "negative literal for unsigned type", msg); } - if (!fits(t, v)) { + if (!osc_literal_fits(t, l->ival, 1)) { snprintf(msg, sizeof msg, "literal -%llu does not fit %s", (unsigned long long)l->ival, tname(t)); return ovf(c, n, "literal does not fit type", msg); } - NODE(n->a)->ty.s = t; - NODE(n->a)->is_const = 1; - NODE(n->a)->cval = canon(t, (i128)l->ival); + l->ty.s = t; + l->is_const = 1; + l->cval = l->ival; + v = 0 - l->ival; break; } if (fold(c, n->a, t, &a)) return -1; - if (n->op == OT_MINUS) { - if (!sg) { - if (a != 0) return ovf(c, n, "negative constant for unsigned type", "negation of a non-zero unsigned constant"); - v = 0; - } else { - v = -a; - if (!fits(t, v)) return ovf(c, n, "signed constant overflow", "constant negation overflows"); - } - } else { /* ~ */ - v = sg ? (i128)(~(int64_t)a) : wrapu(t, ~a); - } + if (n->op == OT_MINUS && !osc_scalar_signed(t) && a) + return ovf(c, n, "negative constant for unsigned type", "negation of a non-zero unsigned constant"); + if (osc_alu_un(n->op == OT_MINUS ? OSC_U_NEG : OSC_U_BNOT, t, a, &v)) + return ovf(c, n, "signed constant overflow", "constant negation overflows"); break; - case ON_BIN: + case ON_BIN: { if (fold(c, n->a, t, &a) || fold(c, n->b, t, &b)) return -1; - switch (n->op) { - case OT_PLUS: v = a + b; break; - case OT_MINUS: v = a - b; break; - case OT_STAR: - if (sg) v = a * b; - else v = (i128)(((unsigned __int128)a * (unsigned __int128)b) & ((((unsigned __int128)1) << w) - 1)); - break; - case OT_SLASH: case OT_PERCENT: - if (b == 0) return ovf(c, NODE(n->b), "literal zero divisor", "division by a constant zero"); - v = n->op == OT_SLASH ? a / b : a % b; - break; - case OT_AMP: v = sg ? (i128)((int64_t)a & (int64_t)b) : (a & b); break; - case OT_PIPE: v = sg ? (i128)((int64_t)a | (int64_t)b) : (a | b); break; - case OT_CARET: v = sg ? (i128)((int64_t)a ^ (int64_t)b) : (a ^ b); break; - case OT_SHL: case OT_SHR: - if (b < 0 || b >= (i128)w) { - snprintf(msg, sizeof msg, "constant shift amount %lld outside 0..%u", (long long)b, w - 1); - return ovf(c, NODE(n->b), "literal shift >= width", msg); - } - if (n->op == OT_SHL) { - if (sg) { - v = a * ((i128)1 << (int)b); - if (!fits(t, v)) return ovf(c, n, "signed constant overflow", "constant left shift overflows"); - } else { - v = wrapu(t, a << (int)b); - } - } else { - v = sg ? (a >> (int)b) : (a >> (int)b); - } - break; - default: return tmismatch(c, n, NULL, "operator not allowed in a constant"); - } - if (sg) { - if (!fits(t, v)) { - snprintf(msg, sizeof msg, "constant expression overflows %s", tname(t)); - return ovf(c, n, "signed constant overflow", msg); - } - } else { - v = wrapu(t, v); + uint64_t code = osc_alu_bin(osc_binary_opcode(n->op), t, a, b, &v); + switch (code) { + case OSC_TRAP_NONE: break; + case OSC_TRAP_DIV0: + return ovf(c, NODE(n->b), "literal zero divisor", "division by a constant zero"); + case OSC_TRAP_SHIFT: + snprintf(msg, sizeof msg, "constant shift amount %lld outside 0..%u", + (long long)b, osc_scalar_width(t) - 1); + return ovf(c, NODE(n->b), "literal shift >= width", msg); + case OSC_TRAP_OVERFLOW: + if (n->op == OT_SHL) + return ovf(c, n, "signed constant overflow", "constant left shift overflows"); + snprintf(msg, sizeof msg, "constant expression overflows %s", tname(t)); + return ovf(c, n, "signed constant overflow", msg); + default: + return tmismatch(c, n, NULL, "operator not allowed in a constant"); } break; + } default: return tmismatch(c, n, NULL, "not a constant"); } n->ty.s = t; n->is_const = 1; - n->cval = canon(t, v); + n->cval = v; *out = v; return 0; } - /* ------------------------------------------------------------ contracts (OSC-2) */ /* Static evaluation of a checked contract clause (docs/osc/OSC-2-DESIGN.md * section 1.4). Constant folding only: a leaf is known if it is a literal / @@ -758,20 +704,6 @@ typedef struct { uint64_t res_val; } CEnv; -static uint64_t ccanon(OscScalar t, uint64_t x) -{ - unsigned w = osc_scalar_width(t); - if (t == OSC_T_BOOL) return x & 1; - if (w >= 64) return x; - if (osc_scalar_signed(t)) { - uint64_t m = 1ULL << (w - 1); - x &= (1ULL << w) - 1; - return (x ^ m) - m; - } - return x & ((1ULL << w) - 1); -} -static int sfits(unsigned w, i128 r) { return r >= -((i128)1 << (w - 1)) && r <= ((i128)1 << (w - 1)) - 1; } - /* 1 known (*out canonical for the node's type), 0 unknown */ static int ceval(C *c, int i, const CEnv *env, uint64_t *out) { @@ -786,29 +718,12 @@ static int ceval(C *c, int i, const CEnv *env, uint64_t *out) return 0; case ON_UN: { if (!ceval(c, n->a, env, &a)) return 0; - OscScalar t = n->ty.s; - if (n->op == OT_BANG) { *out = a ^ 1; return 1; } - if (n->op == OT_TILDE) { *out = ccanon(t, ~a); return 1; } - if (osc_scalar_signed(t)) { - i128 r = -(i128)(int64_t)a; - if (!sfits(osc_scalar_width(t), r)) return 0; - *out = (uint64_t)(int64_t)r; - return 1; - } - *out = ccanon(t, 0 - a); - return 1; + OscUnOp op = n->op == OT_BANG ? OSC_U_LNOT : n->op == OT_TILDE ? OSC_U_BNOT : OSC_U_NEG; + return osc_alu_un(op, n->ty.s, a, out) == OSC_TRAP_NONE; } - case ON_CAST: { + case ON_CAST: if (!ceval(c, n->a, env, &a)) return 0; - OscScalar from = NODE(n->a)->ty.s, to = n->ty.s; - i128 v = osc_scalar_signed(from) ? (i128)(int64_t)a : (i128)a; - unsigned w = osc_scalar_width(to); - i128 lo = osc_scalar_signed(to) ? -((i128)1 << (w - 1)) : 0; - i128 hi = osc_scalar_signed(to) ? ((i128)1 << (w - 1)) - 1 : (((i128)1 << w) - 1); - if (v < lo || v > hi) return 0; - *out = (uint64_t)v; - return 1; - } + return osc_alu_cast(n->ty.s, NODE(n->a)->ty.s, a, out) == OSC_TRAP_NONE; case ON_BIN: { int op = n->op; if (op == OT_ANDAND || op == OT_OROR) { @@ -820,50 +735,12 @@ static int ceval(C *c, int i, const CEnv *env, uint64_t *out) return 1; } if (!ceval(c, n->a, env, &a) || !ceval(c, n->b, env, &b)) return 0; - if (is_cmpop(op)) { - OscScalar T = (OscScalar)n->flag; - int lt = osc_scalar_signed(T) ? (int64_t)a < (int64_t)b : a < b, eq = a == b; - switch (op) { - case OT_EQ: *out = eq; break; - case OT_NE: *out = !eq; break; - case OT_LT: *out = lt; break; - case OT_LE: *out = lt || eq; break; - case OT_GT: *out = !lt && !eq; break; - default: *out = !lt; break; - } + uint64_t cc = osc_compare_opcode(op); + if (cc) { + *out = osc_alu_cmp(cc, n->flag, a, b); return 1; } - OscScalar t = n->ty.s, tb = NODE(n->b)->ty.s; - unsigned w = osc_scalar_width(t); - int s = osc_scalar_signed(t); - i128 A = s ? (i128)(int64_t)a : (i128)a, B = osc_scalar_signed(tb) ? (i128)(int64_t)b : (i128)b, r; - switch (op) { - case OT_PLUS: if (!s) { *out = ccanon(t, a + b); return 1; } r = A + B; break; - case OT_MINUS: if (!s) { *out = ccanon(t, a - b); return 1; } r = A - B; break; - case OT_STAR: if (!s) { *out = ccanon(t, a * b); return 1; } r = A * B; break; - case OT_SLASH: - if (b == 0) return 0; - if (!s) { *out = a / b; return 1; } - r = A / B; - break; - case OT_PERCENT: - if (b == 0) return 0; - *out = s ? (uint64_t)(int64_t)(A % B) : a % b; - return 1; - case OT_AMP: *out = a & b; return 1; - case OT_PIPE: *out = a | b; return 1; - case OT_CARET: *out = a ^ b; return 1; - case OT_SHL: case OT_SHR: - if (B < 0 || B >= (i128)w) return 0; - if (op == OT_SHR) { *out = s ? (uint64_t)((int64_t)a >> (unsigned)B) : a >> (unsigned)B; return 1; } - if (!s) { *out = ccanon(t, a << (unsigned)B); return 1; } - r = A * ((i128)1 << (unsigned)B); - break; - default: return 0; - } - if (!sfits(w, r)) return 0; - *out = (uint64_t)(int64_t)r; - return 1; + return osc_alu_bin(osc_binary_opcode(op), n->ty.s, a, b, out) == OSC_TRAP_NONE; } default: return 0; /* ON_INDEX (memory), ON_CALL (refused in clauses anyway) */ @@ -1210,13 +1087,13 @@ static int chk(C *c, int i, OscScalar want) return -1; } if (want && constexpr_(c, i)) { - i128 v; + uint64_t v; if (fold(c, i, want, &v)) return -1; return (int)want; } OscScalar t; switch (n->kind) { - case ON_INT: { i128 v; if (fold(c, i, want, &v)) return -1; return (int)want; } /* unreachable: constexpr */ + case ON_INT: { uint64_t v; if (fold(c, i, want, &v)) return -1; return (int)want; } /* unreachable: constexpr */ case ON_BOOL: t = OSC_T_BOOL; break; diff --git a/src/compiler/osc_interp.c b/src/compiler/osc_interp.c index 000a2fde4..dee38c20b 100644 --- a/src/compiler/osc_interp.c +++ b/src/compiler/osc_interp.c @@ -18,11 +18,11 @@ * osc_interp.c -- reference interpreter for the OSC-1 IR (DESIGN section 5). * OSC-1 slice; not a general Omega compiler; no self-hosting. * - * Checked signed arithmetic is computed exactly in 128-bit integers and then - * range-checked, independently of the native code's flag/extension tricks, so - * the differential test compares two different derivations of section 5. + * Scalar operations use the seeded OSC scalar unit. It reports OSC trap + * codes to this runtime and executes independently of the native back end. */ #include "osc_interp.h" +#include "omega_api_decl.h" #include @@ -32,96 +32,8 @@ typedef struct { uint64_t steps; } Ctx; -typedef __int128 i128; - static void trap(Ctx *c, unsigned code) { osc_rt_trap(c->rt, code); } -static uint64_t canon(OscScalar t, uint64_t x) { - unsigned w = osc_scalar_width(t); - if (t == OSC_T_BOOL) return x & 1; - if (w >= 64) return x; - if (osc_scalar_signed(t)) { - uint64_t m = 1ULL << (w - 1); - x &= (1ULL << w) - 1; - return (x ^ m) - m; - } - return x & ((1ULL << w) - 1); -} - -static i128 smin(unsigned w) { return -((i128)1 << (w - 1)); } -static i128 smax(unsigned w) { return ((i128)1 << (w - 1)) - 1; } - -/* exact signed result -> canonical, or OVERFLOW */ -static uint64_t sfit(Ctx *c, unsigned w, i128 r) { - if (r < smin(w) || r > smax(w)) trap(c, OSC_TRAP_OVERFLOW); - return (uint64_t)(int64_t)r; -} - -static uint64_t do_bin(Ctx *c, unsigned sub, OscScalar t, OscScalar tb, uint64_t a, uint64_t b) { - unsigned w = osc_scalar_width(t); - bool s = osc_scalar_signed(t); - i128 A = s ? (i128)(int64_t)a : (i128)a, B = osc_scalar_signed(tb) ? (i128)(int64_t)b : (i128)b; - switch (sub) { - case OSC_B_ADD: return s ? sfit(c, w, A + B) : canon(t, a + b); - case OSC_B_SUB: return s ? sfit(c, w, A - B) : canon(t, a - b); - case OSC_B_MUL: return s ? sfit(c, w, A * B) : canon(t, a * b); - case OSC_B_DIV: - if (b == 0) trap(c, OSC_TRAP_DIV0); - return s ? sfit(c, w, A / B) : a / b; /* C: truncation toward zero */ - case OSC_B_REM: - if (b == 0) trap(c, OSC_TRAP_DIV0); - return s ? (uint64_t)(int64_t)(A % B) : a % b; /* sign of the dividend; MIN % -1 == 0 */ - case OSC_B_AND: return a & b; - case OSC_B_OR: return a | b; - case OSC_B_XOR: return a ^ b; - case OSC_B_SHL: - case OSC_B_SHR: { - if (B < 0 || B >= (i128)w) trap(c, OSC_TRAP_SHIFT); - unsigned k = (unsigned)B; - if (sub == OSC_B_SHL) return s ? sfit(c, w, A * ((i128)1 << k)) : canon(t, a << k); - return s ? (uint64_t)((int64_t)a >> k) : a >> k; - } - default: trap(c, OSC_TRAP_RUNTIME); - } - return 0; -} - -static uint64_t do_un(Ctx *c, unsigned sub, OscScalar t, uint64_t a) { - switch (sub) { - case OSC_U_NEG: - if (osc_scalar_signed(t)) return sfit(c, osc_scalar_width(t), -(i128)(int64_t)a); - return canon(t, 0 - a); - case OSC_U_BNOT: return canon(t, ~a); - case OSC_U_LNOT: return a ^ 1; - default: trap(c, OSC_TRAP_RUNTIME); - } - return 0; -} - -static uint64_t do_cmp(unsigned cc, OscScalar t, uint64_t a, uint64_t b) { - bool lt, eq = a == b; - if (osc_scalar_signed(t)) lt = (int64_t)a < (int64_t)b; - else lt = a < b; - switch (cc) { - case OSC_C_EQ: return eq; - case OSC_C_NE: return !eq; - case OSC_C_LT: return lt; - case OSC_C_LE: return lt || eq; - case OSC_C_GT: return !lt && !eq; - case OSC_C_GE: return !lt; - default: return 0; - } -} - -static uint64_t do_cast(Ctx *c, OscScalar to, OscScalar from, uint64_t a) { - i128 v = osc_scalar_signed(from) ? (i128)(int64_t)a : (i128)a; - unsigned w = osc_scalar_width(to); - i128 lo = osc_scalar_signed(to) ? smin(w) : 0; - i128 hi = osc_scalar_signed(to) ? smax(w) : (((i128)1 << w) - 1); - if (v < lo || v > hi) trap(c, OSC_TRAP_CAST); - return (uint64_t)v; -} - /* element pointer with the bounds rule of section 5 */ static uint64_t *elem(Ctx *c, const OscType *rt_, uint64_t base, OscScalar ti, uint64_t idx) { if (osc_scalar_signed(ti) && (int64_t)idx < 0) trap(c, OSC_TRAP_BOUNDS); @@ -178,10 +90,24 @@ static uint64_t run_func(Ctx *c, int fi, const uint64_t *args) { switch (in->op) { case OSC_I_CONST: v[in->dst] = in->imm; break; case OSC_I_MOV: v[in->dst] = v[in->a]; break; - case OSC_I_BIN: v[in->dst] = do_bin(c, in->sub, T[in->a].s, T[in->b].s, v[in->a], v[in->b]); break; - case OSC_I_UN: v[in->dst] = do_un(c, in->sub, T[in->a].s, v[in->a]); break; - case OSC_I_CMP: v[in->dst] = do_cmp(in->sub, T[in->a].s, v[in->a], v[in->b]); break; - case OSC_I_CAST: v[in->dst] = do_cast(c, T[in->dst].s, T[in->a].s, v[in->a]); break; + case OSC_I_BIN: { + uint64_t code = osc_alu_bin(in->sub, T[in->a].s, v[in->a], v[in->b], &v[in->dst]); + if (code) trap(c, (unsigned)code); + break; + } + case OSC_I_UN: { + uint64_t code = osc_alu_un(in->sub, T[in->a].s, v[in->a], &v[in->dst]); + if (code) trap(c, (unsigned)code); + break; + } + case OSC_I_CMP: + v[in->dst] = osc_alu_cmp(in->sub, T[in->a].s, v[in->a], v[in->b]); + break; + case OSC_I_CAST: { + uint64_t code = osc_alu_cast(T[in->dst].s, T[in->a].s, v[in->a], &v[in->dst]); + if (code) trap(c, (unsigned)code); + break; + } case OSC_I_ALLOC: v[in->dst] = osc_rt_alloc(c->rt, T[in->dst].len, v[in->a]); break; case OSC_I_RELEASE: osc_rt_release(c->rt, v[in->a], T[in->a].len); break; case OSC_I_AOPEN: v[in->dst] = osc_rt_arena_open(c->rt, in->imm); break; @@ -234,7 +160,7 @@ static int check_args(const OscUnit *u, int func, const uint64_t *args, unsigned if (t->s == OSC_T_BYTES || t->s == OSC_T_CELLS) continue; /* external pointer: checked as a pair below */ if (t->s == OSC_T_REF) { if (!osc_rt_is_live_ref(rt, args[p], t->len)) return -1; - } else if (canon(t->s, args[p]) != args[p]) { + } else if (osc_alu_canon(t->s, args[p]) != args[p]) { return -1; } } diff --git a/src/compiler/osc_lower.c b/src/compiler/osc_lower.c index 733b86439..255cd60f4 100644 --- a/src/compiler/osc_lower.c +++ b/src/compiler/osc_lower.c @@ -19,6 +19,7 @@ * OSC-1 slice; not a general Omega compiler; no self-hosting. */ #include "osc_lower.h" +#include "omega_api_decl.h" #include "osc_check.h" #include @@ -162,35 +163,6 @@ static void releases(L *l, const OscNode *n) } } -static int bop(int tok) -{ - switch (tok) { - case OT_PLUS: return OSC_B_ADD; - case OT_MINUS: return OSC_B_SUB; - case OT_STAR: return OSC_B_MUL; - case OT_SLASH: return OSC_B_DIV; - case OT_PERCENT: return OSC_B_REM; - case OT_AMP: return OSC_B_AND; - case OT_PIPE: return OSC_B_OR; - case OT_CARET: return OSC_B_XOR; - case OT_SHL: return OSC_B_SHL; - case OT_SHR: return OSC_B_SHR; - default: return 0; - } -} -static int cop(int tok) -{ - switch (tok) { - case OT_EQ: return OSC_C_EQ; - case OT_NE: return OSC_C_NE; - case OT_LT: return OSC_C_LT; - case OT_LE: return OSC_C_LE; - case OT_GT: return OSC_C_GT; - case OT_GE: return OSC_C_GE; - default: return 0; - } -} - /* symbol s is an external byte slice (its vreg is the pointer register) */ static int is_slice(L *l, int s) { @@ -313,9 +285,9 @@ static int expr(L *l, int i) int a = expr(l, n->a); int b = expr(l, n->b); int r = newvs(l, n->ty.s, n->line); - int cc = cop(n->op); + uint64_t cc = osc_compare_opcode(n->op); OscInsn *x = emit(l, cc ? OSC_I_CMP : OSC_I_BIN, n->line); - x->sub = (uint8_t)(cc ? cc : bop(n->op)); + x->sub = (uint8_t)(cc ? cc : osc_binary_opcode(n->op)); x->dst = (int16_t)r; x->a = (int16_t)a; x->b = (int16_t)b; diff --git a/src/compiler/osc_parse.c b/src/compiler/osc_parse.c index b76c1888f..46cbc7047 100644 --- a/src/compiler/osc_parse.c +++ b/src/compiler/osc_parse.c @@ -475,105 +475,99 @@ static int parse_call(P *p) return n; } -static int parse_primary(P *p) +static int parse_operand(P *p) { - const OscToken *t = cur(p); - int n; - switch (t->kind) { - case OT_INT: - n = new_node(p, ON_INT, t); - if (n < 0) return -1; - N(n)->ival = t->ival; - adv(p); - return n; - case OT_TRUE: case OT_FALSE: - n = new_node(p, ON_BOOL, t); - if (n < 0) return -1; - N(n)->ival = t->kind == OT_TRUE; - adv(p); - return n; - case OT_NAME: - if (peek_kind(p, 1) == OT_LPAREN) return parse_call(p); - if (peek_kind(p, 1) == OT_DOT && peek_kind(p, 2) == OT_ALLOC) { /* OSC-3 item 2: P.alloc(e) */ - n = new_node(p, ON_PALLOC, t); - if (n < 0) return -1; - adv(p); adv(p); adv(p); - if (expect(p, OT_LPAREN)) return -1; - if (enter(p)) return -1; - int e0 = parse_expr(p); + OscOperandState state = {0}; + const uint32_t first_prefix = p->ast->nnodes; + int value = -1; + for (;;) { + const OscToken *t = cur(p); + uint64_t action = osc_operand_step(&state, t->kind, peek_kind(p, 1), peek_kind(p, 2)); + int n; + switch (action) { + case OSC_OPERAND_PREFIX: + if (enter(p) || new_node(p, ON_UN, t) < 0) return -1; + adv(p); + break; + case OSC_OPERAND_UNWIND: + n = (int)(first_prefix + state.pending); + N(n)->op = p->ast->toks[N(n)->tok].kind; + N(n)->a = value; leave(p); - if (e0 < 0) return -1; - N(n)->a = e0; - if (expect(p, OT_RPAREN)) return -1; - return n; + value = n; + break; + case OSC_OPERAND_INTEGER: + case OSC_OPERAND_TRUE: + case OSC_OPERAND_FALSE: + case OSC_OPERAND_NAME: { + int kind = action == OSC_OPERAND_INTEGER ? ON_INT : action == OSC_OPERAND_NAME ? ON_NAME : ON_BOOL; + value = new_node(p, kind, t); + if (value < 0) return -1; + N(value)->ival = action == OSC_OPERAND_INTEGER ? t->ival : action == OSC_OPERAND_TRUE; + adv(p); + break; } - if (peek_kind(p, 1) == OT_DOT) return parse_field_ref(p, ON_FIELD); - if (peek_kind(p, 1) == OT_LBRACK) { + case OSC_OPERAND_CALL: + value = parse_call(p); + if (value < 0) return -1; + break; + case OSC_OPERAND_FIELD: + value = parse_field_ref(p, ON_FIELD); + if (value < 0) return -1; + break; + case OSC_OPERAND_INDEX: n = new_node(p, ON_INDEX, t); if (n < 0) return -1; adv(p); adv(p); - int ix = parse_expr(p); - if (ix < 0) return -1; - N(n)->a = ix; + value = parse_expr(p); + if (value < 0) return -1; + N(n)->a = value; if (expect(p, OT_RBRACK)) return -1; - return n; + value = n; + break; + case OSC_OPERAND_POOL: + n = new_node(p, ON_PALLOC, t); + if (n < 0) return -1; + adv(p); adv(p); adv(p); + if (expect(p, OT_LPAREN) || enter(p)) return -1; + value = parse_expr(p); + leave(p); + if (value < 0) return -1; + N(n)->a = value; + if (expect(p, OT_RPAREN)) return -1; + value = n; + break; + case OSC_OPERAND_GROUP: + if (enter(p)) return -1; + adv(p); + value = parse_expr(p); + if (value < 0 || expect(p, OT_RPAREN)) return -1; + leave(p); + break; + case OSC_OPERAND_CAST: + n = new_node(p, ON_CAST, t); + if (n < 0) return -1; + adv(p); + if (parse_type(p, &N(n)->ty, OSC_TYPE_SCALAR, OSC_REF_NONE)) return -1; + N(n)->a = value; + N(n)->line = N(value)->line; + N(n)->col = N(value)->col; + value = n; + break; + case OSC_OPERAND_DONE: + return value; + case OSC_OPERAND_CAST_ERROR: + return syntax(p, "';' (chained 'as' needs parentheses)"); + case OSC_OPERAND_BORROW_ERROR: + osc_diag_set(p->d, OSC_DIAG_UNSUPPORTED, t->line, t->col, "&", 0, NULL, "borrow in expression", + "a borrow may only be a call argument or a borrow binding's value"); + return -1; + case OSC_OPERAND_SYNTAX: + return syntax(p, "an expression"); + default: + abort(); } - n = new_node(p, ON_NAME, t); - if (n < 0) return -1; - adv(p); - return n; - case OT_LPAREN: { - if (enter(p)) return -1; - adv(p); - int e = parse_expr(p); - if (e < 0) return -1; - if (expect(p, OT_RPAREN)) return -1; - leave(p); - return e; - } - case OT_AMP: - osc_diag_set(p->d, OSC_DIAG_UNSUPPORTED, t->line, t->col, "&", 0, NULL, "borrow in expression", - "a borrow may only be a call argument or a borrow binding's value"); - return -1; - default: - return syntax(p, "an expression"); - } -} - -static int parse_postfix(P *p) -{ - int e = parse_primary(p); - if (e < 0) return -1; - if (at(p, OT_AS)) { - int n = new_node(p, ON_CAST, cur(p)); - if (n < 0) return -1; - adv(p); - if (parse_type(p, &N(n)->ty, OSC_TYPE_SCALAR, OSC_REF_NONE)) return -1; - N(n)->a = e; - N(n)->line = N(e)->line; - N(n)->col = N(e)->col; - if (at(p, OT_AS)) return syntax(p, "';' (chained 'as' needs parentheses)"); - return n; - } - return e; -} - -static int parse_unary(P *p) -{ - int k = cur(p)->kind; - if (k == OT_MINUS || k == OT_TILDE || k == OT_BANG) { - if (enter(p)) return -1; - int n = new_node(p, ON_UN, cur(p)); - if (n < 0) return -1; - adv(p); - int a = parse_unary(p); - leave(p); - if (a < 0) return -1; - N(n)->op = (uint16_t)k; - N(n)->a = a; - return n; } - return parse_postfix(p); } /* Omega decides when to consume the next operator and when to finish an @@ -582,7 +576,7 @@ static int parse_unary(P *p) static int parse_expr(P *p) { OscExprStack stack = {0}; - int operand = parse_unary(p); + int operand = parse_operand(p); while (operand >= 0) { uint64_t action = osc_expr_step(&stack, cur(p)->kind, (uint64_t)operand); switch (action) { @@ -594,7 +588,7 @@ static int parse_expr(P *p) stack.node[stack.depth - 1] = n; N(n)->op = cur(p)->kind; adv(p); - operand = parse_unary(p); + operand = parse_operand(p); break; } case OSC_EXPR_REDUCE: diff --git a/src/omega_api_decl.h b/src/omega_api_decl.h index b5c4ef71f..9bdb17d4d 100644 --- a/src/omega_api_decl.h +++ b/src/omega_api_decl.h @@ -228,6 +228,22 @@ uint64_t osc_read_type(const uint16_t o_kinds[7], const uint64_t o_values[7], ui #define OSC_EXPR_SHIFT 1 #define OSC_EXPR_REDUCE 2 #define OSC_EXPR_CHAINED 3 +#define OSC_OPERAND_DONE 0 +#define OSC_OPERAND_PREFIX 1 +#define OSC_OPERAND_INTEGER 2 +#define OSC_OPERAND_TRUE 3 +#define OSC_OPERAND_FALSE 4 +#define OSC_OPERAND_NAME 5 +#define OSC_OPERAND_CALL 6 +#define OSC_OPERAND_FIELD 7 +#define OSC_OPERAND_INDEX 8 +#define OSC_OPERAND_POOL 9 +#define OSC_OPERAND_GROUP 10 +#define OSC_OPERAND_BORROW_ERROR 11 +#define OSC_OPERAND_SYNTAX 12 +#define OSC_OPERAND_CAST 13 +#define OSC_OPERAND_CAST_ERROR 14 +#define OSC_OPERAND_UNWIND 15 typedef struct { uint32_t depth; uint32_t rank[9]; @@ -243,8 +259,81 @@ OMBR_ASSERT(offsetof(OscExprStack, node) == 40, "layout exprstk field node"); OMBR_ASSERT(offsetof(OscExprStack, lhs) == 76, "layout exprstk field lhs"); OMBR_ASSERT(offsetof(OscExprStack, parent) == 112, "layout exprstk field parent"); OMBR_ASSERT(offsetof(OscExprStack, left) == 116, "layout exprstk field left"); +typedef struct { + uint32_t phase; + uint32_t prefixes; + uint32_t pending; +} OscOperandState; +OMBR_ASSERT(sizeof(OscOperandState) == 12, "layout opstate size"); +OMBR_ASSERT(offsetof(OscOperandState, phase) == 0, "layout opstate field phase"); +OMBR_ASSERT(offsetof(OscOperandState, prefixes) == 4, "layout opstate field prefixes"); +OMBR_ASSERT(offsetof(OscOperandState, pending) == 8, "layout opstate field pending"); /* export fn osc_expr_step stack edit exprstk look ulong operand ulong to ulong */ uint64_t osc_expr_step(OscExprStack *o_stack, uint64_t o_look, uint64_t o_operand); +/* export fn osc_operand_step state edit opstate kind ulong nextkind ulong third ulong to ulong */ +uint64_t osc_operand_step(OscOperandState *o_state, uint64_t o_kind, uint64_t o_nextkind, uint64_t o_third); +/* export fn osc_alu_width t ulong to ulong */ +uint64_t osc_alu_width(uint64_t o_t); +/* export fn osc_alu_canon t ulong v ulong to ulong */ +uint64_t osc_alu_canon(uint64_t o_t, uint64_t o_v); +/* export fn osc_alu_bin op ulong t ulong a ulong b ulong value out ulong 1 to ulong */ +uint64_t osc_alu_bin(uint64_t o_op, uint64_t o_t, uint64_t o_a, uint64_t o_b, uint64_t o_value[1]); +/* export fn osc_alu_un op ulong t ulong a ulong value out ulong 1 to ulong */ +uint64_t osc_alu_un(uint64_t o_op, uint64_t o_t, uint64_t o_a, uint64_t o_value[1]); +/* export fn osc_alu_cmp cc ulong t ulong a ulong b ulong to ulong */ +uint64_t osc_alu_cmp(uint64_t o_cc, uint64_t o_t, uint64_t o_a, uint64_t o_b); +/* export fn osc_alu_cast target ulong src ulong a ulong value out ulong 1 to ulong */ +uint64_t osc_alu_cast(uint64_t o_target, uint64_t o_src, uint64_t o_a, uint64_t o_value[1]); +/* export fn osc_binary_opcode tok ulong to ulong */ +uint64_t osc_binary_opcode(uint64_t o_tok); +/* export fn osc_compare_opcode tok ulong to ulong */ +uint64_t osc_compare_opcode(uint64_t o_tok); +/* export fn osc_literal_fits t ulong magnitude ulong negative ulong to ulong */ +uint64_t osc_literal_fits(uint64_t o_t, uint64_t o_magnitude, uint64_t o_negative); +#define OSC_A64_ERR_UNUSED_SHIFT 1 +#define OSC_A64_ERR_UNUSED_COND 2 +#define OSC_A64_ERR_UNUSED_IMM2 3 +#define OSC_A64_ERR_UNUSED_IMM 4 +#define OSC_A64_ERR_SHIFT_KIND 5 +#define OSC_A64_ERR_SHIFT_AMOUNT 6 +#define OSC_A64_ERR_IMM12 7 +#define OSC_A64_ERR_LSL12 8 +#define OSC_A64_ERR_IMMR 9 +#define OSC_A64_ERR_IMMS 10 +#define OSC_A64_ERR_COND 11 +#define OSC_A64_ERR_IMM16 12 +#define OSC_A64_ERR_MOV_SHIFT 13 +#define OSC_A64_ERR_MEM_OFFSET 14 +#define OSC_A64_ERR_PAIR_OFFSET 15 +#define OSC_A64_ERR_WRITEBACK_ALIAS 16 +#define OSC_A64_ERR_LOAD_ALIAS 17 +#define OSC_A64_ERR_BRANCH_OFFSET 18 +#define OSC_A64_ERR_BRANCH_COND 19 +typedef struct { + uint32_t rd; + uint32_t rn; + uint32_t rm; + uint32_t ra; + uint32_t shift; + uint32_t cond; + int64_t imm; + int64_t imm2; +} OscA64Fields; +OMBR_ASSERT(sizeof(OscA64Fields) == 40, "layout a64field size"); +OMBR_ASSERT(offsetof(OscA64Fields, rd) == 0, "layout a64field field rd"); +OMBR_ASSERT(offsetof(OscA64Fields, rn) == 4, "layout a64field field rn"); +OMBR_ASSERT(offsetof(OscA64Fields, rm) == 8, "layout a64field field rm"); +OMBR_ASSERT(offsetof(OscA64Fields, ra) == 12, "layout a64field field ra"); +OMBR_ASSERT(offsetof(OscA64Fields, shift) == 16, "layout a64field field shift"); +OMBR_ASSERT(offsetof(OscA64Fields, cond) == 20, "layout a64field field cond"); +OMBR_ASSERT(offsetof(OscA64Fields, imm) == 24, "layout a64field field imm"); +OMBR_ASSERT(offsetof(OscA64Fields, imm2) == 32, "layout a64field field imm2"); +/* export fn osc_a64_pack_fields form ulong base ulong f view a64field to ulong */ +uint64_t osc_a64_pack_fields(uint64_t o_form, uint64_t o_base, const OscA64Fields *o_f); +/* export fn osc_a64_unpack_fields form ulong word ulong f edit a64field to void */ +void osc_a64_unpack_fields(uint64_t o_form, uint64_t o_word, OscA64Fields *o_f); +/* export fn osc_a64_check_fields cls ulong f view a64field writeback ulong loadpair ulong to ulong */ +uint64_t osc_a64_check_fields(uint64_t o_cls, const OscA64Fields *o_f, uint64_t o_writeback, uint64_t o_loadpair); #ifdef __cplusplus } #endif diff --git a/src/omega_native.h b/src/omega_native.h index 8b1ecfc8a..856f235f5 100644 --- a/src/omega_native.h +++ b/src/omega_native.h @@ -217,10 +217,40 @@ uint32_t omega2_osc_lex_next(uint64_t *result, const uint8_t *o_src, uint64_t o_ const char *omega2_ident_osc_type(void); /* export fn osc_read_type kinds view ushort 7 values view ulong 7 form ulong refkind ulong limit ulong result edit typerec to ulong */ uint32_t omega2_osc_read_type(uint64_t *result, const uint16_t *o_kinds, uint64_t o_kinds_len, const uint64_t *o_values, uint64_t o_values_len, uint64_t o_form, uint64_t o_refkind, uint64_t o_limit, uint8_t *o_result); -#define OMEGA2_IDENT_osc_expr "omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=253f0e1162235b4bda264d8e6d6b7953f0cf6f38fcc254523961502a6ca93207 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" +#define OMEGA2_IDENT_osc_expr "omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=e869e7be788d2f0c942d9c4c8d87d3fe6efc45713c0ced12d82183e3fa3dba1b omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" const char *omega2_ident_osc_expr(void); /* export fn osc_expr_step stack edit exprstk look ulong operand ulong to ulong */ uint32_t omega2_osc_expr_step(uint64_t *result, uint8_t *o_stack, uint64_t o_look, uint64_t o_operand); +/* export fn osc_operand_step state edit opstate kind ulong nextkind ulong third ulong to ulong */ +uint32_t omega2_osc_operand_step(uint64_t *result, uint8_t *o_state, uint64_t o_kind, uint64_t o_nextkind, uint64_t o_third); +#define OMEGA2_IDENT_osc_scalar "omega-ident 1 unit=osc_scalar abi=2 profile=OM-2 src=9f5f4721178d24ba8a31a2053da0464bc02950d353c67a11c53f0f89df7cf858 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" +const char *omega2_ident_osc_scalar(void); +/* export fn osc_alu_width t ulong to ulong */ +uint32_t omega2_osc_alu_width(uint64_t *result, uint64_t o_t); +/* export fn osc_alu_canon t ulong v ulong to ulong */ +uint32_t omega2_osc_alu_canon(uint64_t *result, uint64_t o_t, uint64_t o_v); +/* export fn osc_alu_bin op ulong t ulong a ulong b ulong value out ulong 1 to ulong */ +uint32_t omega2_osc_alu_bin(uint64_t *result, uint64_t o_op, uint64_t o_t, uint64_t o_a, uint64_t o_b, uint64_t *o_value); +/* export fn osc_alu_un op ulong t ulong a ulong value out ulong 1 to ulong */ +uint32_t omega2_osc_alu_un(uint64_t *result, uint64_t o_op, uint64_t o_t, uint64_t o_a, uint64_t *o_value); +/* export fn osc_alu_cmp cc ulong t ulong a ulong b ulong to ulong */ +uint32_t omega2_osc_alu_cmp(uint64_t *result, uint64_t o_cc, uint64_t o_t, uint64_t o_a, uint64_t o_b); +/* export fn osc_alu_cast target ulong src ulong a ulong value out ulong 1 to ulong */ +uint32_t omega2_osc_alu_cast(uint64_t *result, uint64_t o_target, uint64_t o_src, uint64_t o_a, uint64_t *o_value); +/* export fn osc_binary_opcode tok ulong to ulong */ +uint32_t omega2_osc_binary_opcode(uint64_t *result, uint64_t o_tok); +/* export fn osc_compare_opcode tok ulong to ulong */ +uint32_t omega2_osc_compare_opcode(uint64_t *result, uint64_t o_tok); +/* export fn osc_literal_fits t ulong magnitude ulong negative ulong to ulong */ +uint32_t omega2_osc_literal_fits(uint64_t *result, uint64_t o_t, uint64_t o_magnitude, uint64_t o_negative); +#define OMEGA2_IDENT_osc_a64_fields "omega-ident 1 unit=osc_a64_fields abi=2 profile=OM-2 src=9611ed84cd164f070399a77dcae62086f741201bcc972d969f912b21ce8824b4 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" +const char *omega2_ident_osc_a64_fields(void); +/* export fn osc_a64_pack_fields form ulong base ulong f view a64field to ulong */ +uint32_t omega2_osc_a64_pack_fields(uint64_t *result, uint64_t o_form, uint64_t o_base, const uint8_t *o_f); +/* export fn osc_a64_unpack_fields form ulong word ulong f edit a64field to void */ +uint32_t omega2_osc_a64_unpack_fields(uint64_t *result, uint64_t o_form, uint64_t o_word, uint8_t *o_f); +/* export fn osc_a64_check_fields cls ulong f view a64field writeback ulong loadpair ulong to ulong */ +uint32_t omega2_osc_a64_check_fields(uint64_t *result, uint64_t o_cls, const uint8_t *o_f, uint64_t o_writeback, uint64_t o_loadpair); #ifdef __cplusplus } #endif diff --git a/src/omega_om_units.c b/src/omega_om_units.c index d3f53fded..c03e76f56 100644 --- a/src/omega_om_units.c +++ b/src/omega_om_units.c @@ -2030,8 +2030,8 @@ __attribute__((visibility("default"))) uint32_t omega2_osc_read_type(uint64_t *r return OMEGA_BAD_ARG; return ombr2_run(ombr2_entry_osc_read_type, a, result, 1, ou, no); } -__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_expr\n.hidden ombr2_code_osc_expr\nombr2_code_osc_expr:\n.byte 0x3a,0x00,0x00,0x14,0x1f,0xd4,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xd0,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xe0,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0xf4,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0x63,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xc0,0x00,0xf1,0x61,0x00,0x00,0x54,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xc4,0x00,0xf1,0x61,0x00,0x00,0x54,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xbc,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xd8,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xdc,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x23,0x00,0x02,0xaa,0x63,0x00,0x00,0xb4,0xe0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xa8,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xac,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x23,0x00,0x02,0xaa,0x63,0x00,0x00,0xb4,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xb0,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xb4,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x1f,0xb8,0x00,0xf1,0xe3,0x17,0x9f,0x9a,0x44,0x00,0x03,0xaa,0x25,0x00,0x04,0xaa,0x65,0x00,0x00,0xb4,0x20,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x24,0xfc,0x60,0xd3,0x84,0x0a,0x00,0xb5,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xbd,0xff,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0x05,0x00,0x80,0xd2,0x04,0x68,0x65,0xb8,0x9f,0x00,0x00,0xf1,0xe0,0x04,0x00,0x54,0x86,0x04,0x00,0x51,0xe5,0x03,0x06,0xaa,0xbf,0x24,0x00,0xf1,0x62,0x07,0x00,0x54,0x88,0x00,0x80,0xd2,0x08,0x09,0x05,0x8b,0x06,0x68,0x68,0xb8,0xdf,0x00,0x03,0xeb,0xc3,0x03,0x00,0x54,0x88,0x04,0x00,0x51,0x09,0x00,0x80,0xd2,0x08,0x68,0x29,0xb8,0xbf,0x24,0x00,0xf1,0x22,0x06,0x00,0x54,0x08,0x05,0x80,0xd2,0x08,0x09,0x05,0x8b,0x09,0x68,0x68,0xb8,0x29,0x7d,0x40,0x93,0x0a,0x0e,0x80,0xd2,0x09,0x68,0x2a,0xb8,0xbf,0x24,0x00,0xf1,0x22,0x05,0x00,0x54,0x88,0x09,0x80,0xd2,0x08,0x09,0x05,0x8b,0x09,0x68,0x68,0xb8,0x29,0x7d,0x40,0x93,0x8a,0x0e,0x80,0xd2,0x09,0x68,0x2a,0xb8,0xdf,0x0c,0x00,0xf1,0xe8,0x17,0x9f,0x9a,0x7f,0x0c,0x00,0xf1,0xe9,0x17,0x9f,0x9a,0x0a,0x01,0x09,0x8a,0x6a,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x7f,0x00,0x00,0xf1,0x61,0x00,0x00,0x54,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x9f,0x24,0x00,0xf1,0x62,0x02,0x00,0x54,0x85,0x00,0x80,0xd2,0xa5,0x08,0x04,0x8b,0x03,0x68,0x25,0xb8,0x45,0xfc,0x5f,0xd3,0x05,0x02,0x00,0xb5,0x9f,0x24,0x00,0xf1,0x82,0x01,0x00,0x54,0x86,0x09,0x80,0xd2,0xc6,0x08,0x04,0x8b,0x02,0x68,0x26,0xb8,0x85,0x04,0x00,0x11,0x06,0x00,0x80,0xd2,0x05,0x68,0x26,0xb8,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x61,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xa1,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17\n.previous\n"); -static const char ombr2_ident_osc_expr[] = "omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=253f0e1162235b4bda264d8e6d6b7953f0cf6f38fcc254523961502a6ca93207 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_expr\n.hidden ombr2_code_osc_expr\nombr2_code_osc_expr:\n.byte 0x3b,0x00,0x00,0x14,0x91,0x00,0x00,0x14,0x1f,0xd4,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xd0,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xe0,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0xf4,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0x63,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xc0,0x00,0xf1,0x61,0x00,0x00,0x54,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xc4,0x00,0xf1,0x61,0x00,0x00,0x54,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xbc,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xd8,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xdc,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x23,0x00,0x02,0xaa,0x63,0x00,0x00,0xb4,0xe0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xa8,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xac,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x23,0x00,0x02,0xaa,0x63,0x00,0x00,0xb4,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xb0,0x00,0xf1,0xe1,0x17,0x9f,0x9a,0x1f,0xb4,0x00,0xf1,0xe2,0x17,0x9f,0x9a,0x1f,0xb8,0x00,0xf1,0xe3,0x17,0x9f,0x9a,0x44,0x00,0x03,0xaa,0x25,0x00,0x04,0xaa,0x65,0x00,0x00,0xb4,0x20,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x24,0xfc,0x60,0xd3,0x84,0x0a,0x00,0xb5,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xbd,0xff,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0x05,0x00,0x80,0xd2,0x04,0x68,0x65,0xb8,0x9f,0x00,0x00,0xf1,0xe0,0x04,0x00,0x54,0x86,0x04,0x00,0x51,0xe5,0x03,0x06,0xaa,0xbf,0x24,0x00,0xf1,0x62,0x07,0x00,0x54,0x88,0x00,0x80,0xd2,0x08,0x09,0x05,0x8b,0x06,0x68,0x68,0xb8,0xdf,0x00,0x03,0xeb,0xc3,0x03,0x00,0x54,0x88,0x04,0x00,0x51,0x09,0x00,0x80,0xd2,0x08,0x68,0x29,0xb8,0xbf,0x24,0x00,0xf1,0x22,0x06,0x00,0x54,0x08,0x05,0x80,0xd2,0x08,0x09,0x05,0x8b,0x09,0x68,0x68,0xb8,0x29,0x7d,0x40,0x93,0x0a,0x0e,0x80,0xd2,0x09,0x68,0x2a,0xb8,0xbf,0x24,0x00,0xf1,0x22,0x05,0x00,0x54,0x88,0x09,0x80,0xd2,0x08,0x09,0x05,0x8b,0x09,0x68,0x68,0xb8,0x29,0x7d,0x40,0x93,0x8a,0x0e,0x80,0xd2,0x09,0x68,0x2a,0xb8,0xdf,0x0c,0x00,0xf1,0xe8,0x17,0x9f,0x9a,0x7f,0x0c,0x00,0xf1,0xe9,0x17,0x9f,0x9a,0x0a,0x01,0x09,0x8a,0x6a,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x7f,0x00,0x00,0xf1,0x61,0x00,0x00,0x54,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x9f,0x24,0x00,0xf1,0x62,0x02,0x00,0x54,0x85,0x00,0x80,0xd2,0xa5,0x08,0x04,0x8b,0x03,0x68,0x25,0xb8,0x45,0xfc,0x5f,0xd3,0x05,0x02,0x00,0xb5,0x9f,0x24,0x00,0xf1,0x82,0x01,0x00,0x54,0x86,0x09,0x80,0xd2,0xc6,0x08,0x04,0x8b,0x02,0x68,0x26,0xb8,0x85,0x04,0x00,0x11,0x06,0x00,0x80,0xd2,0x05,0x68,0x26,0xb8,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x61,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xa1,0x00,0x80,0xd2,0xfa,0xff,0xff,0x17,0x05,0x00,0x80,0xd2,0x04,0x68,0x65,0xb8,0x9f,0x00,0x00,0xf1,0x01,0x0b,0x00,0x54,0x25,0xfc,0x60,0xd3,0x25,0x0f,0x00,0xb5,0x3f,0xac,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0x28,0xfc,0x60,0xd3,0xa8,0x0e,0x00,0xb5,0x3f,0xc8,0x00,0xf1,0xe9,0x17,0x9f,0x9a,0x2a,0xfc,0x60,0xd3,0x2a,0x0e,0x00,0xb5,0x3f,0xcc,0x00,0xf1,0xeb,0x17,0x9f,0x9a,0x2c,0x01,0x0b,0xaa,0xcd,0x00,0x0c,0xaa,0x0d,0x01,0x00,0xb4,0x85,0x00,0x80,0xd2,0x06,0x68,0x65,0xb8,0xc8,0x04,0x00,0x11,0x89,0x00,0x80,0xd2,0x08,0x68,0x29,0xb8,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x25,0x00,0x80,0xd2,0x06,0x00,0x80,0xd2,0x05,0x68,0x26,0xb8,0x25,0xfc,0x60,0xd3,0x05,0x0c,0x00,0xb5,0x3f,0x08,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x25,0xfc,0x60,0xd3,0x45,0x0b,0x00,0xb5,0x3f,0x4c,0x00,0xf1,0x61,0x00,0x00,0x54,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x25,0xfc,0x60,0xd3,0x85,0x0a,0x00,0xb5,0x3f,0x50,0x00,0xf1,0x61,0x00,0x00,0x54,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x25,0xfc,0x60,0xd3,0xc5,0x09,0x00,0xb5,0x3f,0x04,0x00,0xf1,0x61,0x03,0x00,0x54,0x45,0xfc,0x60,0xd3,0x45,0x09,0x00,0xb5,0x5f,0x78,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x45,0xfc,0x60,0xd3,0x85,0x08,0x00,0xb5,0x5f,0x88,0x00,0xf1,0x61,0x00,0x00,0x54,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x45,0xfc,0x60,0xd3,0xc5,0x07,0x00,0xb5,0x5f,0xfc,0x00,0xf1,0x21,0x01,0x00,0x54,0x65,0xfc,0x60,0xd3,0x45,0x07,0x00,0xb5,0x7f,0x20,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x25,0xfc,0x60,0xd3,0x05,0x06,0x00,0xb5,0x3f,0x78,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x25,0xfc,0x60,0xd3,0x45,0x05,0x00,0xb5,0x3f,0xbc,0x00,0xf1,0x61,0x00,0x00,0x54,0x60,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x80,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x25,0xfc,0x60,0xd3,0x45,0x04,0x00,0xb5,0x3f,0x48,0x00,0xf1,0x81,0x01,0x00,0x54,0x9f,0x04,0x00,0xf1,0xc1,0x00,0x00,0x54,0x45,0x00,0x80,0xd2,0x06,0x00,0x80,0xd2,0x05,0x68,0x26,0xb8,0xa0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x9f,0x08,0x00,0xf1,0x61,0x00,0x00,0x54,0xc0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x65,0x00,0x80,0xd2,0x06,0x00,0x80,0xd2,0x05,0x68,0x26,0xb8,0x86,0x00,0x80,0xd2,0x05,0x68,0x66,0xb8,0xbf,0x00,0x00,0xf1,0x20,0x01,0x00,0x54,0xa6,0x04,0x00,0x51,0x08,0x01,0x80,0xd2,0x06,0x68,0x28,0xb8,0xa6,0x04,0x00,0x51,0x88,0x00,0x80,0xd2,0x06,0x68,0x28,0xb8,0xe0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xa1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17\n.previous\n"); +static const char ombr2_ident_osc_expr[] = "omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=e869e7be788d2f0c942d9c4c8d87d3fe6efc45713c0ced12d82183e3fa3dba1b omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; __attribute__((visibility("default"))) const char *omega2_ident_osc_expr(void) { return ombr2_ident_osc_expr; @@ -2057,6 +2057,288 @@ __attribute__((visibility("default"))) uint32_t omega2_osc_expr_step(uint64_t *r return OMEGA_BAD_ARG; return ombr2_run(ombr2_entry_osc_expr_step, a, result, 1, ou, no); } +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_operand_step\n.hidden ombr2_entry_osc_operand_step\nombr2_entry_osc_operand_step:\nhint #34\nb ombr2_code_osc_expr+4\n.previous\n"); +extern const unsigned char ombr2_entry_osc_operand_step[] __attribute__((visibility("hidden"))); +/* export fn osc_operand_step state edit opstate kind ulong nextkind ulong third ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_operand_step(uint64_t *result, uint8_t *o_state, uint64_t o_kind, uint64_t o_nextkind, uint64_t o_third) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + if (ombr2_fixed(sp, &ns, o_state, 12u, 1u, 1)) + return OMEGA_BAD_ARG; + a[0] = (uint64_t)(uintptr_t)o_state; + a[1] = o_kind; + a[2] = o_nextkind; + a[3] = o_third; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_operand_step, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_scalar\n.hidden ombr2_code_osc_scalar\nombr2_code_osc_scalar:\n.byte 0x0f,0x00,0x00,0x14,0x44,0x00,0x00,0x14,0xc8,0x02,0x00,0x14,0x55,0x03,0x00,0x14,0xe1,0x03,0x00,0x14,0x6e,0x04,0x00,0x14,0xfa,0x04,0x00,0x14,0x0c,0x05,0x00,0x14,0x16,0x05,0x00,0x14,0x1f,0x18,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0x24,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x20,0x00,0x02,0x8a,0xc0,0x03,0x5f,0xd6,0x1f,0x04,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x08,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0x14,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0xe3,0x00,0x00,0xb4,0x01,0x08,0x00,0xd1,0x02,0x01,0x80,0xd2,0x3f,0x00,0x01,0xf1,0x02,0x03,0x00,0x54,0x40,0x20,0xc1,0x9a,0xc0,0x03,0x5f,0xd6,0xff,0x43,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xfe,0x07,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xe6,0xff,0xff,0x97,0xe1,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xfe,0x07,0x40,0xf9,0xff,0x43,0x00,0x91,0xe1,0x00,0x00,0xb4,0x01,0x18,0x00,0xd1,0x02,0x01,0x80,0xd2,0x3f,0x00,0x01,0xf1,0x02,0x01,0x00,0x54,0x40,0x20,0xc1,0x9a,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xe1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x1f,0x00,0x01,0xf1,0x61,0x00,0x00,0x54,0x00,0x00,0x80,0x92,0xc0,0x03,0x5f,0xd6,0x21,0x00,0x80,0xd2,0x1f,0x00,0x01,0xf1,0xe2,0x00,0x00,0x54,0x22,0x20,0xc0,0x9a,0x40,0x04,0x00,0xd1,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xe1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xff,0x83,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xfe,0x0f,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xc4,0xff,0xff,0x97,0xe2,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xfe,0x0f,0x40,0xf9,0xff,0x83,0x00,0x91,0xff,0x83,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xfe,0x0f,0x00,0xf9,0xe0,0x0b,0x40,0xf9,0xdf,0xff,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x0f,0x40,0xf9,0xff,0x83,0x00,0x91,0x21,0x00,0x03,0x8a,0xff,0x83,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xfe,0x0f,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xa4,0xff,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x0f,0x40,0xf9,0xff,0x83,0x00,0x91,0x03,0x01,0x00,0xb4,0x44,0x04,0x00,0xd1,0x25,0x00,0x80,0xd2,0x9f,0x00,0x01,0xf1,0x22,0x01,0x00,0x54,0xa3,0x20,0xc4,0x9a,0x24,0x00,0x03,0xca,0x81,0x00,0x03,0xcb,0xe0,0x03,0x01,0xaa,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xe1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xe1,0xff,0x9f,0x92,0x01,0x00,0xa0,0xf2,0x01,0x00,0xc0,0xf2,0x01,0x00,0xf0,0xf2,0x1f,0x00,0x01,0xeb,0x83,0x00,0x00,0x54,0x01,0x00,0x80,0xd2,0x20,0x00,0x00,0xcb,0xc0,0x03,0x5f,0xd6,0xc0,0x03,0x5f,0xd6,0x03,0x04,0x00,0xd1,0x24,0x00,0x80,0xd2,0x7f,0x00,0x01,0xf1,0x42,0x01,0x00,0x54,0x82,0x20,0xc3,0x9a,0x61,0x00,0x00,0xb4,0xe0,0x03,0x02,0xaa,0xc0,0x03,0x5f,0xd6,0x40,0x04,0x00,0xd1,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xe1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x72,0xff,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xfe,0x1f,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x59,0xff,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1f,0x40,0xf9,0xff,0x03,0x01,0x91,0x48,0x00,0x03,0x8b,0x1f,0x08,0x00,0xf1,0x41,0x00,0x00,0x54,0x48,0x00,0x03,0xcb,0x86,0x02,0x00,0xb4,0xaa,0x04,0x00,0xd1,0x2b,0x00,0x80,0xd2,0x5f,0x01,0x01,0xf1,0xc2,0x05,0x00,0x54,0x69,0x21,0xca,0x9a,0x0b,0x01,0x02,0xca,0x6a,0x01,0x09,0x8a,0x4c,0x00,0x03,0xca,0x8b,0x01,0x09,0x8a,0x5f,0x01,0x00,0xf1,0x20,0x01,0x00,0x54,0x1f,0x04,0x00,0xf1,0xec,0x17,0x9f,0x9a,0x7f,0x01,0x00,0xf1,0xed,0x17,0x9f,0x9a,0x9f,0x01,0x0d,0xeb,0x61,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xfe,0x23,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xe1,0x1f,0x40,0xf9,0x67,0xff,0xff,0x97,0xe9,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xfe,0x23,0x40,0xf9,0xff,0x43,0x01,0x91,0x89,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xe1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x03,0x40,0xf9,0x15,0xff,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xfe,0xfe,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xa5,0x0a,0x00,0xb4,0x28,0x00,0x02,0xca,0xe9,0xff,0x9f,0x92,0x09,0x00,0xa0,0xf2,0x09,0x00,0xc0,0xf2,0x09,0x00,0xf0,0xf2,0x1f,0x01,0x09,0xeb,0xea,0x37,0x9f,0x9a,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xfe,0x2b,0x00,0xf9,0xe0,0x13,0x40,0xf9,0xe1,0x27,0x40,0xf9,0x5b,0xff,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x2b,0x40,0xf9,0xff,0x83,0x01,0x91,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xfe,0x23,0x00,0xf9,0xe0,0x0b,0x40,0xf9,0x3c,0xff,0xff,0x97,0xe8,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xfe,0x23,0x40,0xf9,0xff,0x43,0x01,0x91,0x1f,0x01,0x00,0xf1,0xc0,0x03,0x00,0x54,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xfe,0x23,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x24,0xff,0xff,0x97,0xe9,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xfe,0x23,0x40,0xf9,0xff,0x43,0x01,0x91,0x48,0x04,0x00,0xb4,0xca,0x08,0xc8,0x9a,0x3f,0x01,0x0a,0xeb,0x69,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x26,0x7c,0x02,0x9b,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xfe,0x1f,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xe1,0x1b,0x40,0xf9,0xd0,0xfe,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1f,0x40,0xf9,0xff,0x03,0x01,0x91,0x66,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x41,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x7f,0xfe,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xfe,0x1f,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x66,0xfe,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1f,0x40,0xf9,0xff,0x03,0x01,0x91,0x7f,0x00,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe8,0x03,0x02,0xaa,0xe9,0x03,0x03,0xaa,0x26,0x06,0x00,0xb4,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xfe,0x27,0x00,0xf9,0xe0,0x0b,0x40,0xf9,0xbb,0xfe,0xff,0x97,0xe8,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xfe,0x27,0x40,0xf9,0xff,0x43,0x01,0x91,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xfe,0x27,0x00,0xf9,0xe0,0x0f,0x40,0xf9,0xa3,0xfe,0xff,0x97,0xe9,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xfe,0x27,0x40,0xf9,0xff,0x43,0x01,0x91,0x1f,0x10,0x00,0xf1,0x41,0x06,0x00,0x54,0x89,0x08,0x00,0xb4,0x0a,0x09,0xc9,0x9a,0xa6,0x05,0x00,0xb4,0x4c,0x00,0x03,0xca,0xed,0xff,0x9f,0x92,0x0d,0x00,0xa0,0xf2,0x0d,0x00,0xc0,0xf2,0x0d,0x00,0xf0,0xf2,0x9f,0x01,0x0d,0xeb,0xeb,0x37,0x9f,0x9a,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xeb,0x2b,0x00,0xf9,0xfe,0x2f,0x00,0xf9,0xe0,0x17,0x40,0xf9,0xe1,0x2b,0x40,0xf9,0x86,0xfe,0xff,0x97,0xec,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xe9,0x23,0x40,0xf9,0xea,0x27,0x40,0xf9,0xeb,0x2b,0x40,0xf9,0xfe,0x2f,0x40,0xf9,0xff,0x83,0x01,0x91,0x5f,0x01,0x0c,0xeb,0x69,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x6b,0x00,0x00,0xb4,0x0c,0x00,0x80,0xd2,0x8a,0x01,0x0a,0xcb,0x8a,0x00,0x00,0xf9,0x0f,0x00,0x00,0x14,0x69,0x02,0x00,0xb4,0x0b,0x09,0xc9,0x9a,0x6a,0xa1,0x09,0x9b,0xeb,0xff,0x9f,0x92,0x0b,0x00,0xa0,0xf2,0x0b,0x00,0xc0,0xf2,0x0b,0x00,0xf0,0xf2,0x5f,0x00,0x0b,0xeb,0xec,0x37,0x9f,0x9a,0xcd,0x00,0x0c,0x8a,0x6d,0x00,0x00,0xb4,0x0b,0x00,0x80,0xd2,0x6a,0x01,0x0a,0xcb,0x8a,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0x41,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xda,0xfd,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xfe,0x1f,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xc1,0xfd,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1f,0x40,0xf9,0xff,0x03,0x01,0x91,0x7f,0x00,0x05,0xeb,0x63,0x00,0x00,0x54,0xe0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x24,0x00,0xf1,0x61,0x0b,0x00,0x54,0xc6,0x07,0x00,0xb4,0xe9,0xff,0x9f,0x92,0x09,0x00,0xa0,0xf2,0x09,0x00,0xc0,0xf2,0x09,0x00,0xf0,0xf2,0x5f,0x00,0x09,0xeb,0xea,0x37,0x9f,0x9a,0xff,0x83,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xe9,0x23,0x00,0xf9,0xea,0x27,0x00,0xf9,0xfe,0x2b,0x00,0xf9,0xe0,0x17,0x40,0xf9,0xe1,0x27,0x40,0xf9,0x18,0xfe,0xff,0x97,0xe8,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xfe,0x2b,0x40,0xf9,0xff,0x83,0x01,0x91,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xfe,0x23,0x00,0xf9,0xe0,0x0b,0x40,0xf9,0xf8,0xfd,0xff,0x97,0xe9,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xe8,0x1f,0x40,0xf9,0xfe,0x23,0x40,0xf9,0xff,0x43,0x01,0x91,0x7f,0x00,0x01,0xf1,0x02,0x07,0x00,0x54,0x0a,0x25,0xc3,0x9a,0x3f,0x01,0x0a,0xeb,0x69,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x7f,0x00,0x01,0xf1,0x22,0x06,0x00,0x54,0x48,0x20,0xc3,0x9a,0xff,0x43,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xe8,0x1f,0x00,0xf9,0xfe,0x23,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xe1,0x1f,0x40,0xf9,0xa0,0xfd,0xff,0x97,0xe8,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xfe,0x23,0x40,0xf9,0xff,0x43,0x01,0x91,0x88,0x00,0x00,0xf9,0x12,0x00,0x00,0x14,0x7f,0x00,0x01,0xf1,0xa2,0x02,0x00,0x54,0x48,0x24,0xc3,0x9a,0xe9,0xff,0x9f,0x92,0x09,0x00,0xa0,0xf2,0x09,0x00,0xc0,0xf2,0x09,0x00,0xf0,0xf2,0x5f,0x00,0x09,0xeb,0xea,0x37,0x9f,0x9a,0xcb,0x00,0x0a,0x8a,0xcb,0x00,0x00,0xb4,0xe9,0x03,0x22,0xaa,0x7f,0x00,0x01,0xf1,0x22,0x01,0x00,0x54,0x2a,0x25,0xc3,0x9a,0xe8,0x03,0x2a,0xaa,0x88,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xe1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x05,0x00,0x80,0xd2,0x85,0x00,0x00,0xf9,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x3b,0xfd,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xbf,0x00,0x00,0xf1,0x61,0x00,0x00,0x54,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x04,0x00,0xf1,0xe5,0x17,0x9f,0x9a,0x1f,0x08,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0xa8,0x00,0x06,0xaa,0xa8,0x02,0x00,0xb4,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xa1,0xfd,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0x0c,0x00,0xf1,0x81,0x02,0x00,0x54,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xe1,0x0b,0x40,0xf9,0xe2,0x0f,0x40,0xf9,0xe3,0x13,0x40,0xf9,0xea,0xfd,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0x10,0x00,0xf1,0xe5,0x17,0x9f,0x9a,0x1f,0x14,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0xa8,0x00,0x06,0xaa,0xa8,0x02,0x00,0xb4,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0x65,0xfe,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0x18,0x00,0xf1,0xa1,0x00,0x00,0x54,0x45,0x00,0x03,0x8a,0x85,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x1c,0x00,0xf1,0xa1,0x00,0x00,0x54,0x45,0x00,0x03,0xaa,0x85,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x20,0x00,0xf1,0xa1,0x00,0x00,0x54,0x45,0x00,0x03,0xca,0x85,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x24,0x00,0xf1,0xe5,0x17,0x9f,0x9a,0x1f,0x28,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0xa8,0x00,0x06,0xaa,0xa8,0x02,0x00,0xb4,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xde,0xfe,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x04,0x00,0x80,0xd2,0x64,0x00,0x00,0xf9,0x1f,0x04,0x00,0xf1,0xa1,0x0c,0x00,0x54,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xfe,0x13,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xa6,0xfc,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x13,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc4,0x07,0x00,0xb4,0xe4,0xff,0x9f,0x92,0x04,0x00,0xa0,0xf2,0x04,0x00,0xc0,0xf2,0x04,0x00,0xf0,0xf2,0x5f,0x00,0x04,0xeb,0x03,0x07,0x00,0x54,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xfe,0x13,0x00,0xf9,0xe0,0x0b,0x40,0xf9,0x02,0xfd,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x13,0x40,0xf9,0xff,0xc3,0x00,0x91,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x86,0xfc,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x17,0x40,0xf9,0x01,0x00,0x80,0xd2,0xe9,0xfc,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0x9f,0x00,0x05,0xeb,0x69,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x04,0x00,0x80,0xd2,0x85,0x00,0x02,0xcb,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xe1,0x17,0x40,0xf9,0x90,0xfc,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0x64,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x08,0x00,0xf1,0xc1,0x02,0x00,0x54,0xe4,0x03,0x22,0xaa,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xe1,0x13,0x40,0xf9,0x79,0xfc,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0x64,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x0c,0x00,0xf1,0xc1,0x00,0x00,0x54,0x24,0x00,0x80,0xd2,0x45,0x00,0x04,0xca,0x65,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x60,0x00,0x00,0xb4,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xfe,0x13,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x1d,0xfc,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x13,0x40,0xf9,0xff,0xc3,0x00,0x91,0x64,0x01,0x00,0xb4,0xe4,0xff,0x9f,0x92,0x04,0x00,0xa0,0xf2,0x04,0x00,0xc0,0xf2,0x04,0x00,0xf0,0xf2,0x42,0x00,0x04,0xca,0xe4,0xff,0x9f,0x92,0x04,0x00,0xa0,0xf2,0x04,0x00,0xc0,0xf2,0x04,0x00,0xf0,0xf2,0x63,0x00,0x04,0xca,0x1f,0x04,0x00,0xf1,0x41,0x02,0x00,0x54,0x5f,0x00,0x03,0xeb,0xe4,0x17,0x9f,0x9a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x13,0x40,0xf9,0xd5,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0x08,0x00,0xf1,0x41,0x02,0x00,0x54,0x5f,0x00,0x03,0xeb,0xe4,0x07,0x9f,0x9a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x13,0x40,0xf9,0xc2,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0x0c,0x00,0xf1,0x41,0x02,0x00,0x54,0x5f,0x00,0x03,0xeb,0xe4,0x27,0x9f,0x9a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x13,0x40,0xf9,0xaf,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0x10,0x00,0xf1,0x41,0x02,0x00,0x54,0x5f,0x00,0x03,0xeb,0xe4,0x87,0x9f,0x9a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x13,0x40,0xf9,0x9c,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0x14,0x00,0xf1,0x41,0x02,0x00,0x54,0x5f,0x00,0x03,0xeb,0xe4,0x97,0x9f,0x9a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x13,0x40,0xf9,0x89,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0x18,0x00,0xf1,0x41,0x02,0x00,0x54,0x5f,0x00,0x03,0xeb,0xe4,0x37,0x9f,0x9a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x13,0x40,0xf9,0x76,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x04,0x00,0x80,0xd2,0x64,0x00,0x00,0xf9,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x07,0x40,0xf9,0x8c,0xfb,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xe6,0xff,0x9f,0x92,0x06,0x00,0xa0,0xf2,0x06,0x00,0xc0,0xf2,0x06,0x00,0xf0,0xf2,0x5f,0x00,0x06,0xeb,0xe8,0x37,0x9f,0x9a,0xa4,0x00,0x08,0x8a,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x03,0x40,0xf9,0x79,0xfb,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x03,0x40,0xf9,0x61,0xfb,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0x46,0x06,0x00,0xb4,0xe6,0x03,0x02,0xaa,0xa4,0x02,0x00,0xb4,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xfe,0x1f,0x00,0xf9,0xe0,0x0b,0x40,0xf9,0xbc,0xfb,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1f,0x40,0xf9,0xff,0x03,0x01,0x91,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xe6,0x1b,0x00,0xf9,0xfe,0x1f,0x00,0xf9,0xe0,0x17,0x40,0xf9,0xe1,0x13,0x40,0xf9,0xb1,0xfb,0xff,0x97,0xe8,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xe6,0x1b,0x40,0xf9,0xfe,0x1f,0x40,0xf9,0xff,0x03,0x01,0x91,0xdf,0x00,0x08,0xeb,0x69,0x00,0x00,0x54,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1a,0x00,0x00,0x14,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x17,0x40,0xf9,0x49,0xfb,0xff,0x97,0xe6,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xe5,0x17,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0x5f,0x00,0x06,0xeb,0xe8,0x97,0x9f,0x9a,0x89,0x00,0x08,0xaa,0x69,0x00,0x00,0xb4,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x62,0x00,0x00,0xf9,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xa8,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0xc4,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0x83,0x00,0x00,0xb4,0x01,0xa8,0x00,0xd1,0x20,0x04,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x1f,0xd8,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xdc,0x00,0xf1,0x61,0x00,0x00,0x54,0x40,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0xe0,0x00,0xf1,0xe1,0x37,0x9f,0x9a,0x1f,0xf4,0x00,0xf1,0xe2,0x87,0x9f,0x9a,0x23,0x00,0x02,0x8a,0x83,0x00,0x00,0xb4,0x01,0xe0,0x00,0xd1,0x20,0x04,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xfe,0x13,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xea,0xfa,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x13,0x40,0xf9,0xff,0xc3,0x00,0x91,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xfe,0x13,0x00,0xf9,0xe0,0x03,0x40,0xf9,0xd6,0xfa,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x13,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc4,0x04,0x00,0xb4,0x5f,0x00,0x00,0xf1,0xe4,0x07,0x9f,0x9a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x0f,0x40,0xf9,0xe1,0x13,0x40,0xf9,0x3e,0xfb,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0x3f,0x00,0x04,0xeb,0xe5,0x87,0x9f,0x9a,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x17,0x40,0xf9,0x86,0xfe,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xc0,0x03,0x5f,0xd6,0x5f,0x00,0x00,0xf1,0x40,0x02,0x00,0x54,0x3f,0x00,0x00,0xf1,0xe4,0x17,0x9f,0x9a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x13,0x40,0xf9,0x73,0xfe,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xfe,0x13,0x00,0xf9,0xe0,0x0f,0x40,0xf9,0xbb,0xfa,0xff,0x97,0xe4,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x13,0x40,0xf9,0xff,0xc3,0x00,0x91,0x3f,0x00,0x04,0xeb,0xe5,0x87,0x9f,0x9a,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x17,0x40,0xf9,0x52,0xfe,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xc0,0x03,0x5f,0xd6\n.previous\n"); +static const char ombr2_ident_osc_scalar[] = "omega-ident 1 unit=osc_scalar abi=2 profile=OM-2 src=9f5f4721178d24ba8a31a2053da0464bc02950d353c67a11c53f0f89df7cf858 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; +__attribute__((visibility("default"))) const char *omega2_ident_osc_scalar(void) +{ + return ombr2_ident_osc_scalar; +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_alu_width\n.hidden ombr2_entry_osc_alu_width\nombr2_entry_osc_alu_width:\nhint #34\nb ombr2_code_osc_scalar+0\n.previous\n"); +extern const unsigned char ombr2_entry_osc_alu_width[] __attribute__((visibility("hidden"))); +/* export fn osc_alu_width t ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_alu_width(uint64_t *result, uint64_t o_t) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_t; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_alu_width, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_alu_canon\n.hidden ombr2_entry_osc_alu_canon\nombr2_entry_osc_alu_canon:\nhint #34\nb ombr2_code_osc_scalar+4\n.previous\n"); +extern const unsigned char ombr2_entry_osc_alu_canon[] __attribute__((visibility("hidden"))); +/* export fn osc_alu_canon t ulong v ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_alu_canon(uint64_t *result, uint64_t o_t, uint64_t o_v) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_t; + a[1] = o_v; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_alu_canon, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_alu_bin\n.hidden ombr2_entry_osc_alu_bin\nombr2_entry_osc_alu_bin:\nhint #34\nb ombr2_code_osc_scalar+8\n.previous\n"); +extern const unsigned char ombr2_entry_osc_alu_bin[] __attribute__((visibility("hidden"))); +/* export fn osc_alu_bin op ulong t ulong a ulong b ulong value out ulong 1 to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_alu_bin(uint64_t *result, uint64_t o_op, uint64_t o_t, uint64_t o_a, uint64_t o_b, uint64_t *o_value) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_op; + a[1] = o_t; + a[2] = o_a; + a[3] = o_b; + if (ombr2_fixed(sp, &ns, o_value, 8u, 8u, 2)) + return OMEGA_BAD_ARG; + ou[no].slot = 4u; + ou[no].n = 8u; + ou[no].dst = o_value; + no++; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_alu_bin, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_alu_un\n.hidden ombr2_entry_osc_alu_un\nombr2_entry_osc_alu_un:\nhint #34\nb ombr2_code_osc_scalar+12\n.previous\n"); +extern const unsigned char ombr2_entry_osc_alu_un[] __attribute__((visibility("hidden"))); +/* export fn osc_alu_un op ulong t ulong a ulong value out ulong 1 to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_alu_un(uint64_t *result, uint64_t o_op, uint64_t o_t, uint64_t o_a, uint64_t *o_value) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_op; + a[1] = o_t; + a[2] = o_a; + if (ombr2_fixed(sp, &ns, o_value, 8u, 8u, 2)) + return OMEGA_BAD_ARG; + ou[no].slot = 3u; + ou[no].n = 8u; + ou[no].dst = o_value; + no++; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_alu_un, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_alu_cmp\n.hidden ombr2_entry_osc_alu_cmp\nombr2_entry_osc_alu_cmp:\nhint #34\nb ombr2_code_osc_scalar+16\n.previous\n"); +extern const unsigned char ombr2_entry_osc_alu_cmp[] __attribute__((visibility("hidden"))); +/* export fn osc_alu_cmp cc ulong t ulong a ulong b ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_alu_cmp(uint64_t *result, uint64_t o_cc, uint64_t o_t, uint64_t o_a, uint64_t o_b) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_cc; + a[1] = o_t; + a[2] = o_a; + a[3] = o_b; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_alu_cmp, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_alu_cast\n.hidden ombr2_entry_osc_alu_cast\nombr2_entry_osc_alu_cast:\nhint #34\nb ombr2_code_osc_scalar+20\n.previous\n"); +extern const unsigned char ombr2_entry_osc_alu_cast[] __attribute__((visibility("hidden"))); +/* export fn osc_alu_cast target ulong src ulong a ulong value out ulong 1 to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_alu_cast(uint64_t *result, uint64_t o_target, uint64_t o_src, uint64_t o_a, uint64_t *o_value) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_target; + a[1] = o_src; + a[2] = o_a; + if (ombr2_fixed(sp, &ns, o_value, 8u, 8u, 2)) + return OMEGA_BAD_ARG; + ou[no].slot = 3u; + ou[no].n = 8u; + ou[no].dst = o_value; + no++; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_alu_cast, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_binary_opcode\n.hidden ombr2_entry_osc_binary_opcode\nombr2_entry_osc_binary_opcode:\nhint #34\nb ombr2_code_osc_scalar+24\n.previous\n"); +extern const unsigned char ombr2_entry_osc_binary_opcode[] __attribute__((visibility("hidden"))); +/* export fn osc_binary_opcode tok ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_binary_opcode(uint64_t *result, uint64_t o_tok) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_tok; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_binary_opcode, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_compare_opcode\n.hidden ombr2_entry_osc_compare_opcode\nombr2_entry_osc_compare_opcode:\nhint #34\nb ombr2_code_osc_scalar+28\n.previous\n"); +extern const unsigned char ombr2_entry_osc_compare_opcode[] __attribute__((visibility("hidden"))); +/* export fn osc_compare_opcode tok ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_compare_opcode(uint64_t *result, uint64_t o_tok) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_tok; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_compare_opcode, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_literal_fits\n.hidden ombr2_entry_osc_literal_fits\nombr2_entry_osc_literal_fits:\nhint #34\nb ombr2_code_osc_scalar+32\n.previous\n"); +extern const unsigned char ombr2_entry_osc_literal_fits[] __attribute__((visibility("hidden"))); +/* export fn osc_literal_fits t ulong magnitude ulong negative ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_literal_fits(uint64_t *result, uint64_t o_t, uint64_t o_magnitude, uint64_t o_negative) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_t; + a[1] = o_magnitude; + a[2] = o_negative; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_literal_fits, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_a64_fields\n.hidden ombr2_code_osc_a64_fields\nombr2_code_osc_a64_fields:\n.byte 0x03,0x00,0x00,0x14,0xa1,0x00,0x00,0x14,0x81,0x01,0x00,0x14,0x04,0x00,0x80,0xd2,0x45,0x68,0x64,0xb8,0xe3,0x03,0x05,0xaa,0x85,0x00,0x80,0xd2,0x46,0x68,0x65,0xb8,0xc4,0xe8,0x7b,0xd3,0x06,0x01,0x80,0xd2,0x48,0x68,0x66,0xb8,0x05,0xbd,0x70,0xd3,0x88,0x01,0x80,0xd2,0x49,0x68,0x68,0xb8,0x26,0xd5,0x76,0xd3,0x09,0x03,0x80,0xd2,0x4a,0x68,0x69,0xf8,0xe8,0x03,0x0a,0xaa,0x0a,0x04,0x80,0xd2,0x4b,0x68,0x6a,0xf8,0xe9,0x03,0x0b,0xaa,0x1f,0x04,0x00,0xf1,0x61,0x01,0x00,0x54,0x8b,0x00,0x05,0xaa,0x6a,0x00,0x0b,0xaa,0x0c,0x02,0x80,0xd2,0x4d,0x68,0x6c,0xb8,0xae,0xa5,0x6a,0xd3,0x0f,0xd5,0x76,0xd3,0xcb,0x01,0x0f,0xaa,0x4c,0x01,0x0b,0xaa,0x20,0x00,0x0c,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x08,0x00,0xf1,0x01,0x01,0x00,0x54,0x6a,0x00,0x04,0xaa,0x2b,0xa5,0x6a,0xd3,0x0c,0xd5,0x76,0xd3,0x6d,0x01,0x0c,0xaa,0x4e,0x01,0x0d,0xaa,0x20,0x00,0x0e,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x0c,0x00,0xf1,0xc1,0x00,0x00,0x54,0x6a,0x00,0x04,0xaa,0xab,0x00,0x06,0xaa,0x4c,0x01,0x0b,0xaa,0x20,0x00,0x0c,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x10,0x00,0xf1,0xea,0x17,0x9f,0x9a,0x1f,0x14,0x00,0xf1,0xeb,0x17,0x9f,0x9a,0x4c,0x01,0x0b,0xaa,0xac,0x00,0x00,0xb4,0x8a,0x00,0x05,0xaa,0x6b,0x00,0x0a,0xaa,0x20,0x00,0x0b,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x18,0x00,0xf1,0x01,0x01,0x00,0x54,0x6a,0x00,0x04,0xaa,0x0b,0xbd,0x70,0xd3,0x2c,0xd5,0x76,0xd3,0x6d,0x01,0x0c,0xaa,0x4e,0x01,0x0d,0xaa,0x20,0x00,0x0e,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x1c,0x00,0xf1,0x21,0x01,0x00,0x54,0x8b,0x00,0x05,0xaa,0x6a,0x00,0x0b,0xaa,0x8b,0x02,0x80,0xd2,0x4c,0x68,0x6b,0xb8,0x8d,0xcd,0x74,0xd3,0x4e,0x01,0x0d,0xaa,0x20,0x00,0x0e,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x20,0x00,0xf1,0x01,0x01,0x00,0x54,0x2a,0xfd,0x44,0xd3,0x4b,0xa9,0x6b,0xd3,0x0c,0xe9,0x7b,0xd3,0x6d,0x01,0x0c,0xaa,0x6e,0x00,0x0d,0xaa,0x20,0x00,0x0e,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x24,0x00,0xf1,0xe1,0x00,0x00,0x54,0x6a,0x00,0x04,0xaa,0x0b,0xfd,0x43,0xd3,0x6c,0xd5,0x76,0xd3,0x4d,0x01,0x0c,0xaa,0x20,0x00,0x0d,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x28,0x00,0xf1,0x41,0x01,0x00,0x54,0x0b,0xfd,0x43,0xd3,0xec,0x0f,0x80,0xd2,0x6d,0x01,0x0c,0x8a,0xaa,0xc1,0x71,0xd3,0x6b,0x00,0x04,0xaa,0xcc,0x00,0x0a,0xaa,0x6d,0x01,0x0c,0xaa,0x20,0x00,0x0d,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x2c,0x00,0xf1,0xe1,0x00,0x00,0x54,0x0a,0xfd,0x42,0xd3,0xeb,0xff,0x9f,0xd2,0xeb,0x7f,0xa0,0xf2,0x4c,0x01,0x0b,0x8a,0x20,0x00,0x0c,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x30,0x00,0xf1,0xea,0x17,0x9f,0x9a,0x1f,0x34,0x00,0xf1,0xeb,0x17,0x9f,0x9a,0x4c,0x01,0x0b,0xaa,0x0c,0x02,0x00,0xb4,0x0b,0xfd,0x42,0xd3,0xec,0xff,0x9f,0xd2,0xec,0x00,0xa0,0xf2,0x6d,0x01,0x0c,0x8a,0xaa,0xe9,0x7b,0xd3,0x1f,0x30,0x00,0xf1,0xc1,0x00,0x00,0x54,0x8b,0x02,0x80,0xd2,0x4c,0x68,0x6b,0xb8,0x4d,0x01,0x0c,0xaa,0x20,0x00,0x0d,0xaa,0xc0,0x03,0x5f,0xd6,0x4b,0x01,0x03,0xaa,0x20,0x00,0x0b,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x38,0x00,0xf1,0x61,0x00,0x00,0x54,0x20,0x00,0x04,0xaa,0xc0,0x03,0x5f,0xd6,0x1f,0x3c,0x00,0xf1,0x81,0x00,0x00,0x54,0x0a,0xe9,0x7b,0xd3,0x20,0x00,0x0a,0xaa,0xc0,0x03,0x5f,0xd6,0x8e,0x00,0x00,0x54,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xa1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x03,0x00,0x01,0xca,0x64,0x00,0x01,0xcb,0x5f,0x00,0x01,0xf1,0xe2,0x00,0x00,0x54,0x85,0x20,0xc2,0x9a,0xe0,0x03,0x05,0xaa,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xe1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0xe3,0x03,0x80,0xd2,0x24,0x00,0x03,0x8a,0x85,0xfc,0x60,0xd3,0x85,0x1b,0x00,0xb5,0x06,0x00,0x80,0xd2,0x44,0x68,0x26,0xb8,0x23,0xfc,0x45,0xd3,0xe4,0x03,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x60,0xd3,0xa6,0x1a,0x00,0xb5,0x88,0x00,0x80,0xd2,0x45,0x68,0x28,0xb8,0x23,0xfc,0x50,0xd3,0xe4,0x03,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x60,0xd3,0xc6,0x19,0x00,0xb5,0x08,0x01,0x80,0xd2,0x45,0x68,0x28,0xb8,0x23,0xfc,0x4a,0xd3,0xe4,0x03,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x60,0xd3,0xe6,0x18,0x00,0xb5,0x88,0x01,0x80,0xd2,0x45,0x68,0x28,0xb8,0x03,0x00,0x80,0xd2,0x04,0x02,0x80,0xd2,0x43,0x68,0x24,0xb8,0x03,0x00,0x80,0xd2,0x84,0x02,0x80,0xd2,0x43,0x68,0x24,0xb8,0x03,0x00,0x80,0xd2,0x04,0x03,0x80,0xd2,0x43,0x68,0x24,0xf8,0x03,0x00,0x80,0xd2,0x04,0x04,0x80,0xd2,0x43,0x68,0x24,0xf8,0x1f,0x04,0x00,0xf1,0xe1,0x01,0x00,0x54,0x23,0xfc,0x56,0xd3,0x64,0x00,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x60,0xd3,0x46,0x16,0x00,0xb5,0x08,0x02,0x80,0xd2,0x45,0x68,0x28,0xb8,0x23,0xfc,0x4a,0xd3,0xe4,0x07,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x7f,0xd3,0x66,0x15,0x00,0xb5,0x08,0x03,0x80,0xd2,0x45,0x68,0x28,0xf8,0x1f,0x08,0x00,0xf1,0xe1,0x01,0x00,0x54,0x23,0xfc,0x4a,0xd3,0xe4,0xff,0x81,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x7f,0xd3,0x46,0x14,0x00,0xb5,0x08,0x03,0x80,0xd2,0x45,0x68,0x28,0xf8,0x23,0xfc,0x56,0xd3,0x24,0x00,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x7f,0xd3,0x66,0x13,0x00,0xb5,0x08,0x04,0x80,0xd2,0x45,0x68,0x28,0xf8,0x1f,0x18,0x00,0xf1,0xe1,0x01,0x00,0x54,0x23,0xfc,0x50,0xd3,0xe4,0x07,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x7f,0xd3,0x46,0x12,0x00,0xb5,0x08,0x03,0x80,0xd2,0x45,0x68,0x28,0xf8,0x23,0xfc,0x4a,0xd3,0xe4,0x07,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x7f,0xd3,0x66,0x11,0x00,0xb5,0x08,0x04,0x80,0xd2,0x45,0x68,0x28,0xf8,0x1f,0x1c,0x00,0xf1,0x01,0x01,0x00,0x54,0x23,0xfc,0x4c,0xd3,0xe4,0x01,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x60,0xd3,0x46,0x10,0x00,0xb5,0x88,0x02,0x80,0xd2,0x45,0x68,0x28,0xb8,0x1f,0x20,0x00,0xf1,0x01,0x02,0x00,0x54,0x23,0xfc,0x45,0xd3,0xe4,0xff,0x9f,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x7f,0xd3,0x26,0x0f,0x00,0xb5,0x08,0x03,0x80,0xd2,0x45,0x68,0x28,0xf8,0x23,0xfc,0x55,0xd3,0x64,0x00,0x80,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xec,0x7c,0xd3,0xc8,0xfc,0x7f,0xd3,0x28,0x0e,0x00,0xb5,0x09,0x04,0x80,0xd2,0x46,0x68,0x29,0xf8,0x1f,0x24,0x00,0xf1,0x21,0x01,0x00,0x54,0x23,0xfc,0x4a,0xd3,0xe4,0xff,0x81,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xf0,0x7d,0xd3,0xc8,0xfc,0x7f,0xd3,0xe8,0x0c,0x00,0xb5,0x09,0x03,0x80,0xd2,0x46,0x68,0x29,0xf8,0x1f,0x28,0x00,0xf1,0x01,0x03,0x00,0x54,0x23,0xfc,0x4f,0xd3,0xe4,0x0f,0x80,0xd2,0x65,0x00,0x04,0x8a,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x17,0x40,0xf9,0x01,0x08,0x80,0xd2,0x62,0x00,0x80,0xd2,0x69,0xff,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0x04,0x03,0x80,0xd2,0x43,0x68,0x24,0xf8,0x1f,0x2c,0x00,0xf1,0xe1,0x02,0x00,0x54,0xe3,0xff,0x9f,0xd2,0xe3,0x7f,0xa0,0xf2,0x24,0x00,0x03,0x8a,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xfe,0x17,0x00,0xf9,0xe0,0x13,0x40,0xf9,0x01,0x40,0xa0,0xd2,0x42,0x00,0x80,0xd2,0x51,0xff,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x17,0x40,0xf9,0xff,0xc3,0x00,0x91,0x04,0x03,0x80,0xd2,0x43,0x68,0x24,0xf8,0x1f,0x30,0x00,0xf1,0xe3,0x17,0x9f,0x9a,0x1f,0x34,0x00,0xf1,0xe4,0x17,0x9f,0x9a,0x65,0x00,0x04,0xaa,0x25,0x04,0x00,0xb4,0x23,0xfc,0x45,0xd3,0xe4,0xff,0x9f,0xd2,0xe4,0x00,0xa0,0xf2,0x65,0x00,0x04,0x8a,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x17,0x40,0xf9,0x81,0x00,0xa0,0xd2,0x42,0x00,0x80,0xd2,0x33,0xff,0xff,0x97,0xe3,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0x04,0x03,0x80,0xd2,0x43,0x68,0x24,0xf8,0x1f,0x30,0x00,0xf1,0xe1,0x00,0x00,0x54,0xe3,0x01,0x80,0xd2,0x24,0x00,0x03,0x8a,0x85,0xfc,0x60,0xd3,0x05,0x02,0x00,0xb5,0x86,0x02,0x80,0xd2,0x44,0x68,0x26,0xb8,0x1f,0x3c,0x00,0xf1,0x01,0x01,0x00,0x54,0x23,0xfc,0x45,0xd3,0xe4,0xff,0x9f,0xd2,0x65,0x00,0x04,0x8a,0xa6,0xfc,0x7f,0xd3,0xe6,0x00,0x00,0xb5,0x08,0x03,0x80,0xd2,0x45,0x68,0x28,0xf8,0xc0,0x03,0x5f,0xd6,0xe0,0x03,0x07,0xaa,0xf0,0x08,0x40,0xf9,0x00,0x02,0x1f,0xd6,0xa1,0x00,0x80,0xd2,0xfc,0xff,0xff,0x17,0x05,0x03,0x80,0xd2,0x24,0x68,0x65,0xf8,0x06,0x04,0x80,0xd2,0x25,0x68,0x66,0xf8,0x1f,0x04,0x00,0xf1,0xe6,0x07,0x9f,0x9a,0x08,0x02,0x80,0xd2,0x29,0x68,0x68,0xb8,0x3f,0x01,0x00,0xf1,0xea,0x07,0x9f,0x9a,0xcb,0x00,0x0a,0x8a,0x6b,0x00,0x00,0xb4,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x86,0x02,0x80,0xd2,0x28,0x68,0x66,0xb8,0x1f,0x01,0x00,0xf1,0xe9,0x07,0x9f,0x9a,0x1f,0x1c,0x00,0xf1,0xea,0x07,0x9f,0x9a,0x1f,0x30,0x00,0xf1,0xeb,0x07,0x9f,0x9a,0x4c,0x01,0x0b,0x8a,0x2d,0x01,0x0c,0x8a,0x6d,0x00,0x00,0xb4,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xbf,0x00,0x00,0xf1,0x80,0x01,0x00,0x54,0x1f,0x08,0x00,0xf1,0xe6,0x07,0x9f,0x9a,0x1f,0x18,0x00,0xf1,0xe8,0x07,0x9f,0x9a,0x1f,0x20,0x00,0xf1,0xe9,0x07,0x9f,0x9a,0x0a,0x01,0x09,0x8a,0xcb,0x00,0x0a,0x8a,0x6b,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x9f,0x00,0x00,0xf1,0x80,0x02,0x00,0x54,0x1f,0x0c,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0x1f,0x10,0x00,0xf1,0xe8,0x17,0x9f,0x9a,0x1f,0x14,0x00,0xf1,0xe9,0x17,0x9f,0x9a,0x0a,0x01,0x09,0xaa,0xcb,0x00,0x0a,0xaa,0x6b,0x00,0x00,0xb4,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x1c,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0x1f,0x38,0x00,0xf1,0xe8,0x17,0x9f,0x9a,0xc9,0x00,0x08,0xaa,0x69,0x00,0x00,0xb4,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x04,0x00,0xf1,0xe1,0x01,0x00,0x54,0x06,0x02,0x80,0xd2,0x28,0x68,0x66,0xb8,0x1f,0x09,0x00,0xf1,0x69,0x00,0x00,0x54,0xa0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x9f,0x00,0x00,0xf1,0xe6,0xa7,0x9f,0x9a,0x9f,0xfc,0x00,0xf1,0xe8,0xd7,0x9f,0x9a,0xc9,0x00,0x08,0xaa,0x69,0x00,0x00,0xb4,0xc0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x08,0x00,0xf1,0x21,0x02,0x00,0x54,0x9f,0x00,0x00,0xf1,0xe6,0xa7,0x9f,0x9a,0x9f,0xfc,0x3f,0xf1,0xe8,0xd7,0x9f,0x9a,0xc9,0x00,0x08,0xaa,0x69,0x00,0x00,0xb4,0xe0,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xbf,0x00,0x00,0xf1,0xe6,0x07,0x9f,0x9a,0xbf,0x04,0x00,0xf1,0xe8,0x07,0x9f,0x9a,0xc9,0x00,0x08,0x8a,0x69,0x00,0x00,0xb4,0x00,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x18,0x00,0xf1,0x21,0x02,0x00,0x54,0x9f,0x00,0x00,0xf1,0xe6,0xa7,0x9f,0x9a,0x9f,0xfc,0x00,0xf1,0xe8,0xd7,0x9f,0x9a,0xc9,0x00,0x08,0xaa,0x69,0x00,0x00,0xb4,0x20,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xbf,0x00,0x00,0xf1,0xe6,0xa7,0x9f,0x9a,0xbf,0xfc,0x00,0xf1,0xe8,0xd7,0x9f,0x9a,0xc9,0x00,0x08,0xaa,0x69,0x00,0x00,0xb4,0x40,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x1c,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0x88,0x02,0x80,0xd2,0x29,0x68,0x68,0xb8,0x3f,0x39,0x00,0xf1,0xea,0x97,0x9f,0x9a,0xcb,0x00,0x0a,0x8a,0x6b,0x00,0x00,0xb4,0x60,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x20,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0x1f,0x3c,0x00,0xf1,0xe8,0x17,0x9f,0x9a,0xc9,0x00,0x08,0xaa,0x29,0x03,0x00,0xb4,0x9f,0x00,0x00,0xf1,0xe6,0xa7,0x9f,0x9a,0xe8,0xff,0x9f,0xd2,0x9f,0x00,0x08,0xeb,0xe9,0xd7,0x9f,0x9a,0xca,0x00,0x09,0xaa,0x6a,0x00,0x00,0xb4,0x80,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x20,0x00,0xf1,0xc1,0x01,0x00,0x54,0xbf,0x00,0x00,0xf1,0xe6,0xa7,0x9f,0x9a,0xbf,0xc0,0x00,0xf1,0xe8,0xd7,0x9f,0x9a,0xe9,0x01,0x80,0xd2,0xaa,0x00,0x09,0x8a,0x5f,0x01,0x00,0xf1,0xeb,0x07,0x9f,0x9a,0x0c,0x01,0x0b,0xaa,0xcd,0x00,0x0c,0xaa,0x6d,0x00,0x00,0xb4,0xa0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x24,0x00,0xf1,0xe1,0x01,0x00,0x54,0x9f,0x00,0x00,0xf1,0xe6,0xa7,0x9f,0x9a,0x08,0xff,0x8f,0xd2,0x9f,0x00,0x08,0xeb,0xe9,0xd7,0x9f,0x9a,0xea,0x00,0x80,0xd2,0x8b,0x00,0x0a,0x8a,0x7f,0x01,0x00,0xf1,0xec,0x07,0x9f,0x9a,0x2d,0x01,0x0c,0xaa,0xce,0x00,0x0d,0xaa,0x6e,0x00,0x00,0xb4,0xc0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x28,0x00,0xf1,0x21,0x06,0x00,0x54,0xe6,0x3f,0x80,0x92,0x9f,0x00,0x06,0xeb,0xe8,0xa7,0x9f,0x9a,0x9f,0xe0,0x07,0xf1,0xe9,0xd7,0x9f,0x9a,0xea,0x00,0x80,0xd2,0x8b,0x00,0x0a,0x8a,0x7f,0x01,0x00,0xf1,0xec,0x07,0x9f,0x9a,0x2d,0x01,0x0c,0xaa,0x0e,0x01,0x0d,0xaa,0x6e,0x00,0x00,0xb4,0xe0,0x01,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x5f,0x00,0x00,0xf1,0xe6,0x07,0x9f,0x9a,0x88,0x00,0x80,0xd2,0x29,0x68,0x68,0xb8,0x3f,0x7d,0x00,0xf1,0xea,0x07,0x9f,0x9a,0xcb,0x00,0x0a,0x8a,0xeb,0x01,0x00,0xb4,0x88,0x00,0x80,0xd2,0x26,0x68,0x68,0xb8,0x08,0x00,0x80,0xd2,0x29,0x68,0x68,0xb8,0xdf,0x00,0x09,0xeb,0xea,0x17,0x9f,0x9a,0x8b,0x01,0x80,0xd2,0x2c,0x68,0x6b,0xb8,0xdf,0x00,0x0c,0xeb,0xed,0x17,0x9f,0x9a,0x4e,0x01,0x0d,0xaa,0x6e,0x00,0x00,0xb4,0x00,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x7f,0x00,0x00,0xf1,0xe6,0x07,0x9f,0x9a,0x08,0x00,0x80,0xd2,0x29,0x68,0x68,0xb8,0x8a,0x01,0x80,0xd2,0x2b,0x68,0x6a,0xb8,0x3f,0x01,0x0b,0xeb,0xec,0x17,0x9f,0x9a,0xcd,0x00,0x0c,0x8a,0x6d,0x00,0x00,0xb4,0x20,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x2c,0x00,0xf1,0x41,0x02,0x00,0x54,0xe6,0xff,0x9f,0x92,0x06,0x00,0xbf,0xf2,0x9f,0x00,0x06,0xeb,0xe8,0xa7,0x9f,0x9a,0x89,0xff,0x9f,0xd2,0xe9,0xff,0xa0,0xf2,0x9f,0x00,0x09,0xeb,0xea,0xd7,0x9f,0x9a,0x6b,0x00,0x80,0xd2,0x8c,0x00,0x0b,0x8a,0x9f,0x01,0x00,0xf1,0xed,0x07,0x9f,0x9a,0x4e,0x01,0x0d,0xaa,0x0f,0x01,0x0e,0xaa,0x6f,0x00,0x00,0xb4,0x40,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x30,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0x1f,0x34,0x00,0xf1,0xe8,0x17,0x9f,0x9a,0xc9,0x00,0x08,0xaa,0x89,0x03,0x00,0xb4,0x1f,0x30,0x00,0xf1,0xe6,0x17,0x9f,0x9a,0x88,0x02,0x80,0xd2,0x29,0x68,0x68,0xb8,0x3f,0x35,0x00,0xf1,0xea,0x97,0x9f,0x9a,0xcb,0x00,0x0a,0x8a,0x6b,0x00,0x00,0xb4,0x60,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xe6,0xff,0x9f,0x92,0x06,0xfe,0xbf,0xf2,0x9f,0x00,0x06,0xeb,0xe8,0xa7,0x9f,0x9a,0x89,0xff,0x9f,0xd2,0xe9,0x01,0xa0,0xf2,0x9f,0x00,0x09,0xeb,0xea,0xd7,0x9f,0x9a,0x6b,0x00,0x80,0xd2,0x8c,0x00,0x0b,0x8a,0x9f,0x01,0x00,0xf1,0xed,0x07,0x9f,0x9a,0x4e,0x01,0x0d,0xaa,0x0f,0x01,0x0e,0xaa,0x6f,0x00,0x00,0xb4,0x40,0x02,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6\n.previous\n"); +static const char ombr2_ident_osc_a64_fields[] = "omega-ident 1 unit=osc_a64_fields abi=2 profile=OM-2 src=9611ed84cd164f070399a77dcae62086f741201bcc972d969f912b21ce8824b4 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; +__attribute__((visibility("default"))) const char *omega2_ident_osc_a64_fields(void) +{ + return ombr2_ident_osc_a64_fields; +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_a64_pack_fields\n.hidden ombr2_entry_osc_a64_pack_fields\nombr2_entry_osc_a64_pack_fields:\nhint #34\nb ombr2_code_osc_a64_fields+0\n.previous\n"); +extern const unsigned char ombr2_entry_osc_a64_pack_fields[] __attribute__((visibility("hidden"))); +/* export fn osc_a64_pack_fields form ulong base ulong f view a64field to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_a64_pack_fields(uint64_t *result, uint64_t o_form, uint64_t o_base, const uint8_t *o_f) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_form; + a[1] = o_base; + if (ombr2_fixed(sp, &ns, o_f, 40u, 1u, 0)) + return OMEGA_BAD_ARG; + a[2] = (uint64_t)(uintptr_t)o_f; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_a64_pack_fields, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_a64_unpack_fields\n.hidden ombr2_entry_osc_a64_unpack_fields\nombr2_entry_osc_a64_unpack_fields:\nhint #34\nb ombr2_code_osc_a64_fields+4\n.previous\n"); +extern const unsigned char ombr2_entry_osc_a64_unpack_fields[] __attribute__((visibility("hidden"))); +/* export fn osc_a64_unpack_fields form ulong word ulong f edit a64field to void */ +__attribute__((visibility("default"))) uint32_t omega2_osc_a64_unpack_fields(uint64_t *result, uint64_t o_form, uint64_t o_word, uint8_t *o_f) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_form; + a[1] = o_word; + if (ombr2_fixed(sp, &ns, o_f, 40u, 1u, 1)) + return OMEGA_BAD_ARG; + a[2] = (uint64_t)(uintptr_t)o_f; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_a64_unpack_fields, a, result, 0, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_a64_check_fields\n.hidden ombr2_entry_osc_a64_check_fields\nombr2_entry_osc_a64_check_fields:\nhint #34\nb ombr2_code_osc_a64_fields+8\n.previous\n"); +extern const unsigned char ombr2_entry_osc_a64_check_fields[] __attribute__((visibility("hidden"))); +/* export fn osc_a64_check_fields cls ulong f view a64field writeback ulong loadpair ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_a64_check_fields(uint64_t *result, uint64_t o_cls, const uint8_t *o_f, uint64_t o_writeback, uint64_t o_loadpair) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_cls; + if (ombr2_fixed(sp, &ns, o_f, 40u, 1u, 0)) + return OMEGA_BAD_ARG; + a[1] = (uint64_t)(uintptr_t)o_f; + a[2] = o_writeback; + a[3] = o_loadpair; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_a64_check_fields, a, result, 1, ou, no); +} /* Generated by omega-bridge src/native.om: the definitions of the C API declared in * omega_api_decl.h (output apic). Each calls omega2_ and calls abort() on a nonzero status. * Regenerate it; do not edit it. */ @@ -2662,3 +2944,107 @@ uint64_t osc_expr_step(OscExprStack *o_stack, uint64_t o_look, uint64_t o_operan abort(); return r; } +/* export fn osc_operand_step state edit opstate kind ulong nextkind ulong third ulong to ulong */ +uint64_t osc_operand_step(OscOperandState *o_state, uint64_t o_kind, uint64_t o_nextkind, uint64_t o_third) +{ + uint64_t r = 0; + if (omega2_osc_operand_step(&r, (uint8_t *)o_state, (uint64_t)o_kind, (uint64_t)o_nextkind, (uint64_t)o_third) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_alu_width t ulong to ulong */ +uint64_t osc_alu_width(uint64_t o_t) +{ + uint64_t r = 0; + if (omega2_osc_alu_width(&r, (uint64_t)o_t) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_alu_canon t ulong v ulong to ulong */ +uint64_t osc_alu_canon(uint64_t o_t, uint64_t o_v) +{ + uint64_t r = 0; + if (omega2_osc_alu_canon(&r, (uint64_t)o_t, (uint64_t)o_v) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_alu_bin op ulong t ulong a ulong b ulong value out ulong 1 to ulong */ +uint64_t osc_alu_bin(uint64_t o_op, uint64_t o_t, uint64_t o_a, uint64_t o_b, uint64_t o_value[1]) +{ + uint64_t r = 0; + if (omega2_osc_alu_bin(&r, (uint64_t)o_op, (uint64_t)o_t, (uint64_t)o_a, (uint64_t)o_b, o_value) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_alu_un op ulong t ulong a ulong value out ulong 1 to ulong */ +uint64_t osc_alu_un(uint64_t o_op, uint64_t o_t, uint64_t o_a, uint64_t o_value[1]) +{ + uint64_t r = 0; + if (omega2_osc_alu_un(&r, (uint64_t)o_op, (uint64_t)o_t, (uint64_t)o_a, o_value) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_alu_cmp cc ulong t ulong a ulong b ulong to ulong */ +uint64_t osc_alu_cmp(uint64_t o_cc, uint64_t o_t, uint64_t o_a, uint64_t o_b) +{ + uint64_t r = 0; + if (omega2_osc_alu_cmp(&r, (uint64_t)o_cc, (uint64_t)o_t, (uint64_t)o_a, (uint64_t)o_b) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_alu_cast target ulong src ulong a ulong value out ulong 1 to ulong */ +uint64_t osc_alu_cast(uint64_t o_target, uint64_t o_src, uint64_t o_a, uint64_t o_value[1]) +{ + uint64_t r = 0; + if (omega2_osc_alu_cast(&r, (uint64_t)o_target, (uint64_t)o_src, (uint64_t)o_a, o_value) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_binary_opcode tok ulong to ulong */ +uint64_t osc_binary_opcode(uint64_t o_tok) +{ + uint64_t r = 0; + if (omega2_osc_binary_opcode(&r, (uint64_t)o_tok) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_compare_opcode tok ulong to ulong */ +uint64_t osc_compare_opcode(uint64_t o_tok) +{ + uint64_t r = 0; + if (omega2_osc_compare_opcode(&r, (uint64_t)o_tok) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_literal_fits t ulong magnitude ulong negative ulong to ulong */ +uint64_t osc_literal_fits(uint64_t o_t, uint64_t o_magnitude, uint64_t o_negative) +{ + uint64_t r = 0; + if (omega2_osc_literal_fits(&r, (uint64_t)o_t, (uint64_t)o_magnitude, (uint64_t)o_negative) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_a64_pack_fields form ulong base ulong f view a64field to ulong */ +uint64_t osc_a64_pack_fields(uint64_t o_form, uint64_t o_base, const OscA64Fields *o_f) +{ + uint64_t r = 0; + if (omega2_osc_a64_pack_fields(&r, (uint64_t)o_form, (uint64_t)o_base, (const uint8_t *)o_f) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_a64_unpack_fields form ulong word ulong f edit a64field to void */ +void osc_a64_unpack_fields(uint64_t o_form, uint64_t o_word, OscA64Fields *o_f) +{ + uint64_t r = 0; + if (omega2_osc_a64_unpack_fields(&r, (uint64_t)o_form, (uint64_t)o_word, (uint8_t *)o_f) != OMEGA_OK) + abort(); + (void)r; +} +/* export fn osc_a64_check_fields cls ulong f view a64field writeback ulong loadpair ulong to ulong */ +uint64_t osc_a64_check_fields(uint64_t o_cls, const OscA64Fields *o_f, uint64_t o_writeback, uint64_t o_loadpair) +{ + uint64_t r = 0; + if (omega2_osc_a64_check_fields(&r, (uint64_t)o_cls, (const uint8_t *)o_f, (uint64_t)o_writeback, (uint64_t)o_loadpair) != OMEGA_OK) + abort(); + return r; +} diff --git a/src/omega_om_units.ident b/src/omega_om_units.ident index 910925c36..5e31fa1b3 100644 --- a/src/omega_om_units.ident +++ b/src/omega_om_units.ident @@ -25,4 +25,6 @@ omega-ident 1 unit=rx_skillroute_core abi=2 profile=OM-2 src=568e2a8345feaffe9d1 omega-ident 1 unit=rx_fusion_core abi=2 profile=OM-2 src=aab22272005a4d65c2ada2b9754906cdaa7736ae127042f84457d548875d1ee6 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_fusion_core.om omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=a3fa19176dbf6193b157f84e4b7330e7065215e2ea0bccb0f9dfe706645267fb omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_literal.om omega-ident 1 unit=osc_type abi=2 profile=OM-2 src=a33e7745e4cdb1a968b06aff6016de192ef8a2a9d0d2946f5b1f79c91c7f2cba omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_type.om -omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=253f0e1162235b4bda264d8e6d6b7953f0cf6f38fcc254523961502a6ca93207 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_expr.om +omega-ident 1 unit=osc_expr abi=2 profile=OM-2 src=e869e7be788d2f0c942d9c4c8d87d3fe6efc45713c0ced12d82183e3fa3dba1b omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_expr.om +omega-ident 1 unit=osc_scalar abi=2 profile=OM-2 src=9f5f4721178d24ba8a31a2053da0464bc02950d353c67a11c53f0f89df7cf858 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_scalar.om +omega-ident 1 unit=osc_a64_fields abi=2 profile=OM-2 src=9611ed84cd164f070399a77dcae62086f741201bcc972d969f912b21ce8824b4 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_a64_fields.om diff --git a/tests/compiler/test_osc_parse_parity.c b/tests/compiler/test_osc_parse_parity.c index 4cc2b1cf1..a7f5a577c 100644 --- a/tests/compiler/test_osc_parse_parity.c +++ b/tests/compiler/test_osc_parse_parity.c @@ -76,6 +76,11 @@ static void expression_cases(void) "fn f() -> u64 { return a * b + c << d & e ^ f | g == h && i || j; }", "fn f() -> u64 { return a == b * c < d; }", "fn f() -> u64 { return a == b && c == d; }", + "fn f() -> i32 { return !~-f(1, x[0]) as i32; }", + "fn f() -> i32 { return (x as i8) as i32; }", + "fn f() -> i32 { return -x as i8 as i32; }", + "fn f() -> i32 { return ~-!x as", "fn f() -> i32 { return ~-!; }", + "fn f() -> i32 { return !p.alloc(f(x.field[0])); }", "fn f() -> u64 { return a * (b + c", "fn f() -> u64 { return -(-a) << ~b; }" }; for (size_t i = 0; i < sizeof edge / sizeof *edge; ++i) diff --git a/tests/compiler/test_osc_scalar_parity.c b/tests/compiler/test_osc_scalar_parity.c new file mode 100644 index 000000000..0d48a24e8 --- /dev/null +++ b/tests/compiler/test_osc_scalar_parity.c @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Exercise the retired 128-bit interpreter on canonical input independently + * of both production consumers of the Omega scalar unit. */ +#include "osc_interp_reference.c" +#include "omega_api_decl.h" + +#include +#include +#include + +static OscRt runtime; +static Ctx context = {.rt = &runtime}; +static unsigned long checks; + +static unsigned reference(unsigned ins, unsigned op, OscScalar t, OscScalar other, + uint64_t a, uint64_t b, uint64_t *result) +{ + if (setjmp(runtime.jb)) return runtime.trap_code; + switch (ins) { + case OSC_I_BIN: *result = do_bin(&context, op, t, other, a, b); break; + case OSC_I_UN: *result = do_un(&context, op, t, a); break; + case OSC_I_CAST: *result = do_cast(&context, other, t, a); break; + case OSC_I_CMP: *result = do_cmp(op, t, a, b); break; + default: abort(); + } + return 0; +} + +static void check(unsigned ins, unsigned op, OscScalar t, OscScalar other, uint64_t a, uint64_t b) +{ + uint64_t got = 0, want = 0, code = 0; + unsigned expected = reference(ins, op, t, other, a, b, &want); + switch (ins) { + case OSC_I_BIN: code = osc_alu_bin(op, t, a, b, &got); break; + case OSC_I_UN: code = osc_alu_un(op, t, a, &got); break; + case OSC_I_CAST: code = osc_alu_cast(other, t, a, &got); break; + case OSC_I_CMP: got = osc_alu_cmp(op, t, a, b); break; + default: abort(); + } + if (code != expected || (!code && got != want)) { + fprintf(stderr, "FAIL ins=%u op=%u types=%u/%u a=%" PRIx64 " b=%" PRIx64 + " trap=%u/%" PRIu64 " result=%" PRIx64 "/%" PRIx64 "\n", + ins, op, (unsigned)t, (unsigned)other, a, b, expected, code, want, got); + exit(1); + } + ++checks; +} + +static void pair(OscScalar t, uint64_t a, uint64_t b) +{ + for (unsigned op = OSC_B_ADD; op <= OSC_B_SHR; ++op) + check(OSC_I_BIN, op, t, t, a, b); + for (unsigned cc = OSC_C_EQ; cc <= OSC_C_GE; ++cc) + check(OSC_I_CMP, cc, t, t, a, b); +} + +static void unary(OscScalar t, uint64_t a) +{ + check(OSC_I_UN, OSC_U_NEG, t, t, a, 0); + check(OSC_I_UN, OSC_U_BNOT, t, t, a, 0); + for (OscScalar dest = OSC_T_U8; dest <= OSC_T_I64; ++dest) + check(OSC_I_CAST, 0, t, dest, a, 0); +} + +int main(void) +{ + for (unsigned i = 0; i <= 1; ++i) + check(OSC_I_UN, OSC_U_LNOT, OSC_T_BOOL, OSC_T_BOOL, i, 0); + for (OscScalar t = OSC_T_U8; t <= OSC_T_I64; ++t) { + unsigned w = osc_scalar_width(t); + uint64_t sign = UINT64_C(1) << (w - 1); + uint64_t mask = w == 64 ? UINT64_MAX : (UINT64_C(1) << w) - 1; + uint64_t values[] = {0, 1, 2, 3, w - 1, w, w + 1, sign - 2, sign - 1, sign, + sign + 1, mask - 1, mask, UINT64_C(0x5555555555555555)}; + unsigned count = w == 8 ? 256 : sizeof values / sizeof *values; + for (unsigned i = 0; i < count; ++i) { + uint64_t a = canon(t, w == 8 ? i : values[i]); + unary(t, a); + for (unsigned j = 0; j < count; ++j) + pair(t, a, canon(t, w == 8 ? j : values[j])); + for (OscScalar ct = OSC_T_U8; ct <= OSC_T_I64; ++ct) { + for (size_t j = 0; j < sizeof values / sizeof *values; ++j) { + uint64_t count_value = canon(ct, values[j]); + check(OSC_I_BIN, OSC_B_SHL, t, ct, a, count_value); + check(OSC_I_BIN, OSC_B_SHR, t, ct, a, count_value); + } + } + } + } + printf("OSC_SCALAR_PARITY_PASS checks=%lu\n", checks); + return 0; +}