comptime VM arc: abi(.compiler) ABI, out as sx fn, VM-native diagnostics, BuildConfig threaded
Lands the full VM/compiler-API arc on branch reify (701/0 both gates): - abi(.compiler) ABI replaces abi(.zig) extern compiler + the fake #library "compiler"; bodiless decl = compiler-API surface, bodied = user compiler-domain fn (lowered for VM eval, emit-skipped). - out is a plain sx fn (libc write) — the out builtin deleted; the VM handles it via host-FFI. trace_resolve + interp_print_frames ported. - 4B VM-native diagnostics: 1179/1180 render proper comptime type construction failed: under strict. - S5a: build_options/set_post_link_callback on abi(.compiler) with BuildConfig threaded into the VM (green intermediate). - 0522 fixed (describe(args: []Type)); regression 0638. Strict deletion-gate down to 4 compiler_call bails (1609/1614/1615/1616) + 1654 (legitimate unresolvable-symbol diagnostic).
This commit is contained in:
@@ -57,14 +57,37 @@ with ONE welded mechanism. Branch: `reify` (off `master`). Update after every st
|
||||
> instead of `struct #compiler`; (3) delete the `compiler_call` op + `compiler_hooks.zig`
|
||||
> `HookFn`/`Registry` + the `#compiler` parse/lower path. See `PLAN-COMPILER-VM.md` Phase 4.
|
||||
>
|
||||
> **Corpus-driven remainder (independent of the BuildOptions migration):** **4A leftovers** —
|
||||
> out/print (double-output-on-fallback caveat: write directly only once the whole eval is VM-handled),
|
||||
> global_addr, trace, and `switch_br` for the Any-tag type-switch (0114/0520–0524/1035, the box_any
|
||||
> examples that now bail further at `switch_br`/`type_name`) · **4B** VM diagnostics · **4C** `#insert`.
|
||||
> Then the BuildOptions migration + **4E** bundler (+ dedicated bundle tests) + **4F** flip default +
|
||||
> delete `interp.zig`/`Value` + re-express `define`/`make_enum`.
|
||||
> Starting at **4A.1 (box_any/unbox_any)**. See `PLAN-COMPILER-VM.md` → Phase 4 for the full plan +
|
||||
> top risks (flat-pointer escape on buffer realloc; bundler test coverage).
|
||||
> **Corpus-driven remainder (independent of the BuildOptions migration):** ALL PURE ops are DONE:
|
||||
> `switch_br`, `type_name`, `error_tag_name_get`, `global_addr`, `type_is_unsigned`. **`out` DONE (2026-06-19,
|
||||
> newest Log entry):** removed the `out` builtin — it's a plain sx fn calling libc `write`, so the VM handles it
|
||||
> via host-FFI (no buffer, no special arm; no double-print because there's no `out` op to bail-then-fallback on).
|
||||
> `trace_resolve` PORTED (1035). 0613/1035/0522/1038 run VM-HANDLED. Remaining side-effect op: `interp_print_frames`
|
||||
> (1034 — writes the comptime frame chain; could likewise become a plain sx fn over the trace runtime).
|
||||
> · **4B VM diagnostics (1179/1180) — DONE** (strict renders the proper `comptime type construction failed:`
|
||||
> diagnostic; VM-gap strict bails are now ONLY the 4 `compiler_call`) · **4C** `#insert`. **BuildOptions migration — design settled +
|
||||
> foundation underway (2026-06-18, see the two newest Log entries):** `#compiler`/`compiler_call` is replaced
|
||||
> by `abi(.compiler)` (a compiler-domain ABI — runs in the comptime evaluator, never in the binary). **S1+S2
|
||||
> DONE:** `abi(.compiler)` introduced, the old `abi(.zig) extern compiler` + `#library "compiler"` fully removed,
|
||||
> all compiler-API examples migrated. **S3 DONE:** emit_llvm skips BODIED `abi(.compiler)` (compiler-domain)
|
||||
> functions; a comptime-only call from a dead body emits `undef` (regression `0638`; 701/0 both gates). The
|
||||
> earlier "runtime-reachability gating" blocker is MOOT — a compiler-domain callback isn't LLVM-emitted, so its
|
||||
> `build_options()` calls never reach the `emitCall` gate. **S4 SKIPPED (optional ergonomics):** an
|
||||
> `abi(.compiler)` function is type-compatible with a plain `() -> R` param (the ABI marks the *function*, not
|
||||
> its *type*), so callbacks/registrars just declare themselves `abi(.compiler)` (S3) — no param-propagation
|
||||
> needed. **S5a DONE:** `build_options` + `set_post_link_callback` → `abi(.compiler)`, `BuildConfig` threaded
|
||||
> into the VM; `bundle_main` + the platform registrars marked `abi(.compiler)`; strict `compiler_call` bails
|
||||
> 6→2 (0602/0603/1604/1611 HANDLED). **S5a is a GREEN INTERMEDIATE — do NOT extend it.** **DESIGN PIVOT
|
||||
> (2026-06-18, user): the 37-hook BuildOptions port is DEAD — DRIVE THE BUILD PIPELINE FROM SX** (newest Log
|
||||
> entry + `PLAN-COMPILER-VM.md` → Phase 5). `BuildConfig` becomes plain sx data; the compiler shrinks to a few
|
||||
> `abi(.compiler)` primitives (`emit_object`/`link`/queries, explicit args, `-> !` not bool) + an `on_build`
|
||||
> slot (stdlib `default_build`, user override `#run on_build = build;`). **NEXT — P5.1 (= 4E):** route the
|
||||
> post-codegen / `on_build` invocation through the VM (`core.invokeByFuncId` → VM) — REQUIRED (the sx driver
|
||||
> allocates `List`s; legacy interp can't — 0141, verified) — + dedicated bundle smoke tests. Then P5.2
|
||||
> (primitives) · P5.3 (`on_build` slot) · P5.4 (sx `default_build` + delete `#compiler`/`compiler_call`/
|
||||
> `compiler_hooks` + the S5a `build_options`/`set_post_link_callback`).
|
||||
> **FINAL atomic step (4F):** (`out` already done — VM-native via libc `write`) handle `interp_print_frames` +
|
||||
> flip strict-to-default (remove the fallback) + delete `interp.zig`/`Value` + re-express `define`/`make_enum`.
|
||||
> See `PLAN-COMPILER-VM.md` → Phase 4 for the full plan + top risks (bundler test coverage).
|
||||
> Earlier landed: dedicated `Type` builtin TypeId (`6844fb9`/`94f60c5`/`554871b`); WRITE side
|
||||
> declare_type/register_type/pointer_to VM-native (`66005af`); real lowering-time Context (`eb68d9e`);
|
||||
> metatype construction declare/define/enum_init (`d0ebc55`).
|
||||
@@ -373,6 +396,229 @@ when reached (sentinels or accessor fns; see the design doc Risks).
|
||||
`List` growth; orthogonal, see `current/CHECKPOINT-METATYPE.md`.)
|
||||
|
||||
## Log
|
||||
- **4B (VM-native diagnostics) — the metatype negative tests (1179/1180) render proper diagnostics under strict; strict gap-bails now ONLY `compiler_call` (2026-06-19).**
|
||||
The legacy and VM both BAIL on a `define()` validation failure with an identical detail string; only the
|
||||
host's STRICT rendering differed (generic "bailed on the VM (strict)" vs the proper "comptime type
|
||||
construction failed: <detail>" + span the non-strict legacy path emits). Fixed: (1) aligned the VM's `define`
|
||||
messages with the legacy's exact text — `comptime define():` (was `comptime define:`), and the duplicate
|
||||
variant/field cases now NAME the offender via a new `failFmt` helper (`'...' duplicate variant name 'value'`).
|
||||
(2) The strict type-fn path (`lower/comptime.zig`) now emits `d.addFmt(.err, span, "comptime type construction
|
||||
failed: {s}", .{vm_reason})` — the SAME diagnostic as the legacy fallback, so **1179/1180 produce their exact
|
||||
expected `.stderr` under strict with NO legacy interp involved**. Left the const-init/`#run` strict paths on
|
||||
the "bailed on the VM" wrapper ON PURPOSE — they still carry genuine VM-gap bails (`compiler_call`), so the
|
||||
burndown sweep must keep distinguishing those. **701/0 both gates.** **STRICT GAP-BAILS NOW: only the 4
|
||||
`compiler_call` (1609/1614/1615/1616 → Phase 5 sx-build-pipeline)** + 1654 (a legitimate unresolvable-symbol
|
||||
diagnostic — an asm global called at comptime; the legacy can't resolve it either; reconciles to VM wording
|
||||
at the 4F flip). So: BuildOptions/Phase 5 is the ONLY thing between the VM and a green strict sweep.
|
||||
- **`out` is now a PLAIN SX FUNCTION (libc `write`), NOT a builtin — VM handles it via host-FFI; `trace_resolve` ported; 0522 fixed (2026-06-19).**
|
||||
Per user: removed the `out` `#builtin` entirely. `library/modules/std/core.sx` now defines
|
||||
`libc_write :: (fd, [*]u8, usize) -> isize extern libc "write"` + `out :: (str: string) { libc_write(1,
|
||||
str.ptr, xx str.len); }`. Deleted `BuiltinId.out` (`inst.zig`), the `resolveBuiltin` "out" mapping
|
||||
(`call.zig`), the sema builtins-list entry (`sema.zig`), and BOTH `.out` arms (`interp.zig` buffered-append,
|
||||
`ops.zig` LLVM `write` lowering). **At comptime `out` runs through the evaluator's host-FFI** (the VM's
|
||||
dlsym `write` path / the interp's extern call) — so the VM HANDLES `out` with NO special arm. Benign prelude
|
||||
`.ir` churn (`[*]u8` interned earlier + `@out`→`@write` + the `out` fn body) → regen'd 54 `.ir` snapshots
|
||||
(verified: only string-table renumber + the intended decl/fn-body change; zero stdout/exit changes).
|
||||
**This UNMASKED two latent VM gaps the `out`-bail was hiding** (the VM now runs past `out`):
|
||||
(1) **`trace_resolve`** (1035) — PORTED to the VM (`comptime_vm.zig`): unpack the `(func_id<<32|offset)`
|
||||
comptime frame, resolve func name + `file:line:col` + source line via a **`source_map` now threaded into the
|
||||
VM** (new `tryEval` param, `&import_sources` from emit_llvm), build the `{file,line,col,func,line_text}`
|
||||
`Frame` struct in flat memory (`makeStringValue`/`writeField`/`fieldOffset`). (2) **0522** (bare-pack
|
||||
`[]Any`) — was a CRASH (`reflectArgTypeId` `@intCast` of a garbage word) → hardened to a loud bail
|
||||
(`typeIdxOf` checked cast; the VM must never panic). ROOT CAUSE: after the 0143 fix `$args` materializes as
|
||||
`[]type_value` (8-byte), but the example declared `describe(args: []Any)` (16-byte) → every element past the
|
||||
first read at the wrong stride; the legacy's loose Value model tolerated it, the byte-accurate VM didn't. The
|
||||
bare-pack elements ARE `Type`s, so the fix is the honest type — `describe(args: []Type)` (output identical).
|
||||
**Result: `out`/`trace_resolve`/the 0522 pack-reflection all run VM-HANDLED under strict** (0613/1035/0522/1038
|
||||
no longer bail). **701/0 BOTH gates + full suite.** (Build-pipeline relevance: the sx `default_build` driver
|
||||
uses `out` for diagnostics — now VM-native; no compiler `out` builtin to special-case.)
|
||||
**THEN `interp_print_frames` ported to the VM too** (1034): unlike `out` it needs the live evaluator
|
||||
call-chain, so it's a VM arm (mirrors legacy `printInterpFrames`) — walks `call_stack` (skips the last frame),
|
||||
writes ` at <name>` lines straight to fd 1 (consistent with `out`'s direct `write`). 1034 matches; 701/0.
|
||||
**STRICT DELETION-GATE NOW DOWN TO 7 (all known categories):** `compiler_call` (4 — 1609/1614/1615/1616, the
|
||||
still-`#compiler` BuildOptions accessors → Phase 5 sx-build-pipeline) · VM-diagnostic negatives (2 —
|
||||
1179/1180, the `define` bail IS the expected outcome → **4B**: surface as a proper build diagnostic) ·
|
||||
target-specific dlsym (1 — 1654, an asm global called at comptime; legacy can't resolve it either → a clean
|
||||
diagnostic, not a bug). EVERY pure + side-effect op bail is cleared.
|
||||
- **DESIGN PIVOT (2026-06-18, user) — DRIVE THE BUILD PIPELINE FROM SX; the 37-hook BuildOptions port is dead.**
|
||||
Trigger: porting each `BuildOptions` accessor to an `abi(.compiler)` fn that delegates to a `compiler_hooks`
|
||||
hook just re-encodes sx-level logic (setters/getters, `is_macos` triple-matching, list appends) as compiler
|
||||
hooks — they need NOTHING from the compiler but the `BuildConfig` state. So instead: **`BuildConfig` becomes
|
||||
plain sx data** (ordinary struct, sx-owned, no `#compiler`/hooks/shared-state/weld), and the **build pipeline
|
||||
is an sx program** — the logical end of "bundling lives in sx". The compiler shrinks to a few `abi(.compiler)`
|
||||
PRIMITIVES taking EXPLICIT args (`emit_object() -> !string`, `link(objects, output, libs, fws, flags, target)
|
||||
-> !`, metadata queries) + an `on_build : (BuildConfig) -> ! abi(.compiler)` slot (stdlib default
|
||||
`default_build`; user overrides via `#run on_build = build;`). **Chosen boundary: Option B** (compiler keeps
|
||||
the Zig linker; sx owns config+orchestration+bundle); Option A (sx shells `cc`/`ld`) is a later refinement.
|
||||
**NO bool** — failures are the error channel (`-> !`); VERIFIED on the current build: void `#run`, `-> !`/`-> !E`
|
||||
failable `#run`, and a `raise` at `#run` fails the build with a return trace (+ suggests `#run … catch (e){…}`).
|
||||
`on_build` GENERALIZES today's `post_link_callback_fn` (assignable typed global w/ default, vs a setter).
|
||||
**Full design + step plan in `PLAN-COMPILER-VM.md` → Phase 5.** **S5a (below) is a green intermediate that the
|
||||
sx-pipeline replaces wholesale** (don't extend it; P5.4 deletes `build_options`/`set_post_link_callback` +
|
||||
all `#compiler`). **NEXT — P5.1 (= 4E):** route the post-codegen / `on_build` invocation through the VM
|
||||
(`core.invokeByFuncId` → VM), REQUIRED because the sx driver allocates `List`s and the legacy interp can't
|
||||
(0141, VERIFIED: comptime `List` growth works on the VM, fails on legacy with `struct_get: base has no
|
||||
fields`). Add dedicated bundle smoke tests (no corpus coverage today). Both gates **701/0**.
|
||||
- **S5a DONE — `build_options` + `set_post_link_callback` migrated off `#compiler` onto `abi(.compiler)`; `BuildConfig` threaded into the VM (2026-06-18).**
|
||||
The corpus-covered slice of the BuildOptions migration. (1) `comptime_vm.zig` — `Vm.build_config: ?*BuildConfig`,
|
||||
threaded via a new `tryEval` param (`&self.build_config` from emit_llvm's `#run`/const-init sites; `null` at
|
||||
lowering-time type-fn). (2) Two `callCompilerFn` arms: `build_options` (returns the null-sentinel handle) +
|
||||
`set_post_link_callback` (reads the cb `func_ref`, stores `post_link_callback_fn` on the threaded `BuildConfig`).
|
||||
(3) `compiler_lib.zig` — matching legacy `handleBuildOptions`/`handleSetPostLinkCallback` (gate-OFF dual path).
|
||||
(4) `build.sx` — `build_options :: () -> BuildOptions abi(.compiler);` and `set_post_link_callback` EXTRACTED
|
||||
from the `struct #compiler` as a free `ufcs (…) abi(.compiler)` (so `opts.set_post_link_callback(cb)` still
|
||||
resolves via UFCS); the other ~38 BuildOptions methods stay `#compiler` for now. (5) Registrars/callbacks that
|
||||
call these are now compiler-domain: `platform/bundle.sx` `bundle_main :: () -> bool abi(.compiler)`, and the
|
||||
six platform examples' `configure`/`configure_build` registrars marked `abi(.compiler)`; 0602/0603 reworked
|
||||
the same way. **KEY learning:** every example transitively imports `build.sx` via the prelude, so the
|
||||
`set_post_link_callback` method→free-function change is BENIGN `.ir` churn (declaration renumber + global
|
||||
`@str`/`@tag.str` suffix shift) in all 37 examples that have `.ir` snapshots — verified line-by-line that NO
|
||||
instruction/control-flow/payload changed (only auto-numbered global-name suffixes), then regen'd those 37
|
||||
snapshots scoped with `-Dname`. **Strict-VM `compiler_call` bail set dropped 6→2:** 0602/0603/1604/1611 now
|
||||
fully VM-HANDLED; 1609/1615 still bail on the *other* (still-`#compiler`) BuildOptions methods they use →
|
||||
**S5b** (migrate the remaining ~38 setters/getters). **701/0 BOTH gates + all unit tests.**
|
||||
- **S3 DONE — emit_llvm skips BODIED `abi(.compiler)` (compiler-domain) functions; comptime-only calls emit `undef` (2026-06-18).**
|
||||
A BODIED `abi(.compiler)` function is a user compiler-domain function (post-link callback / compiler helper):
|
||||
the comptime evaluator runs its sx body, but it NEVER runs in the binary, so the backend skips it. Changes:
|
||||
(1) IR `Function` gained `is_compiler_domain: bool` (`inst.zig`). (2) `decl.zig` — new `fnIsBodilessCompiler`
|
||||
splits the API surface (bodiless → declare-only, `compiler_welded`, no implicit ctx — the S1 behavior) from a
|
||||
bodied `abi(.compiler)` function (lowers its body for VM eval; flagged `is_compiler_domain` + `is_comptime`;
|
||||
gets normal implicit-ctx). The four S1 guards now gate on `fnIsBodilessCompiler` not `fd.abi == .compiler`.
|
||||
(3) `emit_llvm.zig` — Pass 2 skips `is_compiler_domain` bodies; Pass 1 declares them EXTERNAL-linkage (an
|
||||
internal empty decl fails LLVM verification). (4) **KEY** `ops.zig` `emitCall` — a call to a comptime-only
|
||||
callee (`compiler_welded` OR `is_compiler_domain`) from a dead comptime body now emits `undef` instead of a
|
||||
real `call`; the runtime-call gate covers both. Without the undef, an AOT `sx build` left an undefined
|
||||
`_double`/`_intern` symbol — this ALSO fixed a pre-existing, untested AOT breakage of the bodiless
|
||||
compiler-API examples (the corpus runs them JIT). Diagnostic reworded "compiler-library" → "compiler-domain"
|
||||
(1185 snapshot regen'd). Regression: `examples/0638-comptime-domain-fn-not-emitted` (`double` folds a `#run`
|
||||
const → 84, absent from the binary via `nm`, JIT + AOT both run). **701/0 both gates + all unit tests.**
|
||||
**NEXT: S4** — an `abi(.compiler)` function-TYPE param (`cb: () -> bool abi(.compiler)`) flags the bound
|
||||
function compiler-domain (so a plain `bundle_main :: () -> bool { … }` becomes compiler-domain when passed to
|
||||
`set_post_link_callback`). Then S5 (BuildOptions migration + delete `#compiler`/`compiler_call`/`compiler_hooks`).
|
||||
- **S1+S2 DONE — `abi(.compiler)` replaces `abi(.zig) extern compiler` + `#library "compiler"` (clean cutover, no legacy path) (2026-06-18).**
|
||||
Per the design pivot below, and the user's "no legacy paths": REMOVED the `.zig` ABI variant entirely (`ast.ABI`
|
||||
is now `{ default, c, compiler, pure }`) and made `abi(.compiler)` the sole spelling for a compiler-domain /
|
||||
compiler-API function — the ABI alone marks it, no `extern <lib>`, no fake `#library "compiler"`. Changes:
|
||||
(1) `ast.zig` — `.zig` → `.compiler` (doc rewritten). (2) `parser.zig` — `parseOptionalAbi` accepts `.compiler`
|
||||
(drops `.zig`); a **bodiless `abi(.compiler)` decl** (ends in `;`, no `extern`) is now accepted — synthesizes
|
||||
the empty-block placeholder like an `extern` import (the Zig/VM handler is the impl). (3) `decl.zig` —
|
||||
`weldedCompilerFn` keys off `fd.abi == .compiler` + export-list membership (no `extern_lib == "compiler"`
|
||||
check); a bodiless `abi(.compiler)` decl lowers extern-like (`is_extern_decl`, and the two body-lowering paths
|
||||
`lowerFunction`/`lazyLowerFunction` skip it) so it is declared-not-defined; `funcWantsImplicitCtx` returns
|
||||
false for `abi == .compiler` (an implicit `__sx_ctx` prepend would shift args and break the handler arity —
|
||||
this was the live bug surfaced + fixed). (4) `type_resolver.zig` — the function-TYPE CC switch handles
|
||||
`.compiler` (sx-default CC). (5) Migrated ALL 8 compiler-API examples (0626/0628/0629/0630/0631/0633 + the
|
||||
1184/1185 negatives) `… abi(.zig) extern compiler;` → `… abi(.compiler);` and deleted every `compiler ::
|
||||
#library "compiler";` line; regen'd the 1184 stderr snapshot (new "not a function exported by the compiler"
|
||||
wording + shifted line). (6) Updated the two parser unit tests. **All 8 examples run HANDLED on the strict VM
|
||||
with byte-correct output; 1184 (unexported name) + 1185 (runtime call) still error cleanly; gate-OFF legacy
|
||||
still works.** **700/0 BOTH gates + all unit tests.** NOTE: the general `#library`/`extern <lib>` PARSE paths
|
||||
stay (used by `libc :: #library "c"` etc.) — only the compiler-API's USE of them is gone. `compiler_lib.lib_name`
|
||||
+ the `main.zig` dlopen-skip for a "compiler" lib are now dead defensive code (harmless; a `#library "compiler"`
|
||||
is just meaningless now). The struct-`abi(...)` parse slot is vestigial (weld stripped) — parse-only test kept.
|
||||
**NEXT: S3** — emit_llvm skips BODIED `abi(.compiler)` functions (Pass 2, like `is_extern`); thread an
|
||||
`abi(.compiler)` flag onto the IR `Function` and refine the three "today every `abi(.compiler)` fn is bodiless"
|
||||
guards in `decl.zig` (marked with `S3 NOTE`) to allow a bodied callback's body to lower for VM eval while NOT
|
||||
emitting it. Then S4 (callback-param propagation) + S5 (BuildOptions migration).
|
||||
- **DESIGN PIVOT (2026-06-18, user) — `abi(.compiler)` is the compiler-domain ABI; DROP the fake `#library "compiler"`.**
|
||||
Supersedes both the `abi(.zig) extern compiler` + `#library "compiler"` binding mechanism AND the previous
|
||||
"runtime-reachability gating" idea for the BuildOptions blocker (entry below). **The unifying concept:** a
|
||||
function is *compiler-domain* (runs in the comptime evaluator, NEVER in the shipped binary) because its **ABI
|
||||
says so** — `abi(.compiler)` — not because it's "extern" to an imaginary library. One annotation covers
|
||||
BOTH roles:
|
||||
1. **Compiler-API surface** (`intern`, `text_of`, `find_type`, `declare_type`, `register_type`,
|
||||
`build_options`, `set_post_link_callback`, …): bodiless `abi(.compiler)` decls (the Zig/VM handler IS the
|
||||
impl). Replaces `… abi(.zig) extern compiler;` + the `compiler :: #library "compiler";` line — both GO AWAY.
|
||||
2. **User compiler-domain functions** (post-link callbacks like `platform.bundle.bundle_main`): BODIED
|
||||
`abi(.compiler)` functions. emit_llvm does NOT lower them (skip in Pass 2, like `is_extern`); the comptime
|
||||
VM/interp evaluates them. A callback PARAM type carries it too — `set_post_link_callback(self, cb: () -> bool
|
||||
abi(.compiler))` — so the bound function is flagged compiler-domain.
|
||||
**Why this dissolves the BuildOptions blocker:** the welded-call enforcement (`ops.zig` `emitCall`) only fired
|
||||
because comptime-only callback bodies (`bundle_main`, 0602's `configure`) were being LLVM-emitted. A bodied
|
||||
`abi(.compiler)` function is never emitted → its `build_options()`/`binary_path()` calls never reach `emitCall`
|
||||
as runtime code → no enforcement, no undefined-symbol risk. **1185 stays correct**: `main` is an ordinary
|
||||
runtime fn (not `abi(.compiler)`) calling a compiler-domain fn → still a clean build-gating error. (The
|
||||
registrar half is independently fine via the idiomatic `#run { … }` block — the welded calls sit in the
|
||||
`is_comptime` `__run` wrapper; 0602/0603 only tripped via an intermediate `configure()`, a test-shape artifact.)
|
||||
**Staged plan (each its own step, both gates green):**
|
||||
- **S1 — introduce `abi(.compiler)`** as a new `ABI` variant that marks a function `compiler_welded` (export-list
|
||||
checked) WITHOUT requiring `extern compiler`/`#library`. Add it ALONGSIDE the existing `.zig extern compiler`
|
||||
path so migration is incremental; prove with one example (0626 → `abi(.compiler)`). (`.zig` is a misnomer —
|
||||
"we don't really have a zig abi"; it becomes `.compiler`, ultimately replacing `.zig` once all callers move.)
|
||||
- **S2 — migrate the rest of the compiler-API decls** (0628–0633, 1184/1185) to `abi(.compiler)`; drop the
|
||||
`#library "compiler"` lines; regen snapshots (the 1184 unexported-name + 1185 runtime-call diagnostics must
|
||||
stay red with refreshed wording). Then retire the `.zig extern compiler` parse path + `#library "compiler"`.
|
||||
- **S3 — emit_llvm skips bodied `abi(.compiler)` functions** (Pass 2 `continue`, like `is_extern`); thread the
|
||||
`abi(.compiler)` flag onto the IR `Function`. Prove a bodied compiler-domain function isn't emitted.
|
||||
- **S4 — callback-param propagation**: an `abi(.compiler)` function-type PARAM flags the bound function
|
||||
compiler-domain.
|
||||
- **S5 — BuildOptions migration** (now unblocked): `build_options`/`set_post_link_callback`/… become
|
||||
`abi(.compiler)` (+ VM `callCompilerFn` arms / legacy `compiler_lib` handlers; `BuildConfig` threaded into the
|
||||
VM — the bundler 4E shares this); callbacks declared/typed `abi(.compiler)`; delete `#compiler`/`compiler_call`/
|
||||
`compiler_hooks` Registry. Then **4E** bundler on the VM.
|
||||
**Reusable facts from the reverted attempt:** only `build.sx` uses `#compiler`; VM dual-path bail-to-fallback
|
||||
means the VM needs only corpus-covered fns; UFCS on a free fn needs the `ufcs` marker (composes with the ABI
|
||||
annotation); the binding mechanism currently lives in `decl.zig` `weldedCompilerFn` (keys off `extern_lib ==
|
||||
"compiler"` — S1 makes it key off `abi == .compiler`). Mechanism files: `ast.zig` (`ABI` enum), `parser.zig`
|
||||
(`parseOptionalAbi` + the extern-compiler postfix), `decl.zig` (`weldedCompilerFn`), `compiler_lib.zig`
|
||||
(export list), `comptime_vm.zig` (`callCompilerFn`), `emit_llvm.zig` (Pass-2 skip), `ops.zig` (`emitCall` gate).
|
||||
- **Phase 4 — BuildOptions→`abi(.zig) extern compiler` migration ATTEMPTED, then REVERTED; BLOCKER found: the comptime-only welded-call enforcement (2026-06-18).**
|
||||
Scoped an incremental slice (migrate only the corpus-covered `build_options()` + `set_post_link_callback`,
|
||||
leaving the 38 bundler accessors on `#compiler` → VM bails → legacy fallback). Built it end-to-end:
|
||||
threaded `BuildConfig` into the `Vm` (`tryEval` gained a `?*BuildConfig` param, passed `&self.build_config`
|
||||
from emit_llvm's `#run`/const-init sites); added `callCompilerFn` arms + legacy `compiler_lib` bound-handlers
|
||||
for both; rewrote `build.sx` (`build_options` → `abi(.zig) extern compiler`; extracted `set_post_link_callback`
|
||||
out of the `struct #compiler` as a free `ufcs (...) abi(.zig) extern compiler` fn so `opts.set_post_link_callback(cb)`
|
||||
still resolves via UFCS; added `compiler :: #library "compiler";`). All COMPILED and the welded dispatch
|
||||
fired. **BLOCKED at LLVM emission, NOT a bug — a design limitation the migration surfaces:** a
|
||||
`compiler_welded` call inside a NON-`is_comptime` function is a hard build-gating error (`ops.zig`
|
||||
`emitCall`, the Phase-1 enforcement guarding genuine runtime misuse — example 1185). But the post-link
|
||||
callback idiom calls comptime-only-API functions (`build_options()`, `binary_path()`, `bundle_path()`, …)
|
||||
**inside callback bodies** (`platform/bundle.sx`'s `bundle_main :: () -> bool`, and 0602's `configure`) that
|
||||
run ONLY at comptime (post-link interp/VM) yet are still LLVM-emitted as real `() -> bool` bodies. The OLD
|
||||
`#compiler`/`compiler_call` path emitted those as dead `undef` (`emitCompilerCall`), so no error; the welded
|
||||
enforcement instead halts the build, and it CANNOT distinguish a dead comptime-reachable body from genuine
|
||||
runtime use (1185, reachable from `main`) without runtime-reachability analysis. **Reverted the whole attempt**
|
||||
(kept only the green pure-ops work); both gates back to **700/0**. **THE DECISION the next session must make
|
||||
FIRST (before any BuildOptions migration):** how to emit a welded call in a comptime-only-but-LLVM-emitted
|
||||
function. Recommended path **A — runtime-reachability gating:** in `emit_llvm`, mark functions reachable from
|
||||
runtime roots (`main` / exported runtime fns); a welded call in an UNREACHABLE function emits `undef` (dead,
|
||||
like `compiler_call` did) instead of erroring, while a reachable one still errors (1185 stays red). This is
|
||||
also the right foundation for eventually NOT emitting comptime-only bodies at all. Rejected: (B) marking
|
||||
callbacks `is_comptime` — can't statically identify which `func_ref`s become post-link callbacks; (C) blanket
|
||||
softening to `undef` — would silently swallow genuine runtime misuse (1185). **Other migration facts confirmed
|
||||
this attempt (reuse next session):** only `build.sx` uses `#compiler` (the `issues/*.md` hits are doc text);
|
||||
the VM dual-path bail-to-fallback means the VM needs only the corpus-covered fns, the 38 bundler accessors can
|
||||
ride legacy; UFCS on a free fn requires the `ufcs` marker, which composes with `abi(.zig) extern compiler`;
|
||||
`build.sx` must declare `compiler :: #library "compiler";`. Do the reachability fix as its OWN step (verify
|
||||
1185 still errors + a comptime-only-body welded call now emits clean), THEN redo the BuildOptions slice on top.
|
||||
- **Phase 4 burndown — three PURE comptime ops ported (`error_tag_name_get` + `global_addr` + `type_is_unsigned`); `interp_print_frames` correctly DEFERRED (2026-06-18).**
|
||||
Also ported `type_is_unsigned` (a `BuiltinId` via `callBuiltinVm`): resolves the queried `TypeId` the
|
||||
same way as `type_name` (a `.type_value` word, or an Any box `{tag@0,value@8}` whose tag IS the boxed
|
||||
value's type) then returns `table.isUnsignedInt(tid)`. Extracted the shared resolution into a
|
||||
`reflectArgTypeId` helper (VM-native `Value.reflectTypeId` mirror) so `type_name` + `type_is_unsigned`
|
||||
can't drift. MATCH-verified by a new VM unit test (`type_is_unsigned(u32) - type_is_unsigned(i64) == 1`).
|
||||
Strict sweep: 0600 `type_is_unsigned`→`out` (now its only remaining bail); no `type_is_unsigned` bails
|
||||
remain in the corpus. **With this, all PURE comptime ops are ported** — the remaining strict bails are
|
||||
side-effect (`out`/`interp_print_frames`), `compiler_call` (the BuildOptions migration), VM diagnostics
|
||||
(1179/1180), and `#insert`/bundler.
|
||||
Ported two side-effect-free ops onto the VM (`comptime_vm.zig` exec switch): (1) `error_tag_name_get`
|
||||
— a runtime tag-id word → its name string via `table.getTagName` + `makeStringValue` (uses the table,
|
||||
not the module, so it's unit-testable; `self.table == &module.types`); (2) `global_addr` — name-matches
|
||||
`__sx_default_context` and returns the already-tested `materializeDefaultContext` Addr (an aggregate
|
||||
value IS its address, so a downstream `load` sees the materialised Context), bailing for any other
|
||||
global exactly like legacy. **MATCH verification:** `error_tag_name_get` locked in by a new VM unit
|
||||
test (tag id → `"Bad"`, via `regToValue`); `global_addr` proven by the strict sweep (0600's first bail
|
||||
moved past it) and reuses `materializeDefaultContext`, already exercised by every implicit-ctx comptime
|
||||
call on the VM. **KEY CORRECTION to the handover's "three PURE ops" plan:** `interp_print_frames`
|
||||
(1034) is NOT pure — it WRITES the comptime call-frame chain to the build output, a side effect in the
|
||||
SAME bucket as `out` (the VM has no output buffer; output is direct-write, so a print-then-bail
|
||||
double-prints under the legacy fallback). It must land atomically in the FINAL `out`/strict-default
|
||||
step, NOT now. **Strict-sweep burndown:** 1035 `error_tag_name_get`→`out`; 0600 `global_addr`→
|
||||
`type_is_unsigned` (a NEW pure-op bail surfaced — still a known pure op, next to port); 1034 stays at
|
||||
`interp_print_frames` (deferred, as it should). Also fixed the stale `comptime_vm.zig` header comment
|
||||
(it still said "bump/stack allocator"; the memory model is an ARENA of stable host allocations since
|
||||
4D.0). **700/0 BOTH gates + all unit tests.** On `reify`.
|
||||
- **Phase 4 burndown — issue 0143 FIXED (pack-as-`[]Type` stride) + regression test (2026-06-18).**
|
||||
Root cause was a stale consequence of the `.type_value` migration: `buildPackSliceValue`
|
||||
(`lower/pack.zig`) materialized a bare `$<pack>` `[]Type` slice as `[]Any` (16-byte elements) while
|
||||
|
||||
@@ -416,18 +416,98 @@ are legitimate negative-test bails that BECOME VM diagnostics, 1145 is a scan ar
|
||||
untouched); `4D.2` (`6a7f690`) adds slice/string args (→ NUL-term `char*`) + float guards.
|
||||
Examples 0636/0637. **(Superseded sub-note:** the earlier "pin the buffer / flat↔host translate"
|
||||
hazard is moot — the arena never moves an allocation.)
|
||||
- **`#compiler` / `compiler_call` — NOT bridged on the VM. DELETED, not ported (decision
|
||||
2026-06-18).** `BuildOptions` is RE-EXPRESSED as **`abi(.zig) extern compiler`** functions (the
|
||||
compiler-API surface the VM already dispatches via `callCompilerFn`), and the `#compiler` struct
|
||||
attribute + the `compiler_call` IR op + the `Value`-based hook `Registry` (`compiler_hooks.zig`)
|
||||
all **go away**. So there is NO transitional `compiler_call`→hooks shim on the VM — `0602`/`0603`
|
||||
stay on legacy fallback until this migration lands. Migration shape (part of the end state, with
|
||||
the bundler): (1) each `BuildOptions` setter/getter becomes a `compiler` function in
|
||||
`compiler_lib.bound_fns` + `Vm.callCompilerFn`, reading flat-memory args + a **`BuildConfig`
|
||||
threaded into the VM** (the same `BuildConfig` `main.zig` forwards); (2) `library/modules/build.sx`
|
||||
declares them `abi(.zig) extern compiler` instead of `struct #compiler`; (3) delete the
|
||||
`compiler_call` op, `compiler_hooks.zig`'s `HookFn`/`Registry`, and the `#compiler` parse/lower
|
||||
path. The `BuildConfig` threading is the shared prerequisite with the bundler (4E).
|
||||
- **`#compiler` / `compiler_call` — DELETED, replaced by the `abi(.compiler)` ABI (decision 2026-06-18,
|
||||
REVISED from the earlier `abi(.zig) extern compiler` shape).** A function is *compiler-domain* — it runs in
|
||||
the comptime evaluator (VM/interp), NEVER in the shipped binary — because its **ABI says so**: `abi(.compiler)`.
|
||||
No `extern <lib>`, no fake `#library "compiler"`. One annotation covers BOTH roles: (a) the **compiler-API
|
||||
surface** (`intern`/`find_type`/`build_options`/`set_post_link_callback`/… — bodiless decls whose Zig/VM
|
||||
handler is the impl, on `compiler_lib`'s export list, dispatched by `Vm.callCompilerFn`); (b) **user
|
||||
compiler-domain functions** like post-link callbacks (`bundle_main` — BODIED `abi(.compiler)`, lowered for VM
|
||||
eval but emit-skipped). The `#compiler` struct attribute + the `compiler_call` IR op + the `Value`-based hook
|
||||
`Registry` (`compiler_hooks.zig`) all **go away**. **Why this is cleaner than the welded-fn approach:** the
|
||||
former runtime-call enforcement blocker (a `build_options()` call inside an LLVM-emitted callback body) is
|
||||
MOOT — a compiler-domain function is never emitted, so its compiler-API calls never reach `emitCall`.
|
||||
**Staged build (each its own step, both gates green):**
|
||||
- **S1+S2 — DONE (2026-06-18):** introduced `abi(.compiler)`, REMOVED the `.zig` ABI + `abi(.zig) extern
|
||||
compiler` + `#library "compiler"` (clean cutover, no legacy); migrated all compiler-API examples. The
|
||||
binding now keys off `fd.abi == .compiler` (`decl.zig` `weldedCompilerFn`); a bodiless `abi(.compiler)`
|
||||
decl lowers extern-like (declared-not-defined) with no implicit ctx. **700/0 both gates.**
|
||||
- **S3 — DONE (2026-06-18):** emit_llvm skips BODIED `abi(.compiler)` function bodies. Added an
|
||||
`is_compiler_domain` flag to the IR `Function`; a bodied `abi(.compiler)` function LOWERS its body (for VM
|
||||
eval) + is flagged `is_comptime` but is NOT emitted (Pass 2 skip; declared external-linkage so the empty
|
||||
decl verifies). KEY fix: a call to a comptime-only callee (compiler-API `compiler_welded` OR
|
||||
`is_compiler_domain`) inside a dead comptime body now emits `undef` instead of a real `call` (`ops.zig`
|
||||
`emitCall`) — the old `compiler_call` did this; without it an AOT link leaves an undefined `_double`/`_intern`
|
||||
reference (this also fixed a pre-existing untested AOT breakage of the bodiless compiler-API examples).
|
||||
`fnIsBodilessCompiler` distinguishes the API surface (declare-only) from a compiler-domain callback (lowered,
|
||||
emit-skipped). Regression: `examples/0638-comptime-domain-fn-not-emitted` (`double` folds a `#run` const,
|
||||
absent from the binary, JIT+AOT). **701/0 both gates.**
|
||||
- **S4 — callback-param propagation: OPTIONAL / DEFERRED (ergonomics only).** Verified 2026-06-18: an
|
||||
`abi(.compiler)` function is TYPE-compatible with a plain `() -> R` param (the ABI marks the *function* —
|
||||
`is_compiler_domain` — not its *type*, which stays `() -> R` CC-default). So a callback that needs to be
|
||||
compiler-domain just declares itself `abi(.compiler)` (S3) and passes to a plain param fine; auto-propagation
|
||||
from an `abi(.compiler)` PARAM type is a nicety, not a prerequisite for S5. Skipped for now.
|
||||
- **S5a — DONE (2026-06-18):** the corpus-covered slice. `build_options` + `set_post_link_callback` →
|
||||
free `abi(.compiler)` functions (VM `callCompilerFn` arms + legacy `compiler_lib` handlers); **`BuildConfig`
|
||||
threaded into the VM** via a `tryEval` param (the same one `main.zig` forwards — shared with 4E). `build.sx`
|
||||
extracts `set_post_link_callback` from the `struct #compiler` as a free `ufcs` fn; `bundle_main` + the
|
||||
platform registrars (`configure`) are `abi(.compiler)`. 37 examples' `.ir` snapshots regen'd (benign:
|
||||
declaration renumber + `@str` suffix shift — every example imports build.sx via the prelude). Strict
|
||||
`compiler_call` bails 6→2; 0602/0603/1604/1611 HANDLED. **701/0 both gates.**
|
||||
- **S5b/S5c (port the ~37 hooks) — SUPERSEDED 2026-06-18 by the sx-driven build pipeline (below).**
|
||||
Porting each `BuildOptions` accessor to an `abi(.compiler)` function that delegates to a `compiler_hooks`
|
||||
hook just re-encodes sx-level logic (string setters/getters, `is_macos` triple-matching, list appends) as
|
||||
compiler hooks. The hooks need NOTHING from the compiler except the `BuildConfig` state. So instead of 37
|
||||
hooks, **drive the whole build pipeline from sx** (the logical end of "bundling lives in sx"). S5a stays as
|
||||
a green intermediate; the sx-build-pipeline replaces `build_options`/`set_post_link_callback`/the whole
|
||||
`#compiler` surface wholesale.
|
||||
|
||||
### Phase 5 — sx-driven build pipeline (replaces the BuildOptions hooks; decision 2026-06-18, user)
|
||||
|
||||
**The build pipeline becomes an sx program.** `BuildConfig` is plain sx data (an ordinary struct, sx-owned
|
||||
end-to-end — no `#compiler`, no hooks, no shared Zig state, no weld/offset access). The compiler shrinks to
|
||||
a few `abi(.compiler)` PRIMITIVES that take **explicit args** (so nothing is shared by memory), and an sx
|
||||
`build()` driver orchestrates configure → emit → link → bundle. **Chosen boundary: Option B** — the compiler
|
||||
keeps the proven Zig linker as a primitive; sx owns config + orchestration + bundle. (Option A — sx shells
|
||||
`cc`/`ld` itself — is a later refinement once the per-target link-line logic is ported to sx.)
|
||||
|
||||
Shape (all syntax verified on the current build 2026-06-18 — void `#run`, `-> !` / `-> !E` failable `#run`,
|
||||
a `raise` at `#run` fails the build with a return trace):
|
||||
```sx
|
||||
// library/modules/std/build.sx (stdlib)
|
||||
BuildErr :: error { EmitFailed, LinkFailed, BundleFailed }
|
||||
BuildConfig :: struct { output: string; target: string; flags: List(string);
|
||||
frameworks: List(string); bundle_path: string; bundle_id: string;
|
||||
is_macos :: (self: *BuildConfig) -> bool { ... }
|
||||
add_framework :: (self: *BuildConfig, n: string) { self.frameworks.append(n); } }
|
||||
// compiler primitives — explicit args, failure on the error channel (NO bool):
|
||||
emit_object :: () -> !string abi(.compiler); // IR → .o path
|
||||
link :: (objects: List(string), output: string, libraries: List(string),
|
||||
frameworks: List(string), flags: List(string), target: string) -> ! abi(.compiler);
|
||||
c_object_paths :: () -> List(string) abi(.compiler); // metadata queries
|
||||
link_libraries :: () -> List(string) abi(.compiler);
|
||||
default_build :: (config: BuildConfig) -> ! abi(.compiler) { // the default pipeline
|
||||
obj := try emit_object(); objs := c_object_paths(); objs.append(obj);
|
||||
try link(objs, config.output, link_libraries(), config.frameworks, config.flags, config.target);
|
||||
if config.bundle_path.len > 0 { try bundle_app(config); } } // bundle_app = today's sx bundler
|
||||
on_build : (BuildConfig) -> ! abi(.compiler) = default_build; // the override slot
|
||||
// user overrides: build :: (config: BuildConfig) -> ! abi(.compiler) { ... } #run on_build = build;
|
||||
```
|
||||
The compiler's whole post-IR role: codegen → build the CLI-derived `BuildConfig` → read `on_build` → invoke
|
||||
`on_build(config)` on the VM; a `raise` fails the build. Plain `sx run` fires none of it.
|
||||
|
||||
**Steps (each its own green step; depends on 4E first):**
|
||||
- **P5.1 — 4E prereq:** route the post-codegen / `on_build` invocation through the **VM** (`core.invokeByFuncId`
|
||||
→ VM). REQUIRED because the driver allocates (`List`) and the legacy interp can't (0141 — verified: comptime
|
||||
`List` growth works on the VM, fails on legacy). Add dedicated bundle smoke tests (no corpus coverage today).
|
||||
- **P5.2 — primitives:** expose `emit_object` + `link` (reuse `target.zig` linker) + metadata queries
|
||||
(`c_object_paths`/`link_libraries`/host-triple) as `abi(.compiler)` fns taking explicit args.
|
||||
- **P5.3 — `on_build` slot:** a comptime-assignable compiler slot (GENERALIZES today's `post_link_callback_fn`:
|
||||
an assignable typed global with a stdlib default, vs a setter). `#run on_build = build;` captures the
|
||||
`FuncId`; the compiler invokes it post-codegen with the CLI-derived `BuildConfig`.
|
||||
- **P5.4 — sx `default_build` + `BuildConfig`:** write the stdlib pipeline; move config/orchestration into sx.
|
||||
**Delete** `#compiler` / `compiler_call` / `compiler_hooks` (`HookFn`/`Registry`) + the S5a
|
||||
`build_options`/`set_post_link_callback` (config is now sx data passed as primitive args).
|
||||
- **4E — post-link bundler on the VM (role C).** Depends on the FFI escape (done) + the
|
||||
`BuildConfig`-on-the-VM threading above. Route `core.invokeByFuncId` / `main.zig`'s post-link
|
||||
call through the VM. **No corpus coverage** (only runs on `sx build --bundle/--apk`) — add
|
||||
@@ -440,11 +520,12 @@ are legitimate negative-test bails that BECOME VM diagnostics, 1145 is a scan ar
|
||||
VM-native `callCompilerFn`); re-express `define`/`make_enum` as sx over the compiler-API
|
||||
(allocation works on the sole evaluator) and land the original 0141 repro as a corpus test.
|
||||
|
||||
**Dependencies:** 4A → (4B, 4C independent) ; FFI(done)+`BuildConfig`-on-VM → (BuildOptions
|
||||
migration, 4E) → 4F.
|
||||
**Dependencies:** 4A → (4B, 4C independent) ; `abi(.compiler)` S1+S2(done) → S3 → S4 → S5 (BuildOptions) ;
|
||||
FFI(done)+`BuildConfig`-on-VM → (S5, 4E) → 4F.
|
||||
**Top risks:** (1) the bundler has no corpus guard (4E needs dedicated tests); (2) deleting
|
||||
`#compiler`/`compiler_call` + re-expressing `BuildOptions` over the compiler-API touches the whole
|
||||
build/bundle path — stage it behind real bundle builds.
|
||||
`#compiler`/`compiler_call` + re-expressing `BuildOptions` over the compiler-API (`abi(.compiler)`) touches the
|
||||
whole build/bundle path — stage it behind real bundle builds; (3) S3's emit-skip relies on DCE dropping the
|
||||
unreferenced compiler-domain declaration — verify no stray runtime reference keeps it alive (link error).
|
||||
|
||||
## Open questions (resolve as reached, record decisions here)
|
||||
|
||||
|
||||
@@ -19,10 +19,16 @@
|
||||
// carries `const_type` elements that only the interp materialises;
|
||||
// LLVM emission leaves the per-element slots as undef (4A.bare
|
||||
// semantics — bare-pack is comptime-only).
|
||||
//
|
||||
// The element type is `[]Type` (a bare `$args` is the list of the
|
||||
// pack args' TYPES, each an 8-byte `.type_value`). Declaring it
|
||||
// `[]Any` (16-byte boxes) read every element past the first at the
|
||||
// wrong stride — the legacy interp's loose Value model tolerated it,
|
||||
// the byte-accurate comptime VM does not.
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
describe :: (args: []Any) -> string {
|
||||
describe :: (args: []Type) -> string {
|
||||
s := "[";
|
||||
i : i64 = 0;
|
||||
while i < args.len {
|
||||
|
||||
@@ -23,7 +23,10 @@ post_link :: () -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
configure :: () {
|
||||
// The registrar is itself compiler-domain (`abi(.compiler)`): it runs in the
|
||||
// comptime evaluator (never the binary), so its `build_options()` /
|
||||
// `set_post_link_callback()` compiler-API calls are permitted.
|
||||
configure :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
opts.set_post_link_callback(post_link);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,10 @@ cb :: () -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
configure :: () {
|
||||
// The registrar is itself compiler-domain (`abi(.compiler)`): it runs in the
|
||||
// comptime evaluator (never the binary), so its `build_options()` /
|
||||
// `set_post_link_callback()` compiler-API calls are permitted.
|
||||
configure :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
opts.set_post_link_callback(cb);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Comptime compiler API — welded compiler FUNCTIONS over the host-call bridge.
|
||||
//
|
||||
// `intern` / `text_of` are bound to the `compiler` library via
|
||||
// `abi(.zig) extern compiler`. They have no real symbol — under the comptime
|
||||
// `abi(.compiler)`. They have no real symbol — under the comptime
|
||||
// interpreter the call dispatches to the compiler's registered Zig handler
|
||||
// (the string pool), never dlsym. Comptime-only: here they run inside `#run`,
|
||||
// folding to a plain string constant the runtime `main` prints.
|
||||
@@ -11,11 +11,10 @@
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
compiler :: #library "compiler";
|
||||
|
||||
StringId :: u32;
|
||||
intern :: (s: string) -> StringId abi(.zig) extern compiler;
|
||||
text_of :: (id: StringId) -> string abi(.zig) extern compiler;
|
||||
intern :: (s: string) -> StringId abi(.compiler);
|
||||
text_of :: (id: StringId) -> string abi(.compiler);
|
||||
|
||||
greeting :: #run text_of(intern("hello, compiler"));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Comptime compiler API — read-only reflection readers (Phase 3).
|
||||
//
|
||||
// `find_type` / `type_field_count` are bound to the `compiler` library via
|
||||
// `abi(.zig) extern compiler`, joining the `intern` / `text_of` seed. They are
|
||||
// `abi(.compiler)`, joining the `intern` / `text_of` seed. They are
|
||||
// the first REFLECTION readers: the compiler exposes its own type table to
|
||||
// comptime sx as plain handles (a `TypeId` is a u32, like a `StringId`), so the
|
||||
// calls are clean scalar host-calls — handle in, scalar out, no marshaling.
|
||||
@@ -14,14 +14,13 @@
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
compiler :: #library "compiler";
|
||||
|
||||
StringId :: u32;
|
||||
TypeId :: u32;
|
||||
|
||||
intern :: (s: string) -> StringId abi(.zig) extern compiler;
|
||||
find_type :: (name: StringId) -> TypeId abi(.zig) extern compiler;
|
||||
type_field_count :: (t: TypeId) -> i64 abi(.zig) extern compiler;
|
||||
intern :: (s: string) -> StringId abi(.compiler);
|
||||
find_type :: (name: StringId) -> TypeId abi(.compiler);
|
||||
type_field_count :: (t: TypeId) -> i64 abi(.compiler);
|
||||
|
||||
Point :: struct { x: i64; y: i64; z: i64; }
|
||||
|
||||
|
||||
@@ -15,18 +15,17 @@
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
compiler :: #library "compiler";
|
||||
|
||||
StringId :: u32;
|
||||
TypeId :: u32;
|
||||
|
||||
intern :: (s: string) -> StringId abi(.zig) extern compiler;
|
||||
text_of :: (id: StringId) -> string abi(.zig) extern compiler;
|
||||
find_type :: (name: StringId) -> TypeId abi(.zig) extern compiler;
|
||||
type_field_count :: (t: TypeId) -> i64 abi(.zig) extern compiler;
|
||||
type_nominal_name :: (t: TypeId) -> StringId abi(.zig) extern compiler;
|
||||
type_field_name :: (t: TypeId, idx: i64) -> StringId abi(.zig) extern compiler;
|
||||
type_field_type :: (t: TypeId, idx: i64) -> TypeId abi(.zig) extern compiler;
|
||||
intern :: (s: string) -> StringId abi(.compiler);
|
||||
text_of :: (id: StringId) -> string abi(.compiler);
|
||||
find_type :: (name: StringId) -> TypeId abi(.compiler);
|
||||
type_field_count :: (t: TypeId) -> i64 abi(.compiler);
|
||||
type_nominal_name :: (t: TypeId) -> StringId abi(.compiler);
|
||||
type_field_name :: (t: TypeId, idx: i64) -> StringId abi(.compiler);
|
||||
type_field_type :: (t: TypeId, idx: i64) -> TypeId abi(.compiler);
|
||||
|
||||
Point :: struct { x: i64; y: i64; }
|
||||
Pair :: struct { lo: Point; hi: Point; }
|
||||
|
||||
@@ -14,17 +14,16 @@
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
compiler :: #library "compiler";
|
||||
|
||||
StringId :: u32;
|
||||
TypeId :: u32;
|
||||
|
||||
intern :: (s: string) -> StringId abi(.zig) extern compiler;
|
||||
text_of :: (id: StringId) -> string abi(.zig) extern compiler;
|
||||
find_type :: (name: StringId) -> TypeId abi(.zig) extern compiler;
|
||||
type_kind :: (t: TypeId) -> i64 abi(.zig) extern compiler;
|
||||
type_field_name :: (t: TypeId, idx: i64) -> StringId abi(.zig) extern compiler;
|
||||
type_field_value :: (t: TypeId, idx: i64) -> i64 abi(.zig) extern compiler;
|
||||
intern :: (s: string) -> StringId abi(.compiler);
|
||||
text_of :: (id: StringId) -> string abi(.compiler);
|
||||
find_type :: (name: StringId) -> TypeId abi(.compiler);
|
||||
type_kind :: (t: TypeId) -> i64 abi(.compiler);
|
||||
type_field_name :: (t: TypeId, idx: i64) -> StringId abi(.compiler);
|
||||
type_field_value :: (t: TypeId, idx: i64) -> i64 abi(.compiler);
|
||||
|
||||
Color :: enum { red; green; blue; }
|
||||
WindowFlags :: enum flags u32 { vsync :: 64; resizable :: 4; hidden :: 128; }
|
||||
|
||||
@@ -19,19 +19,18 @@
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
compiler :: #library "compiler";
|
||||
|
||||
Member :: struct { name: string; ty: Type; }
|
||||
|
||||
StringId :: u32;
|
||||
TypeId :: u32;
|
||||
|
||||
intern :: (s: string) -> StringId abi(.zig) extern compiler;
|
||||
find_type :: (name: StringId) -> TypeId abi(.zig) extern compiler;
|
||||
type_kind :: (t: TypeId) -> i64 abi(.zig) extern compiler;
|
||||
declare_type :: (name: string) -> Type abi(.zig) extern compiler;
|
||||
pointer_to :: (t: Type) -> Type abi(.zig) extern compiler;
|
||||
register_type :: (handle: Type, kind: i64, members: []Member) -> Type abi(.zig) extern compiler;
|
||||
intern :: (s: string) -> StringId abi(.compiler);
|
||||
find_type :: (name: StringId) -> TypeId abi(.compiler);
|
||||
type_kind :: (t: TypeId) -> i64 abi(.compiler);
|
||||
declare_type :: (name: string) -> Type abi(.compiler);
|
||||
pointer_to :: (t: Type) -> Type abi(.compiler);
|
||||
register_type :: (handle: Type, kind: i64, members: []Member) -> Type abi(.compiler);
|
||||
|
||||
KIND_ENUM :: 2; // an ACTUAL payloadless enum
|
||||
KIND_TAGGED_UNION :: 3; // a payload-carrying enum
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// A module that MINTS a comptime enum via the compiler API and exports it.
|
||||
#import "modules/std.sx";
|
||||
|
||||
compiler :: #library "compiler";
|
||||
|
||||
Member :: struct { name: string; ty: Type; }
|
||||
declare_type :: (name: string) -> Type abi(.zig) extern compiler;
|
||||
register_type :: (handle: Type, kind: i64, members: []Member) -> Type abi(.zig) extern compiler;
|
||||
declare_type :: (name: string) -> Type abi(.compiler);
|
||||
register_type :: (handle: Type, kind: i64, members: []Member) -> Type abi(.compiler);
|
||||
|
||||
build_suit :: () -> Type {
|
||||
return register_type(declare_type("Suit"), 2, .[ // kind 2 = actual enum
|
||||
|
||||
16
examples/0638-comptime-domain-fn-not-emitted.sx
Normal file
16
examples/0638-comptime-domain-fn-not-emitted.sx
Normal file
@@ -0,0 +1,16 @@
|
||||
// A BODIED `abi(.compiler)` function is a compiler-domain function: the comptime
|
||||
// evaluator runs its sx body, but it is NEVER lowered into the shipped binary
|
||||
// (emit_llvm skips it, like an extern). Here `double` folds the `#run` const at
|
||||
// compile time; `main` only ever sees the folded constant, and no `double` symbol
|
||||
// exists in the binary. (Regression for the S3 step of the abi(.compiler) work —
|
||||
// see current/PLAN-COMPILER-VM.md.)
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
double :: (x: i64) -> i64 abi(.compiler) { x * 2 }
|
||||
|
||||
answer :: #run double(42);
|
||||
|
||||
main :: () {
|
||||
print("answer = {}\n", answer);
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
// Diagnostic: a `fn abi(.zig) extern compiler` whose name is NOT on the compiler
|
||||
// Diagnostic: a `fn abi(.compiler)` whose name is NOT on the compiler
|
||||
// library's function-export list is a build error — the export list is the
|
||||
// safety boundary, so an unbound name can't silently fall through to dlsym.
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
compiler :: #library "compiler";
|
||||
|
||||
not_a_real_compiler_fn :: (x: i64) -> i64 abi(.zig) extern compiler;
|
||||
not_a_real_compiler_fn :: (x: i64) -> i64 abi(.compiler);
|
||||
|
||||
main :: () { print("unreached\n"); }
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
compiler :: #library "compiler";
|
||||
|
||||
StringId :: u32;
|
||||
intern :: (s: string) -> StringId abi(.zig) extern compiler;
|
||||
intern :: (s: string) -> StringId abi(.compiler);
|
||||
|
||||
main :: () {
|
||||
id := intern("called at runtime");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Methods on it (add_link_flag, set_output_path) are compiler builtins
|
||||
// that configure the build without runtime cost.
|
||||
|
||||
configure_build :: () {
|
||||
configure_build :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
// These calls are intercepted by the compiler at compile time.
|
||||
// On a normal (non-wasm) target, inline if gates them off.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#import "modules/std.sx";
|
||||
#import "modules/build.sx";
|
||||
|
||||
configure_build :: () {
|
||||
configure_build :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
opts.add_framework("CoreFoundation");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ post_link :: () -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
configure :: () {
|
||||
configure :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
opts.set_post_link_callback(post_link);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// binary. Under `sx run` (JIT) the callback is registered but never
|
||||
// fires — so the test runner only sees `runtime main`.
|
||||
|
||||
configure :: () {
|
||||
configure :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
opts.set_bundle_path("HelloApp.app");
|
||||
opts.set_bundle_id("co.example.hello");
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// UIApplicationSceneManifest, DTPlatformName=iPhoneSimulator). Ad-hoc
|
||||
// codesign; no provisioning embed needed for the simulator.
|
||||
|
||||
configure :: () {
|
||||
configure :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
opts.set_bundle_path("IosSimApp.app");
|
||||
opts.set_bundle_id("co.example.iossim");
|
||||
|
||||
@@ -26,7 +26,7 @@ UIApplicationMain :: (argc: i32, argv: *void, principal_class: *NSString, delega
|
||||
#import "modules/build.sx";
|
||||
#import "modules/platform/bundle.sx";
|
||||
|
||||
configure :: () {
|
||||
configure :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
opts.set_bundle_path("/tmp/SxDeviceProbe.app");
|
||||
opts.set_bundle_id("co.swipelab.sxprobe");
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
answer = 84
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
error: 'not_a_real_compiler_fn' is not a function exported by the 'compiler' library
|
||||
--> examples/1184-diagnostics-weld-fn-unexported.sx:9:1
|
||||
error: 'not_a_real_compiler_fn' is not a function exported by the compiler
|
||||
--> examples/1184-diagnostics-weld-fn-unexported.sx:8:1
|
||||
|
|
||||
9 | not_a_real_compiler_fn :: (x: i64) -> i64 abi(.zig) extern compiler;
|
||||
8 | not_a_real_compiler_fn :: (x: i64) -> i64 abi(.compiler);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -1 +1 @@
|
||||
error: 'intern' is a comptime-only compiler-library function — it cannot be called at runtime (use it inside #run or a comptime '::')
|
||||
error: 'intern' is a comptime-only compiler-domain function — it cannot be called at runtime (use it inside #run or a comptime '::')
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
|
||||
@__sx_default_context = internal constant { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc_bytes, ptr @__thunk_CAllocator_Allocator_dealloc_bytes }, ptr null }
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
declare void @out(ptr, ptr) #0
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -13,7 +15,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @alloc_string(ptr, i64) #0
|
||||
@@ -64,7 +66,7 @@ declare ptr @any_to_string(ptr, [2 x i64]) #0
|
||||
declare ptr @build_format(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -156,8 +158,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -581,9 +581,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -668,6 +665,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
|
||||
@@ -4,37 +4,49 @@
|
||||
@__sx_default_context = internal constant { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc_bytes, ptr @__thunk_CAllocator_Allocator_dealloc_bytes }, ptr null }
|
||||
@__sx_objc_cstr_dealloc = internal constant [8 x i8] c"dealloc\00"
|
||||
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
|
||||
@str.114 = private unnamed_addr constant [15 x i8] c"result := \22\22; \00", align 1
|
||||
@str.115 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.116 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.117 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.118 = private unnamed_addr constant [44 x i8] c"result = concat(result, any_to_string(args[\00", align 1
|
||||
@str.119 = private unnamed_addr constant [6 x i8] c"])); \00", align 1
|
||||
@str.120 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.121 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.122 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.123 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.124 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.125 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.126 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.127 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.128 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.112 = private unnamed_addr constant [15 x i8] c"result := \22\22; \00", align 1
|
||||
@str.113 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.114 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.115 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.116 = private unnamed_addr constant [44 x i8] c"result = concat(result, any_to_string(args[\00", align 1
|
||||
@str.117 = private unnamed_addr constant [6 x i8] c"])); \00", align 1
|
||||
@str.118 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.119 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.120 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.121 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.122 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.123 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.124 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.125 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.126 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.127 = private unnamed_addr constant [10 x i8] c"compiled\0A\00", align 1
|
||||
@str.128 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.129 = private unnamed_addr constant [10 x i8] c"compiled\0A\00", align 1
|
||||
@str.130 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.131 = private unnamed_addr constant [10 x i8] c"compiled\0A\00", align 1
|
||||
@OBJC_IVAR_NAME_ = private unnamed_addr constant [11 x i8] c"__sx_state\00"
|
||||
@OBJC_IVAR_TYPE_ = private unnamed_addr constant [3 x i8] c"^v\00"
|
||||
@OBJC_CLASS_NAME_ = private unnamed_addr constant [9 x i8] c"NSObject\00"
|
||||
@OBJC_CLASS_NAME_.132 = private unnamed_addr constant [6 x i8] c"SxFoo\00"
|
||||
@OBJC_CLASS_NAME_.130 = private unnamed_addr constant [6 x i8] c"SxFoo\00"
|
||||
@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [5 x i8] c"bump\00"
|
||||
@OBJC_METH_VAR_TYPE_ = private unnamed_addr constant [4 x i8] c"v@:\00"
|
||||
@OBJC_METH_VAR_NAME_.133 = private unnamed_addr constant [8 x i8] c"dealloc\00"
|
||||
@OBJC_METH_VAR_TYPE_.134 = private unnamed_addr constant [4 x i8] c"v@:\00"
|
||||
@OBJC_METH_VAR_NAME_.135 = private unnamed_addr constant [6 x i8] c"alloc\00"
|
||||
@OBJC_METH_VAR_TYPE_.136 = private unnamed_addr constant [4 x i8] c"@@:\00"
|
||||
@OBJC_METH_VAR_NAME_.131 = private unnamed_addr constant [8 x i8] c"dealloc\00"
|
||||
@OBJC_METH_VAR_TYPE_.132 = private unnamed_addr constant [4 x i8] c"v@:\00"
|
||||
@OBJC_METH_VAR_NAME_.133 = private unnamed_addr constant [6 x i8] c"alloc\00"
|
||||
@OBJC_METH_VAR_TYPE_.134 = private unnamed_addr constant [4 x i8] c"@@:\00"
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -45,7 +57,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -270,7 +282,7 @@ entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.114, i64 14 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.112, i64 14 }, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 0, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
@@ -366,7 +378,7 @@ if.merge.11: ; preds = %if.merge.25, %if.me
|
||||
|
||||
if.then.12: ; preds = %if.then.9
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%call = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.115, i64 36 })
|
||||
%call = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.113, i64 36 })
|
||||
store { ptr, i64 } %call, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -374,7 +386,7 @@ if.then.12: ; preds = %if.then.9
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.116, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.114, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -384,13 +396,13 @@ if.then.12: ; preds = %if.then.9
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.117, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.115, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
br label %if.merge.13
|
||||
|
||||
if.merge.13: ; preds = %if.then.12, %if.then.9
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.118, i64 43 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.116, i64 43 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -398,7 +410,7 @@ if.merge.13: ; preds = %if.then.12, %if.the
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.119, i64 5 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.117, i64 5 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 1
|
||||
@@ -412,7 +424,7 @@ if.merge.13: ; preds = %if.then.12, %if.the
|
||||
|
||||
if.then.23: ; preds = %if.else.10
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.120, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.118, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -420,7 +432,7 @@ if.then.23: ; preds = %if.else.10
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.121, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.119, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -431,7 +443,7 @@ if.then.23: ; preds = %if.else.10
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.122, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.120, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 2
|
||||
@@ -488,7 +500,7 @@ if.merge.31: ; preds = %if.merge.34, %if.el
|
||||
|
||||
if.then.32: ; preds = %if.then.29
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.123, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.121, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -496,7 +508,7 @@ if.then.32: ; preds = %if.then.29
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.124, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.122, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -507,7 +519,7 @@ if.then.32: ; preds = %if.then.29
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.125, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.123, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 2
|
||||
@@ -527,7 +539,7 @@ if.merge.34: ; preds = %if.else.33, %if.the
|
||||
|
||||
if.then.35: ; preds = %while.exit.2
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.126, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.124, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -535,7 +547,7 @@ if.then.35: ; preds = %while.exit.2
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.127, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.125, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
@@ -546,7 +558,7 @@ if.then.35: ; preds = %while.exit.2
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.128, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.126, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
br label %if.merge.36
|
||||
|
||||
@@ -556,7 +568,7 @@ if.merge.36: ; preds = %if.then.35, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -648,8 +660,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1073,9 +1083,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1160,6 +1167,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1554,91 +1564,85 @@ declare ptr @BuildOptions.asset_dir_src_at.83(i64, i64) #0
|
||||
declare ptr @BuildOptions.asset_dir_dest_at.84(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback.85(i64, ptr) #0
|
||||
declare void @BuildOptions.set_post_link_module.85(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module.86(i64, ptr) #0
|
||||
declare ptr @BuildOptions.binary_path.86(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.binary_path.87(i64) #0
|
||||
declare void @BuildOptions.set_bundle_path.87(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_path.88(i64, ptr) #0
|
||||
declare void @BuildOptions.set_bundle_id.88(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_id.89(i64, ptr) #0
|
||||
declare void @BuildOptions.set_codesign_identity.89(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_codesign_identity.90(i64, ptr) #0
|
||||
declare void @BuildOptions.set_provisioning_profile.90(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_provisioning_profile.91(i64, ptr) #0
|
||||
declare ptr @BuildOptions.bundle_path.91(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_path.92(i64) #0
|
||||
declare ptr @BuildOptions.bundle_id.92(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_id.93(i64) #0
|
||||
declare ptr @BuildOptions.codesign_identity.93(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.codesign_identity.94(i64) #0
|
||||
declare ptr @BuildOptions.provisioning_profile.94(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.provisioning_profile.95(i64) #0
|
||||
declare ptr @BuildOptions.target_triple.95(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.target_triple.96(i64) #0
|
||||
declare i1 @BuildOptions.is_macos.96(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_macos.97(i64) #0
|
||||
declare i1 @BuildOptions.is_ios.97(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios.98(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_device.98(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_device.99(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_simulator.99(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_simulator.100(i64) #0
|
||||
declare i1 @BuildOptions.is_android.100(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_android.101(i64) #0
|
||||
declare i64 @BuildOptions.framework_count.101(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_count.102(i64) #0
|
||||
declare ptr @BuildOptions.framework_at.102(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_at.103(i64, i64) #0
|
||||
declare i64 @BuildOptions.framework_path_count.103(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_path_count.104(i64) #0
|
||||
declare ptr @BuildOptions.framework_path_at.104(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_path_at.105(i64, i64) #0
|
||||
declare void @BuildOptions.set_manifest_path.105(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_manifest_path.106(i64, ptr) #0
|
||||
declare void @BuildOptions.set_keystore_path.106(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_keystore_path.107(i64, ptr) #0
|
||||
declare ptr @BuildOptions.manifest_path.107(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.manifest_path.108(i64) #0
|
||||
declare ptr @BuildOptions.keystore_path.108(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.keystore_path.109(i64) #0
|
||||
declare i64 @BuildOptions.jni_main_count.109(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.jni_main_count.110(i64) #0
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.110(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options.113() #0
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal void @SxFoo.bump(ptr %0, ptr %1) #0 {
|
||||
@@ -1681,30 +1685,28 @@ entry:
|
||||
define internal void @print__ct_sfeff9eeccd48b824__pack(ptr %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.129, i64 9 }, ptr %alloca, align 8
|
||||
store { ptr, i64 } { ptr @str.127, i64 9 }, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 0
|
||||
store ptr null, ptr %gep, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 1
|
||||
store i64 0, ptr %gepN, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.130, i64 0 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.128, i64 0 }, ptr %allocaN, align 8
|
||||
%load = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%call = call { ptr, i64 } @substr(ptr %0, { ptr, i64 } %loadN, i64 0, i64 9)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @__insert_0(ptr %0) #0 {
|
||||
entry:
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.131, i64 9 })
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.129, i64 9 })
|
||||
ret { ptr, i64 } %call
|
||||
}
|
||||
|
||||
@@ -1784,17 +1786,17 @@ declare ptr @class_getInstanceVariable(ptr, ptr)
|
||||
define internal void @__sx_objc_defined_class_init() {
|
||||
entry:
|
||||
%super_cls = call ptr @objc_getClass(ptr @OBJC_CLASS_NAME_)
|
||||
%cls = call ptr @objc_allocateClassPair(ptr %super_cls, ptr @OBJC_CLASS_NAME_.132, i64 0)
|
||||
%cls = call ptr @objc_allocateClassPair(ptr %super_cls, ptr @OBJC_CLASS_NAME_.130, i64 0)
|
||||
%0 = call i8 @class_addIvar(ptr %cls, ptr @OBJC_IVAR_NAME_, i64 8, i8 3, ptr @OBJC_IVAR_TYPE_)
|
||||
%metacls = call ptr @object_getClass(ptr %cls)
|
||||
%sel = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_)
|
||||
%1 = call i8 @class_addMethod(ptr %cls, ptr %sel, ptr @__SxFoo_bump_imp, ptr @OBJC_METH_VAR_TYPE_)
|
||||
call void @objc_registerClassPair(ptr %cls)
|
||||
store ptr %cls, ptr @__SxFoo_class, align 8
|
||||
%sel_dealloc = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.133)
|
||||
%2 = call i8 @class_addMethod(ptr %cls, ptr %sel_dealloc, ptr @__SxFoo_dealloc_imp, ptr @OBJC_METH_VAR_TYPE_.134)
|
||||
%sel_alloc = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.135)
|
||||
%3 = call i8 @class_addMethod(ptr %metacls, ptr %sel_alloc, ptr @__SxFoo_alloc_imp, ptr @OBJC_METH_VAR_TYPE_.136)
|
||||
%sel_dealloc = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.131)
|
||||
%2 = call i8 @class_addMethod(ptr %cls, ptr %sel_dealloc, ptr @__SxFoo_dealloc_imp, ptr @OBJC_METH_VAR_TYPE_.132)
|
||||
%sel_alloc = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.133)
|
||||
%3 = call i8 @class_addMethod(ptr %metacls, ptr %sel_alloc, ptr @__SxFoo_alloc_imp, ptr @OBJC_METH_VAR_TYPE_.134)
|
||||
%iv = call ptr @class_getInstanceVariable(ptr %cls, ptr @OBJC_IVAR_NAME_)
|
||||
store ptr %iv, ptr @__SxFoo_state_ivar, align 8
|
||||
ret void
|
||||
|
||||
@@ -4,53 +4,65 @@
|
||||
@__sx_default_context = internal constant { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc_bytes, ptr @__thunk_CAllocator_Allocator_dealloc_bytes }, ptr null }
|
||||
@__sx_objc_cstr_dealloc = internal constant [8 x i8] c"dealloc\00"
|
||||
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
|
||||
@str.114 = private unnamed_addr constant [15 x i8] c"result := \22\22; \00", align 1
|
||||
@str.115 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.116 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.117 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.118 = private unnamed_addr constant [44 x i8] c"result = concat(result, any_to_string(args[\00", align 1
|
||||
@str.119 = private unnamed_addr constant [6 x i8] c"])); \00", align 1
|
||||
@str.120 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.121 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.122 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.123 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.124 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.125 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.126 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.127 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.128 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.129 = private unnamed_addr constant [6 x i8] c"SxFoo\00", align 1
|
||||
@str.130 = private unnamed_addr constant [8 x i8] c"dealloc\00", align 1
|
||||
@str.131 = private unnamed_addr constant [6 x i8] c"alloc\00", align 1
|
||||
@str.132 = private unnamed_addr constant [8 x i8] c"release\00", align 1
|
||||
@str.112 = private unnamed_addr constant [15 x i8] c"result := \22\22; \00", align 1
|
||||
@str.113 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.114 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.115 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.116 = private unnamed_addr constant [44 x i8] c"result = concat(result, any_to_string(args[\00", align 1
|
||||
@str.117 = private unnamed_addr constant [6 x i8] c"])); \00", align 1
|
||||
@str.118 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.119 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.120 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.121 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.122 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.123 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.124 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.125 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.126 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.127 = private unnamed_addr constant [6 x i8] c"SxFoo\00", align 1
|
||||
@str.128 = private unnamed_addr constant [8 x i8] c"dealloc\00", align 1
|
||||
@str.129 = private unnamed_addr constant [6 x i8] c"alloc\00", align 1
|
||||
@str.130 = private unnamed_addr constant [8 x i8] c"release\00", align 1
|
||||
@str.131 = private unnamed_addr constant [28 x i8] c"FAIL: SxFoo not registered\0A\00", align 1
|
||||
@str.132 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.133 = private unnamed_addr constant [28 x i8] c"FAIL: SxFoo not registered\0A\00", align 1
|
||||
@str.134 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.135 = private unnamed_addr constant [28 x i8] c"FAIL: SxFoo not registered\0A\00", align 1
|
||||
@str.134 = private unnamed_addr constant [27 x i8] c"FAIL: dealloc IMP missing\0A\00", align 1
|
||||
@str.135 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.136 = private unnamed_addr constant [27 x i8] c"FAIL: dealloc IMP missing\0A\00", align 1
|
||||
@str.137 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.138 = private unnamed_addr constant [27 x i8] c"FAIL: dealloc IMP missing\0A\00", align 1
|
||||
@str.137 = private unnamed_addr constant [28 x i8] c"FAIL: +alloc returned null\0A\00", align 1
|
||||
@str.138 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.139 = private unnamed_addr constant [28 x i8] c"FAIL: +alloc returned null\0A\00", align 1
|
||||
@str.140 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.141 = private unnamed_addr constant [28 x i8] c"FAIL: +alloc returned null\0A\00", align 1
|
||||
@str.140 = private unnamed_addr constant [36 x i8] c"FAIL: +alloc round 2 returned null\0A\00", align 1
|
||||
@str.141 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.142 = private unnamed_addr constant [36 x i8] c"FAIL: +alloc round 2 returned null\0A\00", align 1
|
||||
@str.143 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.144 = private unnamed_addr constant [36 x i8] c"FAIL: +alloc round 2 returned null\0A\00", align 1
|
||||
@str.143 = private unnamed_addr constant [13 x i8] c"dealloc: ok\0A\00", align 1
|
||||
@str.144 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.145 = private unnamed_addr constant [13 x i8] c"dealloc: ok\0A\00", align 1
|
||||
@str.146 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.147 = private unnamed_addr constant [13 x i8] c"dealloc: ok\0A\00", align 1
|
||||
@OBJC_IVAR_NAME_ = private unnamed_addr constant [11 x i8] c"__sx_state\00"
|
||||
@OBJC_IVAR_TYPE_ = private unnamed_addr constant [3 x i8] c"^v\00"
|
||||
@OBJC_CLASS_NAME_ = private unnamed_addr constant [9 x i8] c"NSObject\00"
|
||||
@OBJC_CLASS_NAME_.148 = private unnamed_addr constant [6 x i8] c"SxFoo\00"
|
||||
@OBJC_CLASS_NAME_.146 = private unnamed_addr constant [6 x i8] c"SxFoo\00"
|
||||
@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [5 x i8] c"bump\00"
|
||||
@OBJC_METH_VAR_TYPE_ = private unnamed_addr constant [4 x i8] c"v@:\00"
|
||||
@OBJC_METH_VAR_NAME_.149 = private unnamed_addr constant [8 x i8] c"dealloc\00"
|
||||
@OBJC_METH_VAR_TYPE_.150 = private unnamed_addr constant [4 x i8] c"v@:\00"
|
||||
@OBJC_METH_VAR_NAME_.151 = private unnamed_addr constant [6 x i8] c"alloc\00"
|
||||
@OBJC_METH_VAR_TYPE_.152 = private unnamed_addr constant [4 x i8] c"@@:\00"
|
||||
@OBJC_METH_VAR_NAME_.147 = private unnamed_addr constant [8 x i8] c"dealloc\00"
|
||||
@OBJC_METH_VAR_TYPE_.148 = private unnamed_addr constant [4 x i8] c"v@:\00"
|
||||
@OBJC_METH_VAR_NAME_.149 = private unnamed_addr constant [6 x i8] c"alloc\00"
|
||||
@OBJC_METH_VAR_TYPE_.150 = private unnamed_addr constant [4 x i8] c"@@:\00"
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -61,7 +73,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -286,7 +298,7 @@ entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.114, i64 14 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.112, i64 14 }, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 0, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
@@ -382,7 +394,7 @@ if.merge.13: ; preds = %if.merge.27, %if.me
|
||||
|
||||
if.then.14: ; preds = %if.then.11
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%call = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.115, i64 36 })
|
||||
%call = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.113, i64 36 })
|
||||
store { ptr, i64 } %call, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -390,7 +402,7 @@ if.then.14: ; preds = %if.then.11
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.116, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.114, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -400,13 +412,13 @@ if.then.14: ; preds = %if.then.11
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.117, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.115, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
br label %if.merge.15
|
||||
|
||||
if.merge.15: ; preds = %if.then.14, %if.then.11
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.118, i64 43 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.116, i64 43 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -414,7 +426,7 @@ if.merge.15: ; preds = %if.then.14, %if.the
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.119, i64 5 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.117, i64 5 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 1
|
||||
@@ -428,7 +440,7 @@ if.merge.15: ; preds = %if.then.14, %if.the
|
||||
|
||||
if.then.25: ; preds = %if.else.12
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.120, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.118, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -436,7 +448,7 @@ if.then.25: ; preds = %if.else.12
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.121, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.119, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -447,7 +459,7 @@ if.then.25: ; preds = %if.else.12
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.122, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.120, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 2
|
||||
@@ -504,7 +516,7 @@ if.merge.33: ; preds = %if.merge.36, %if.el
|
||||
|
||||
if.then.34: ; preds = %if.then.31
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.123, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.121, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -512,7 +524,7 @@ if.then.34: ; preds = %if.then.31
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.124, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.122, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -523,7 +535,7 @@ if.then.34: ; preds = %if.then.31
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.125, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.123, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 2
|
||||
@@ -543,7 +555,7 @@ if.merge.36: ; preds = %if.else.35, %if.the
|
||||
|
||||
if.then.37: ; preds = %while.exit.4
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.126, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.124, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -551,7 +563,7 @@ if.then.37: ; preds = %while.exit.4
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.127, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.125, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
@@ -562,7 +574,7 @@ if.then.37: ; preds = %while.exit.4
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.128, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.126, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
br label %if.merge.38
|
||||
|
||||
@@ -572,7 +584,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -664,8 +676,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1089,9 +1099,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1176,6 +1183,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1570,91 +1580,85 @@ declare ptr @BuildOptions.asset_dir_src_at.83(i64, i64) #0
|
||||
declare ptr @BuildOptions.asset_dir_dest_at.84(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback.85(i64, ptr) #0
|
||||
declare void @BuildOptions.set_post_link_module.85(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module.86(i64, ptr) #0
|
||||
declare ptr @BuildOptions.binary_path.86(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.binary_path.87(i64) #0
|
||||
declare void @BuildOptions.set_bundle_path.87(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_path.88(i64, ptr) #0
|
||||
declare void @BuildOptions.set_bundle_id.88(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_id.89(i64, ptr) #0
|
||||
declare void @BuildOptions.set_codesign_identity.89(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_codesign_identity.90(i64, ptr) #0
|
||||
declare void @BuildOptions.set_provisioning_profile.90(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_provisioning_profile.91(i64, ptr) #0
|
||||
declare ptr @BuildOptions.bundle_path.91(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_path.92(i64) #0
|
||||
declare ptr @BuildOptions.bundle_id.92(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_id.93(i64) #0
|
||||
declare ptr @BuildOptions.codesign_identity.93(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.codesign_identity.94(i64) #0
|
||||
declare ptr @BuildOptions.provisioning_profile.94(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.provisioning_profile.95(i64) #0
|
||||
declare ptr @BuildOptions.target_triple.95(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.target_triple.96(i64) #0
|
||||
declare i1 @BuildOptions.is_macos.96(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_macos.97(i64) #0
|
||||
declare i1 @BuildOptions.is_ios.97(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios.98(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_device.98(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_device.99(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_simulator.99(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_simulator.100(i64) #0
|
||||
declare i1 @BuildOptions.is_android.100(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_android.101(i64) #0
|
||||
declare i64 @BuildOptions.framework_count.101(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_count.102(i64) #0
|
||||
declare ptr @BuildOptions.framework_at.102(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_at.103(i64, i64) #0
|
||||
declare i64 @BuildOptions.framework_path_count.103(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_path_count.104(i64) #0
|
||||
declare ptr @BuildOptions.framework_path_at.104(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_path_at.105(i64, i64) #0
|
||||
declare void @BuildOptions.set_manifest_path.105(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_manifest_path.106(i64, ptr) #0
|
||||
declare void @BuildOptions.set_keystore_path.106(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_keystore_path.107(i64, ptr) #0
|
||||
declare ptr @BuildOptions.manifest_path.107(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.manifest_path.108(i64) #0
|
||||
declare ptr @BuildOptions.keystore_path.108(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.keystore_path.109(i64) #0
|
||||
declare i64 @BuildOptions.jni_main_count.109(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.jni_main_count.110(i64) #0
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.110(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options.113() #0
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @objc_getClass(ptr) #0
|
||||
@@ -1741,7 +1745,7 @@ entry:
|
||||
%allocaN = alloca ptr, align 8
|
||||
%allocaN = alloca ptr, align 8
|
||||
%allocaN = alloca ptr, align 8
|
||||
%call = call ptr @objc_getClass(ptr @str.129)
|
||||
%call = call ptr @objc_getClass(ptr @str.127)
|
||||
store ptr %call, ptr %alloca, align 8
|
||||
%load = load ptr, ptr %alloca, align 8
|
||||
%icmp = icmp eq ptr %load, null
|
||||
@@ -1752,7 +1756,7 @@ if.then.0: ; preds = %entry
|
||||
ret i32 1
|
||||
|
||||
if.merge.1: ; preds = %entry
|
||||
%callN = call ptr @sel_registerName(ptr @str.130)
|
||||
%callN = call ptr @sel_registerName(ptr @str.128)
|
||||
store ptr %callN, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
@@ -1767,7 +1771,7 @@ if.then.39: ; preds = %if.merge.1
|
||||
ret i32 1
|
||||
|
||||
if.merge.40: ; preds = %if.merge.1
|
||||
%callN = call ptr @sel_registerName(ptr @str.131)
|
||||
%callN = call ptr @sel_registerName(ptr @str.129)
|
||||
store ptr %callN, ptr %allocaN, align 8
|
||||
store ptr @objc_msgSend, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %alloca, align 8
|
||||
@@ -1784,7 +1788,7 @@ if.then.41: ; preds = %if.merge.40
|
||||
ret i32 1
|
||||
|
||||
if.merge.42: ; preds = %if.merge.40
|
||||
%callN = call ptr @sel_registerName(ptr @str.132)
|
||||
%callN = call ptr @sel_registerName(ptr @str.130)
|
||||
store ptr %callN, ptr %allocaN, align 8
|
||||
store ptr @objc_msgSend, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
@@ -1831,30 +1835,28 @@ entry:
|
||||
define internal void @print__ct_s354c93d7643e1bdf__pack(ptr %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.133, i64 27 }, ptr %alloca, align 8
|
||||
store { ptr, i64 } { ptr @str.131, i64 27 }, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 0
|
||||
store ptr null, ptr %gep, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 1
|
||||
store i64 0, ptr %gepN, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.134, i64 0 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.132, i64 0 }, ptr %allocaN, align 8
|
||||
%load = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%call = call { ptr, i64 } @substr(ptr %0, { ptr, i64 } %loadN, i64 0, i64 27)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @__insert_0(ptr %0) #0 {
|
||||
entry:
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.135, i64 27 })
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.133, i64 27 })
|
||||
ret { ptr, i64 } %call
|
||||
}
|
||||
|
||||
@@ -1862,30 +1864,28 @@ entry:
|
||||
define internal void @print__ct_sfe783e2b27a4beff__pack(ptr %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.136, i64 26 }, ptr %alloca, align 8
|
||||
store { ptr, i64 } { ptr @str.134, i64 26 }, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 0
|
||||
store ptr null, ptr %gep, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 1
|
||||
store i64 0, ptr %gepN, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.137, i64 0 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.135, i64 0 }, ptr %allocaN, align 8
|
||||
%load = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%call = call { ptr, i64 } @substr(ptr %0, { ptr, i64 } %loadN, i64 0, i64 26)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @__insert_1(ptr %0) #0 {
|
||||
entry:
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.138, i64 26 })
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.136, i64 26 })
|
||||
ret { ptr, i64 } %call
|
||||
}
|
||||
|
||||
@@ -1893,30 +1893,28 @@ entry:
|
||||
define internal void @print__ct_scaebdbbd10c81716__pack(ptr %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.139, i64 27 }, ptr %alloca, align 8
|
||||
store { ptr, i64 } { ptr @str.137, i64 27 }, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 0
|
||||
store ptr null, ptr %gep, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 1
|
||||
store i64 0, ptr %gepN, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.140, i64 0 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.138, i64 0 }, ptr %allocaN, align 8
|
||||
%load = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%call = call { ptr, i64 } @substr(ptr %0, { ptr, i64 } %loadN, i64 0, i64 27)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @__insert_2(ptr %0) #0 {
|
||||
entry:
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.141, i64 27 })
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.139, i64 27 })
|
||||
ret { ptr, i64 } %call
|
||||
}
|
||||
|
||||
@@ -1924,30 +1922,28 @@ entry:
|
||||
define internal void @print__ct_s7c1052877b8cc801__pack(ptr %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.142, i64 35 }, ptr %alloca, align 8
|
||||
store { ptr, i64 } { ptr @str.140, i64 35 }, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 0
|
||||
store ptr null, ptr %gep, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 1
|
||||
store i64 0, ptr %gepN, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.143, i64 0 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.141, i64 0 }, ptr %allocaN, align 8
|
||||
%load = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%call = call { ptr, i64 } @substr(ptr %0, { ptr, i64 } %loadN, i64 0, i64 35)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @__insert_3(ptr %0) #0 {
|
||||
entry:
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.144, i64 35 })
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.142, i64 35 })
|
||||
ret { ptr, i64 } %call
|
||||
}
|
||||
|
||||
@@ -1955,30 +1951,28 @@ entry:
|
||||
define internal void @print__ct_sed4e79fbcbd67966__pack(ptr %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.145, i64 12 }, ptr %alloca, align 8
|
||||
store { ptr, i64 } { ptr @str.143, i64 12 }, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 0
|
||||
store ptr null, ptr %gep, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 1
|
||||
store i64 0, ptr %gepN, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.146, i64 0 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.144, i64 0 }, ptr %allocaN, align 8
|
||||
%load = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%call = call { ptr, i64 } @substr(ptr %0, { ptr, i64 } %loadN, i64 0, i64 12)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @__insert_4(ptr %0) #0 {
|
||||
entry:
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.147, i64 12 })
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.145, i64 12 })
|
||||
ret { ptr, i64 } %call
|
||||
}
|
||||
|
||||
@@ -2036,17 +2030,17 @@ declare i8 @class_addIvar(ptr, ptr, i64, i8, ptr)
|
||||
define internal void @__sx_objc_defined_class_init() {
|
||||
entry:
|
||||
%super_cls = call ptr @objc_getClass(ptr @OBJC_CLASS_NAME_)
|
||||
%cls = call ptr @objc_allocateClassPair(ptr %super_cls, ptr @OBJC_CLASS_NAME_.148, i64 0)
|
||||
%cls = call ptr @objc_allocateClassPair(ptr %super_cls, ptr @OBJC_CLASS_NAME_.146, i64 0)
|
||||
%0 = call i8 @class_addIvar(ptr %cls, ptr @OBJC_IVAR_NAME_, i64 8, i8 3, ptr @OBJC_IVAR_TYPE_)
|
||||
%metacls = call ptr @object_getClass(ptr %cls)
|
||||
%sel = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_)
|
||||
%1 = call i1 @class_addMethod(ptr %cls, ptr %sel, ptr @__SxFoo_bump_imp, ptr @OBJC_METH_VAR_TYPE_)
|
||||
call void @objc_registerClassPair(ptr %cls)
|
||||
store ptr %cls, ptr @__SxFoo_class, align 8
|
||||
%sel_dealloc = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.149)
|
||||
%2 = call i1 @class_addMethod(ptr %cls, ptr %sel_dealloc, ptr @__SxFoo_dealloc_imp, ptr @OBJC_METH_VAR_TYPE_.150)
|
||||
%sel_alloc = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.151)
|
||||
%3 = call i1 @class_addMethod(ptr %metacls, ptr %sel_alloc, ptr @__SxFoo_alloc_imp, ptr @OBJC_METH_VAR_TYPE_.152)
|
||||
%sel_dealloc = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.147)
|
||||
%2 = call i1 @class_addMethod(ptr %cls, ptr %sel_dealloc, ptr @__SxFoo_dealloc_imp, ptr @OBJC_METH_VAR_TYPE_.148)
|
||||
%sel_alloc = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.149)
|
||||
%3 = call i1 @class_addMethod(ptr %metacls, ptr %sel_alloc, ptr @__SxFoo_alloc_imp, ptr @OBJC_METH_VAR_TYPE_.150)
|
||||
%iv = call ptr @class_getInstanceVariable(ptr %cls, ptr @OBJC_IVAR_NAME_)
|
||||
store ptr %iv, ptr @__SxFoo_state_ivar, align 8
|
||||
ret void
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,30 +3,42 @@
|
||||
@OBJC_SELECTOR_REFERENCES_init = internal global ptr null
|
||||
@OBJC_SELECTOR_REFERENCES_release = internal global ptr null
|
||||
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
|
||||
@str.114 = private unnamed_addr constant [15 x i8] c"result := \22\22; \00", align 1
|
||||
@str.115 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.116 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.117 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.118 = private unnamed_addr constant [44 x i8] c"result = concat(result, any_to_string(args[\00", align 1
|
||||
@str.119 = private unnamed_addr constant [6 x i8] c"])); \00", align 1
|
||||
@str.120 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.121 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.122 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.123 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.124 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.125 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.126 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.127 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.128 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.112 = private unnamed_addr constant [15 x i8] c"result := \22\22; \00", align 1
|
||||
@str.113 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.114 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.115 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.116 = private unnamed_addr constant [44 x i8] c"result = concat(result, any_to_string(args[\00", align 1
|
||||
@str.117 = private unnamed_addr constant [6 x i8] c"])); \00", align 1
|
||||
@str.118 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.119 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.120 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.121 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.122 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.123 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.124 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.125 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.126 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.127 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
@str.128 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.129 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
@str.130 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.131 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [5 x i8] c"init\00"
|
||||
@OBJC_METH_VAR_NAME_.132 = private unnamed_addr constant [8 x i8] c"release\00"
|
||||
@OBJC_METH_VAR_NAME_.130 = private unnamed_addr constant [8 x i8] c"release\00"
|
||||
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @__sx_objc_selector_init, ptr null }]
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -262,7 +274,7 @@ entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.114, i64 14 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.112, i64 14 }, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 0, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
@@ -358,7 +370,7 @@ if.merge.11: ; preds = %if.merge.25, %if.me
|
||||
|
||||
if.then.12: ; preds = %if.then.9
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%call = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.115, i64 36 })
|
||||
%call = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.113, i64 36 })
|
||||
store { ptr, i64 } %call, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -366,7 +378,7 @@ if.then.12: ; preds = %if.then.9
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.116, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.114, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -376,13 +388,13 @@ if.then.12: ; preds = %if.then.9
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.117, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.115, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
br label %if.merge.13
|
||||
|
||||
if.merge.13: ; preds = %if.then.12, %if.then.9
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.118, i64 43 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.116, i64 43 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -390,7 +402,7 @@ if.merge.13: ; preds = %if.then.12, %if.the
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.119, i64 5 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.117, i64 5 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 1
|
||||
@@ -404,7 +416,7 @@ if.merge.13: ; preds = %if.then.12, %if.the
|
||||
|
||||
if.then.23: ; preds = %if.else.10
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.120, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.118, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -412,7 +424,7 @@ if.then.23: ; preds = %if.else.10
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.121, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.119, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -423,7 +435,7 @@ if.then.23: ; preds = %if.else.10
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.122, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.120, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 2
|
||||
@@ -480,7 +492,7 @@ if.merge.31: ; preds = %if.merge.34, %if.el
|
||||
|
||||
if.then.32: ; preds = %if.then.29
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.123, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.121, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -488,7 +500,7 @@ if.then.32: ; preds = %if.then.29
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.124, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.122, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -499,7 +511,7 @@ if.then.32: ; preds = %if.then.29
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.125, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.123, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 2
|
||||
@@ -519,7 +531,7 @@ if.merge.34: ; preds = %if.else.33, %if.the
|
||||
|
||||
if.then.35: ; preds = %while.exit.2
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.126, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.124, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -527,7 +539,7 @@ if.then.35: ; preds = %while.exit.2
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.127, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.125, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
@@ -538,7 +550,7 @@ if.then.35: ; preds = %while.exit.2
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.128, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.126, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
br label %if.merge.36
|
||||
|
||||
@@ -548,7 +560,7 @@ if.merge.36: ; preds = %if.then.35, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1546,91 +1556,85 @@ declare ptr @BuildOptions.asset_dir_src_at.83(i64, i64) #0
|
||||
declare ptr @BuildOptions.asset_dir_dest_at.84(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback.85(i64, ptr) #0
|
||||
declare void @BuildOptions.set_post_link_module.85(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module.86(i64, ptr) #0
|
||||
declare ptr @BuildOptions.binary_path.86(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.binary_path.87(i64) #0
|
||||
declare void @BuildOptions.set_bundle_path.87(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_path.88(i64, ptr) #0
|
||||
declare void @BuildOptions.set_bundle_id.88(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_id.89(i64, ptr) #0
|
||||
declare void @BuildOptions.set_codesign_identity.89(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_codesign_identity.90(i64, ptr) #0
|
||||
declare void @BuildOptions.set_provisioning_profile.90(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_provisioning_profile.91(i64, ptr) #0
|
||||
declare ptr @BuildOptions.bundle_path.91(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_path.92(i64) #0
|
||||
declare ptr @BuildOptions.bundle_id.92(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_id.93(i64) #0
|
||||
declare ptr @BuildOptions.codesign_identity.93(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.codesign_identity.94(i64) #0
|
||||
declare ptr @BuildOptions.provisioning_profile.94(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.provisioning_profile.95(i64) #0
|
||||
declare ptr @BuildOptions.target_triple.95(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.target_triple.96(i64) #0
|
||||
declare i1 @BuildOptions.is_macos.96(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_macos.97(i64) #0
|
||||
declare i1 @BuildOptions.is_ios.97(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios.98(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_device.98(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_device.99(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_simulator.99(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_simulator.100(i64) #0
|
||||
declare i1 @BuildOptions.is_android.100(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_android.101(i64) #0
|
||||
declare i64 @BuildOptions.framework_count.101(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_count.102(i64) #0
|
||||
declare ptr @BuildOptions.framework_at.102(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_at.103(i64, i64) #0
|
||||
declare i64 @BuildOptions.framework_path_count.103(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_path_count.104(i64) #0
|
||||
declare ptr @BuildOptions.framework_path_at.104(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_path_at.105(i64, i64) #0
|
||||
declare void @BuildOptions.set_manifest_path.105(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_manifest_path.106(i64, ptr) #0
|
||||
declare void @BuildOptions.set_keystore_path.106(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_keystore_path.107(i64, ptr) #0
|
||||
declare ptr @BuildOptions.manifest_path.107(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.manifest_path.108(i64) #0
|
||||
declare ptr @BuildOptions.keystore_path.108(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.keystore_path.109(i64) #0
|
||||
declare i64 @BuildOptions.jni_main_count.109(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.jni_main_count.110(i64) #0
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.110(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options.113() #0
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
@@ -1666,30 +1670,28 @@ entry:
|
||||
define internal void @print__ct_sbdbafa1a5fe828c0__pack(ptr %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.129, i64 3 }, ptr %alloca, align 8
|
||||
store { ptr, i64 } { ptr @str.127, i64 3 }, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 0
|
||||
store ptr null, ptr %gep, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 1
|
||||
store i64 0, ptr %gepN, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.130, i64 0 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.128, i64 0 }, ptr %allocaN, align 8
|
||||
%load = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%call = call { ptr, i64 } @substr(ptr %0, { ptr, i64 } %loadN, i64 0, i64 3)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @__insert_0(ptr %0) #0 {
|
||||
entry:
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.131, i64 3 })
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.129, i64 3 })
|
||||
ret { ptr, i64 } %call
|
||||
}
|
||||
|
||||
@@ -1701,7 +1703,7 @@ define internal void @__sx_objc_selector_init() {
|
||||
entry:
|
||||
%sel = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_)
|
||||
store ptr %sel, ptr @OBJC_SELECTOR_REFERENCES_init, align 8
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.132)
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.130)
|
||||
store ptr %selN, ptr @OBJC_SELECTOR_REFERENCES_release, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -8,51 +8,63 @@
|
||||
@OBJC_SELECTOR_REFERENCES_initWithFrame_options_ = internal global ptr null
|
||||
@OBJC_SELECTOR_REFERENCES_actualSelectorName = internal global ptr null
|
||||
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
|
||||
@str.114 = private unnamed_addr constant [15 x i8] c"result := \22\22; \00", align 1
|
||||
@str.115 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.116 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.117 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.118 = private unnamed_addr constant [44 x i8] c"result = concat(result, any_to_string(args[\00", align 1
|
||||
@str.119 = private unnamed_addr constant [6 x i8] c"])); \00", align 1
|
||||
@str.120 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.121 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.122 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.123 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.124 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.125 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.126 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.127 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.128 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.129 = private unnamed_addr constant [9 x i8] c"NSObject\00", align 1
|
||||
@str.130 = private unnamed_addr constant [16 x i8] c"SxManglingProbe\00", align 1
|
||||
@str.131 = private unnamed_addr constant [7 x i8] c"length\00", align 1
|
||||
@str.132 = private unnamed_addr constant [4 x i8] c"i@:\00", align 1
|
||||
@str.133 = private unnamed_addr constant [11 x i8] c"addObject:\00", align 1
|
||||
@str.134 = private unnamed_addr constant [5 x i8] c"i@:i\00", align 1
|
||||
@str.135 = private unnamed_addr constant [13 x i8] c"combine:and:\00", align 1
|
||||
@str.136 = private unnamed_addr constant [6 x i8] c"i@:ii\00", align 1
|
||||
@str.137 = private unnamed_addr constant [20 x i8] c"insert:after:index:\00", align 1
|
||||
@str.138 = private unnamed_addr constant [7 x i8] c"i@:iii\00", align 1
|
||||
@str.139 = private unnamed_addr constant [24 x i8] c"add:observer:for:event:\00", align 1
|
||||
@str.140 = private unnamed_addr constant [8 x i8] c"i@:iiii\00", align 1
|
||||
@str.141 = private unnamed_addr constant [23 x i8] c"initWithFrame:options:\00", align 1
|
||||
@str.142 = private unnamed_addr constant [6 x i8] c"i@:ii\00", align 1
|
||||
@str.143 = private unnamed_addr constant [19 x i8] c"actualSelectorName\00", align 1
|
||||
@str.144 = private unnamed_addr constant [4 x i8] c"i@:\00", align 1
|
||||
@str.112 = private unnamed_addr constant [15 x i8] c"result := \22\22; \00", align 1
|
||||
@str.113 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.114 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.115 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.116 = private unnamed_addr constant [44 x i8] c"result = concat(result, any_to_string(args[\00", align 1
|
||||
@str.117 = private unnamed_addr constant [6 x i8] c"])); \00", align 1
|
||||
@str.118 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.119 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.120 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.121 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.122 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.123 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.124 = private unnamed_addr constant [37 x i8] c"result = concat(result, substr(fmt, \00", align 1
|
||||
@str.125 = private unnamed_addr constant [3 x i8] c", \00", align 1
|
||||
@str.126 = private unnamed_addr constant [5 x i8] c")); \00", align 1
|
||||
@str.127 = private unnamed_addr constant [9 x i8] c"NSObject\00", align 1
|
||||
@str.128 = private unnamed_addr constant [16 x i8] c"SxManglingProbe\00", align 1
|
||||
@str.129 = private unnamed_addr constant [7 x i8] c"length\00", align 1
|
||||
@str.130 = private unnamed_addr constant [4 x i8] c"i@:\00", align 1
|
||||
@str.131 = private unnamed_addr constant [11 x i8] c"addObject:\00", align 1
|
||||
@str.132 = private unnamed_addr constant [5 x i8] c"i@:i\00", align 1
|
||||
@str.133 = private unnamed_addr constant [13 x i8] c"combine:and:\00", align 1
|
||||
@str.134 = private unnamed_addr constant [6 x i8] c"i@:ii\00", align 1
|
||||
@str.135 = private unnamed_addr constant [20 x i8] c"insert:after:index:\00", align 1
|
||||
@str.136 = private unnamed_addr constant [7 x i8] c"i@:iii\00", align 1
|
||||
@str.137 = private unnamed_addr constant [24 x i8] c"add:observer:for:event:\00", align 1
|
||||
@str.138 = private unnamed_addr constant [8 x i8] c"i@:iiii\00", align 1
|
||||
@str.139 = private unnamed_addr constant [23 x i8] c"initWithFrame:options:\00", align 1
|
||||
@str.140 = private unnamed_addr constant [6 x i8] c"i@:ii\00", align 1
|
||||
@str.141 = private unnamed_addr constant [19 x i8] c"actualSelectorName\00", align 1
|
||||
@str.142 = private unnamed_addr constant [4 x i8] c"i@:\00", align 1
|
||||
@str.143 = private unnamed_addr constant [19 x i8] c"mangling table OK\0A\00", align 1
|
||||
@str.144 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.145 = private unnamed_addr constant [19 x i8] c"mangling table OK\0A\00", align 1
|
||||
@str.146 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.147 = private unnamed_addr constant [19 x i8] c"mangling table OK\0A\00", align 1
|
||||
@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [7 x i8] c"length\00"
|
||||
@OBJC_METH_VAR_NAME_.148 = private unnamed_addr constant [11 x i8] c"addObject:\00"
|
||||
@OBJC_METH_VAR_NAME_.149 = private unnamed_addr constant [13 x i8] c"combine:and:\00"
|
||||
@OBJC_METH_VAR_NAME_.150 = private unnamed_addr constant [20 x i8] c"insert:after:index:\00"
|
||||
@OBJC_METH_VAR_NAME_.151 = private unnamed_addr constant [24 x i8] c"add:observer:for:event:\00"
|
||||
@OBJC_METH_VAR_NAME_.152 = private unnamed_addr constant [23 x i8] c"initWithFrame:options:\00"
|
||||
@OBJC_METH_VAR_NAME_.153 = private unnamed_addr constant [19 x i8] c"actualSelectorName\00"
|
||||
@OBJC_METH_VAR_NAME_.146 = private unnamed_addr constant [11 x i8] c"addObject:\00"
|
||||
@OBJC_METH_VAR_NAME_.147 = private unnamed_addr constant [13 x i8] c"combine:and:\00"
|
||||
@OBJC_METH_VAR_NAME_.148 = private unnamed_addr constant [20 x i8] c"insert:after:index:\00"
|
||||
@OBJC_METH_VAR_NAME_.149 = private unnamed_addr constant [24 x i8] c"add:observer:for:event:\00"
|
||||
@OBJC_METH_VAR_NAME_.150 = private unnamed_addr constant [23 x i8] c"initWithFrame:options:\00"
|
||||
@OBJC_METH_VAR_NAME_.151 = private unnamed_addr constant [19 x i8] c"actualSelectorName\00"
|
||||
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @__sx_objc_selector_init, ptr null }]
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -63,7 +75,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -288,7 +300,7 @@ entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.114, i64 14 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.112, i64 14 }, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
store i64 0, ptr %allocaN, align 8
|
||||
%allocaN = alloca i64, align 8
|
||||
@@ -384,7 +396,7 @@ if.merge.11: ; preds = %if.merge.25, %if.me
|
||||
|
||||
if.then.12: ; preds = %if.then.9
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%call = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.115, i64 36 })
|
||||
%call = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.113, i64 36 })
|
||||
store { ptr, i64 } %call, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -392,7 +404,7 @@ if.then.12: ; preds = %if.then.9
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.116, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.114, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -402,13 +414,13 @@ if.then.12: ; preds = %if.then.9
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.117, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.115, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
br label %if.merge.13
|
||||
|
||||
if.merge.13: ; preds = %if.then.12, %if.then.9
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.118, i64 43 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.116, i64 43 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -416,7 +428,7 @@ if.merge.13: ; preds = %if.then.12, %if.the
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.119, i64 5 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.117, i64 5 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 1
|
||||
@@ -430,7 +442,7 @@ if.merge.13: ; preds = %if.then.12, %if.the
|
||||
|
||||
if.then.23: ; preds = %if.else.10
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.120, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.118, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -438,7 +450,7 @@ if.then.23: ; preds = %if.else.10
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.121, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.119, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -449,7 +461,7 @@ if.then.23: ; preds = %if.else.10
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.122, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.120, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 2
|
||||
@@ -506,7 +518,7 @@ if.merge.31: ; preds = %if.merge.34, %if.el
|
||||
|
||||
if.then.32: ; preds = %if.then.29
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.123, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.121, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -514,7 +526,7 @@ if.then.32: ; preds = %if.then.29
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.124, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.122, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -525,7 +537,7 @@ if.then.32: ; preds = %if.then.29
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.125, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.123, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%addN = add i64 %loadN, 2
|
||||
@@ -545,7 +557,7 @@ if.merge.34: ; preds = %if.else.33, %if.the
|
||||
|
||||
if.then.35: ; preds = %while.exit.2
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.126, i64 36 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.124, i64 36 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
@@ -553,7 +565,7 @@ if.then.35: ; preds = %while.exit.2
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.127, i64 2 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.125, i64 2 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
@@ -564,7 +576,7 @@ if.then.35: ; preds = %while.exit.2
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.128, i64 4 })
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } { ptr @str.126, i64 4 })
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
br label %if.merge.36
|
||||
|
||||
@@ -574,7 +586,7 @@ if.merge.36: ; preds = %if.then.35, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -666,8 +678,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1091,9 +1101,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1178,6 +1185,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1572,91 +1582,85 @@ declare ptr @BuildOptions.asset_dir_src_at.83(i64, i64) #0
|
||||
declare ptr @BuildOptions.asset_dir_dest_at.84(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback.85(i64, ptr) #0
|
||||
declare void @BuildOptions.set_post_link_module.85(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module.86(i64, ptr) #0
|
||||
declare ptr @BuildOptions.binary_path.86(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.binary_path.87(i64) #0
|
||||
declare void @BuildOptions.set_bundle_path.87(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_path.88(i64, ptr) #0
|
||||
declare void @BuildOptions.set_bundle_id.88(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_id.89(i64, ptr) #0
|
||||
declare void @BuildOptions.set_codesign_identity.89(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_codesign_identity.90(i64, ptr) #0
|
||||
declare void @BuildOptions.set_provisioning_profile.90(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_provisioning_profile.91(i64, ptr) #0
|
||||
declare ptr @BuildOptions.bundle_path.91(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_path.92(i64) #0
|
||||
declare ptr @BuildOptions.bundle_id.92(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_id.93(i64) #0
|
||||
declare ptr @BuildOptions.codesign_identity.93(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.codesign_identity.94(i64) #0
|
||||
declare ptr @BuildOptions.provisioning_profile.94(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.provisioning_profile.95(i64) #0
|
||||
declare ptr @BuildOptions.target_triple.95(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.target_triple.96(i64) #0
|
||||
declare i1 @BuildOptions.is_macos.96(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_macos.97(i64) #0
|
||||
declare i1 @BuildOptions.is_ios.97(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios.98(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_device.98(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_device.99(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_simulator.99(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_simulator.100(i64) #0
|
||||
declare i1 @BuildOptions.is_android.100(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_android.101(i64) #0
|
||||
declare i64 @BuildOptions.framework_count.101(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_count.102(i64) #0
|
||||
declare ptr @BuildOptions.framework_at.102(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_at.103(i64, i64) #0
|
||||
declare i64 @BuildOptions.framework_path_count.103(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_path_count.104(i64) #0
|
||||
declare ptr @BuildOptions.framework_path_at.104(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_path_at.105(i64, i64) #0
|
||||
declare void @BuildOptions.set_manifest_path.105(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_manifest_path.106(i64, ptr) #0
|
||||
declare void @BuildOptions.set_keystore_path.106(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_keystore_path.107(i64, ptr) #0
|
||||
declare ptr @BuildOptions.manifest_path.107(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.manifest_path.108(i64) #0
|
||||
declare ptr @BuildOptions.keystore_path.108(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.keystore_path.109(i64) #0
|
||||
declare i64 @BuildOptions.jni_main_count.109(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.jni_main_count.110(i64) #0
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.110(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options.113() #0
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @objc_getClass(ptr) #0
|
||||
@@ -1738,14 +1742,17 @@ entry:
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
call void @__sx_objc_selector_init()
|
||||
%call = call ptr @objc_getClass(ptr @str.129)
|
||||
%call = call ptr @objc_getClass(ptr @str.127)
|
||||
%alloca = alloca ptr, align 8
|
||||
store ptr %call, ptr %alloca, align 8
|
||||
%load = load ptr, ptr %alloca, align 8
|
||||
%callN = call ptr @objc_allocateClassPair(ptr %load, ptr @str.130, i64 0)
|
||||
%callN = call ptr @objc_allocateClassPair(ptr %load, ptr @str.128, i64 0)
|
||||
%allocaN = alloca ptr, align 8
|
||||
store ptr %callN, ptr %allocaN, align 8
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
%callN = call ptr @sel_registerName(ptr @str.129)
|
||||
%callN = call i1 @class_addMethod(ptr %loadN, ptr %callN, ptr @universal_imp, ptr @str.130)
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
%callN = call ptr @sel_registerName(ptr @str.131)
|
||||
%callN = call i1 @class_addMethod(ptr %loadN, ptr %callN, ptr @universal_imp, ptr @str.132)
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
@@ -1764,9 +1771,6 @@ entry:
|
||||
%callN = call ptr @sel_registerName(ptr @str.141)
|
||||
%callN = call i1 @class_addMethod(ptr %loadN, ptr %callN, ptr @universal_imp, ptr @str.142)
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
%callN = call ptr @sel_registerName(ptr @str.143)
|
||||
%callN = call i1 @class_addMethod(ptr %loadN, ptr %callN, ptr @universal_imp, ptr @str.144)
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
call void @objc_registerClassPair(ptr %loadN)
|
||||
%allocaN = alloca ptr, align 8
|
||||
%loadN = load ptr, ptr %allocaN, align 8
|
||||
@@ -1815,30 +1819,28 @@ entry:
|
||||
define internal void @print__ct_s4c1a58a7c89bfbba__pack(ptr %0) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.145, i64 18 }, ptr %alloca, align 8
|
||||
store { ptr, i64 } { ptr @str.143, i64 18 }, ptr %alloca, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
%gep = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 0
|
||||
store ptr null, ptr %gep, align 8
|
||||
%gepN = getelementptr inbounds nuw { ptr, i64 }, ptr %allocaN, i32 0, i32 1
|
||||
store i64 0, ptr %gepN, align 8
|
||||
%allocaN = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } { ptr @str.146, i64 0 }, ptr %allocaN, align 8
|
||||
store { ptr, i64 } { ptr @str.144, i64 0 }, ptr %allocaN, align 8
|
||||
%load = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%call = call { ptr, i64 } @substr(ptr %0, { ptr, i64 } %loadN, i64 0, i64 18)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @__insert_0(ptr %0) #0 {
|
||||
entry:
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.147, i64 18 })
|
||||
%call = call { ptr, i64 } @build_format(ptr %0, { ptr, i64 } { ptr @str.145, i64 18 })
|
||||
ret { ptr, i64 } %call
|
||||
}
|
||||
|
||||
@@ -1846,17 +1848,17 @@ define internal void @__sx_objc_selector_init() {
|
||||
entry:
|
||||
%sel = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_)
|
||||
store ptr %sel, ptr @OBJC_SELECTOR_REFERENCES_length, align 8
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.148)
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.146)
|
||||
store ptr %selN, ptr @OBJC_SELECTOR_REFERENCES_addObject_, align 8
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.149)
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.147)
|
||||
store ptr %selN, ptr @OBJC_SELECTOR_REFERENCES_combine_and_, align 8
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.150)
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.148)
|
||||
store ptr %selN, ptr @OBJC_SELECTOR_REFERENCES_insert_after_index_, align 8
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.151)
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.149)
|
||||
store ptr %selN, ptr @OBJC_SELECTOR_REFERENCES_add_observer_for_event_, align 8
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.152)
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.150)
|
||||
store ptr %selN, ptr @OBJC_SELECTOR_REFERENCES_initWithFrame_options_, align 8
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.153)
|
||||
%selN = call ptr @sel_registerName(ptr @OBJC_METH_VAR_NAME_.151)
|
||||
store ptr %selN, ptr @OBJC_SELECTOR_REFERENCES_actualSelectorName, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -27,8 +27,20 @@
|
||||
@str.97 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.98 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -39,7 +51,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -550,7 +562,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -642,8 +654,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1067,9 +1077,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1154,6 +1161,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1640,9 +1650,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,20 @@
|
||||
@str.95 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.96 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -548,7 +560,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1615,9 +1625,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,20 @@
|
||||
@str.95 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.96 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -548,7 +560,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1615,9 +1625,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,20 @@
|
||||
@str.95 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.96 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -548,7 +560,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1615,9 +1625,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,20 @@
|
||||
@str.95 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.96 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -548,7 +560,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1615,9 +1625,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,20 @@
|
||||
@str.95 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.96 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -548,7 +560,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1615,9 +1625,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,20 @@
|
||||
@str.95 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.96 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -548,7 +560,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1612,9 +1622,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,20 @@
|
||||
@str.95 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.96 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -548,7 +560,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1615,9 +1625,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,20 @@
|
||||
@str.95 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@str.96 = private unnamed_addr constant [4 x i8] c"ok\0A\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
define internal void @out(ptr %0, { ptr, i64 } %1) #0 {
|
||||
entry:
|
||||
%alloca = alloca { ptr, i64 }, align 8
|
||||
store { ptr, i64 } %1, ptr %alloca, align 8
|
||||
%load = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%dptr = extractvalue { ptr, i64 } %load, 0
|
||||
%loadN = load { ptr, i64 }, ptr %alloca, align 8
|
||||
%len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%call = call i64 @write(i32 1, ptr %dptr, i64 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -37,7 +49,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define internal { ptr, i64 } @alloc_string(ptr %0, i64 %1) #0 {
|
||||
@@ -548,7 +560,7 @@ if.merge.38: ; preds = %if.then.37, %while.
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -640,8 +652,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -1065,9 +1075,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -1152,6 +1159,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1613,9 +1623,7 @@ entry:
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %load, { ptr, i64 } %call)
|
||||
store { ptr, i64 } %callN, ptr %allocaN, align 8
|
||||
%loadN = load { ptr, i64 }, ptr %allocaN, align 8
|
||||
%str.ptr = extractvalue { ptr, i64 } %loadN, 0
|
||||
%str.len = extractvalue { ptr, i64 } %loadN, 1
|
||||
%1 = call i64 @write(i32 1, ptr %str.ptr, i64 %str.len)
|
||||
call void @out(ptr %0, { ptr, i64 } %loadN)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
@g_held_view = internal global ptr null
|
||||
@__sx_default_context = internal constant { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc_bytes, ptr @__thunk_CAllocator_Allocator_dealloc_bytes }, ptr null }
|
||||
@str = private unnamed_addr constant [9 x i8] c"onCreate\00", align 1
|
||||
@str.114 = private unnamed_addr constant [23 x i8] c"(Landroid/os/Bundle;)V\00", align 1
|
||||
@str.112 = private unnamed_addr constant [23 x i8] c"(Landroid/os/Bundle;)V\00", align 1
|
||||
@jni.parent.path = private unnamed_addr constant [21 x i8] c"android/app/Activity\00", align 1
|
||||
@str.115 = private unnamed_addr constant [7 x i8] c"<init>\00", align 1
|
||||
@str.116 = private unnamed_addr constant [29 x i8] c"(Landroid/content/Context;)V\00", align 1
|
||||
@str.113 = private unnamed_addr constant [7 x i8] c"<init>\00", align 1
|
||||
@str.114 = private unnamed_addr constant [29 x i8] c"(Landroid/content/Context;)V\00", align 1
|
||||
@jni.ctor.path = private unnamed_addr constant [25 x i8] c"android/view/SurfaceView\00", align 1
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out(ptr) #0
|
||||
declare void @out(ptr, ptr) #0
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
@@ -20,7 +22,7 @@ declare ptr @memcpy(ptr, ptr, i64)
|
||||
declare ptr @memset(ptr, i32, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.1(ptr) #0
|
||||
declare void @out.1(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @alloc_string(ptr, i64) #0
|
||||
@@ -71,7 +73,7 @@ declare ptr @any_to_string(ptr, [2 x i64]) #0
|
||||
declare ptr @build_format(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @out.2(ptr) #0
|
||||
declare void @out.2(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @mem_realloc(ptr, ptr, ptr, i64, i64, i64) #0
|
||||
@@ -163,8 +165,6 @@ declare i32 @close(i32) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @read(i32, ptr, i64) #0
|
||||
|
||||
declare i64 @write(i32, ptr, i64)
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @lseek(i32, i64, i32) #0
|
||||
|
||||
@@ -588,9 +588,6 @@ declare ptr @BuildOptions.asset_dir_src_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.asset_dir_dest_at(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module(i64, ptr) #0
|
||||
|
||||
@@ -675,6 +672,9 @@ declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options() #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @set_post_link_callback(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @spaces.44(ptr, i32) #0
|
||||
|
||||
@@ -1069,91 +1069,85 @@ declare ptr @BuildOptions.asset_dir_src_at.83(i64, i64) #0
|
||||
declare ptr @BuildOptions.asset_dir_dest_at.84(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_callback.85(i64, ptr) #0
|
||||
declare void @BuildOptions.set_post_link_module.85(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_post_link_module.86(i64, ptr) #0
|
||||
declare ptr @BuildOptions.binary_path.86(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.binary_path.87(i64) #0
|
||||
declare void @BuildOptions.set_bundle_path.87(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_path.88(i64, ptr) #0
|
||||
declare void @BuildOptions.set_bundle_id.88(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_bundle_id.89(i64, ptr) #0
|
||||
declare void @BuildOptions.set_codesign_identity.89(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_codesign_identity.90(i64, ptr) #0
|
||||
declare void @BuildOptions.set_provisioning_profile.90(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_provisioning_profile.91(i64, ptr) #0
|
||||
declare ptr @BuildOptions.bundle_path.91(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_path.92(i64) #0
|
||||
declare ptr @BuildOptions.bundle_id.92(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.bundle_id.93(i64) #0
|
||||
declare ptr @BuildOptions.codesign_identity.93(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.codesign_identity.94(i64) #0
|
||||
declare ptr @BuildOptions.provisioning_profile.94(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.provisioning_profile.95(i64) #0
|
||||
declare ptr @BuildOptions.target_triple.95(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.target_triple.96(i64) #0
|
||||
declare i1 @BuildOptions.is_macos.96(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_macos.97(i64) #0
|
||||
declare i1 @BuildOptions.is_ios.97(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios.98(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_device.98(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_device.99(i64) #0
|
||||
declare i1 @BuildOptions.is_ios_simulator.99(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_ios_simulator.100(i64) #0
|
||||
declare i1 @BuildOptions.is_android.100(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @BuildOptions.is_android.101(i64) #0
|
||||
declare i64 @BuildOptions.framework_count.101(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_count.102(i64) #0
|
||||
declare ptr @BuildOptions.framework_at.102(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_at.103(i64, i64) #0
|
||||
declare i64 @BuildOptions.framework_path_count.103(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.framework_path_count.104(i64) #0
|
||||
declare ptr @BuildOptions.framework_path_at.104(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.framework_path_at.105(i64, i64) #0
|
||||
declare void @BuildOptions.set_manifest_path.105(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_manifest_path.106(i64, ptr) #0
|
||||
declare void @BuildOptions.set_keystore_path.106(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.set_keystore_path.107(i64, ptr) #0
|
||||
declare ptr @BuildOptions.manifest_path.107(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.manifest_path.108(i64) #0
|
||||
declare ptr @BuildOptions.keystore_path.108(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.keystore_path.109(i64) #0
|
||||
declare i64 @BuildOptions.jni_main_count.109(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @BuildOptions.jni_main_count.110(i64) #0
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.110(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i64 @build_options.113() #0
|
||||
declare ptr @BuildOptions.jni_main_java_source_at.111(i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @main() #0 {
|
||||
@@ -1193,7 +1187,7 @@ entry:
|
||||
%jni.parent.cls = call ptr %jni.FindClass(ptr %load, ptr @jni.parent.path)
|
||||
%4 = getelementptr inbounds ptr, ptr %jni.ifs, i32 33
|
||||
%jni.GetMethodID = load ptr, ptr %4, align 8
|
||||
%jni.mid = call ptr %jni.GetMethodID(ptr %load, ptr %jni.parent.cls, ptr @str, ptr @str.114)
|
||||
%jni.mid = call ptr %jni.GetMethodID(ptr %load, ptr %jni.parent.cls, ptr @str, ptr @str.112)
|
||||
%jni.parent.cls.slot = alloca ptr, align 8
|
||||
store ptr %jni.parent.cls, ptr %jni.parent.cls.slot, align 8
|
||||
%5 = getelementptr inbounds ptr, ptr %jni.ifs, i32 91
|
||||
@@ -1209,7 +1203,7 @@ entry:
|
||||
%jni.ctor.cls = call ptr %jni.FindClass9(ptr %load, ptr @jni.ctor.path)
|
||||
%7 = getelementptr inbounds ptr, ptr %jni.ifs8, i32 33
|
||||
%jni.GetMethodID10 = load ptr, ptr %7, align 8
|
||||
%jni.ctor.mid = call ptr %jni.GetMethodID10(ptr %load, ptr %jni.ctor.cls, ptr @str.115, ptr @str.116)
|
||||
%jni.ctor.mid = call ptr %jni.GetMethodID10(ptr %load, ptr %jni.ctor.cls, ptr @str.113, ptr @str.114)
|
||||
%8 = getelementptr inbounds ptr, ptr %jni.ifs8, i32 28
|
||||
%jni.NewObject = load ptr, ptr %8, align 8
|
||||
%jni.new.obj = call ptr %jni.NewObject(ptr %load, ptr %jni.ctor.cls, ptr %jni.ctor.mid, ptr %loadN)
|
||||
|
||||
@@ -22,12 +22,6 @@ BuildOptions :: struct #compiler {
|
||||
asset_dir_src_at :: (self: BuildOptions, i: i64) -> string;
|
||||
asset_dir_dest_at :: (self: BuildOptions, i: i64) -> string;
|
||||
|
||||
// Post-link callback. Registers a sx function the compiler will
|
||||
// invoke after `target.link()` returns. Used by the sx-side
|
||||
// bundler (`platform.bundle.bundle_main`) and by user programs
|
||||
// that want custom post-build steps. Return `false` to fail the build.
|
||||
set_post_link_callback :: (self: BuildOptions, cb: () -> bool);
|
||||
|
||||
// Name-based alternative to `set_post_link_callback`. The
|
||||
// compiler resolves `<module_name>.bundle_main` after linking.
|
||||
set_post_link_module :: (self: BuildOptions, module_name: [:0]u8);
|
||||
@@ -91,4 +85,12 @@ BuildOptions :: struct #compiler {
|
||||
jni_main_java_source_at :: (self: BuildOptions, i: i64) -> string;
|
||||
}
|
||||
|
||||
build_options :: () -> BuildOptions #compiler;
|
||||
build_options :: () -> BuildOptions abi(.compiler);
|
||||
|
||||
// Post-link callback. Registers a sx function the compiler will invoke after
|
||||
// `target.link()` returns. Used by the sx-side bundler
|
||||
// (`platform.bundle.bundle_main`) and by user programs that want custom
|
||||
// post-build steps. Return `false` to fail the build. Migrated off `#compiler`
|
||||
// onto the comptime compiler-API (`abi(.compiler)`); called as
|
||||
// `opts.set_post_link_callback(cb)` via UFCS, from inside a `#run { … }` block.
|
||||
set_post_link_callback :: ufcs (self: BuildOptions, cb: () -> bool) abi(.compiler);
|
||||
|
||||
@@ -24,7 +24,12 @@
|
||||
// }
|
||||
// =====================================================================
|
||||
|
||||
bundle_main :: () -> bool {
|
||||
// `bundle_main` is the post-link callback — it runs in the comptime evaluator
|
||||
// (interp/VM) after `target.link()`, NEVER in the shipped binary. Marked
|
||||
// `abi(.compiler)` so the backend doesn't lower it and its `build_options()`
|
||||
// compiler-API call is permitted (it would otherwise be rejected as a
|
||||
// comptime-only function called at runtime).
|
||||
bundle_main :: () -> bool abi(.compiler) {
|
||||
opts := build_options();
|
||||
binary := opts.binary_path();
|
||||
bundle := opts.bundle_path();
|
||||
|
||||
@@ -4,7 +4,14 @@
|
||||
// never import this file directly — std.sx re-exports every name here.
|
||||
|
||||
Vector :: ($N: int, $T: Type) -> Type #builtin;
|
||||
out :: (str: string) -> void #builtin;
|
||||
// `out` writes a string straight to fd 1 via libc `write` — a plain sx function,
|
||||
// NOT a compiler builtin. At comptime it runs through the evaluator's host-FFI
|
||||
// escape (the VM's dlsym path / the interp's extern call); at runtime it's an
|
||||
// ordinary libc call. `libc_write` is the raw escape hatch (cf. libc_malloc/free).
|
||||
libc_write :: (fd: i32, buf: [*]u8, count: usize) -> isize extern libc "write";
|
||||
out :: (str: string) -> void {
|
||||
libc_write(1, str.ptr, xx str.len);
|
||||
}
|
||||
// sqrt :: (x: $T) -> T #builtin;
|
||||
// sin :: (x: $T) -> T #builtin;
|
||||
// cos :: (x: $T) -> T #builtin;
|
||||
|
||||
@@ -132,9 +132,15 @@ pub const Root = struct {
|
||||
/// - `.zig` — welded to the real internal Zig type/fn: layout follows the bound
|
||||
/// Zig type, functions dispatch over the comptime host-call bridge. The
|
||||
/// `compiler` library (`design/comptime-compiler-api.md`) binds via `abi(.zig)`.
|
||||
/// - `.compiler` — a COMPILER-DOMAIN function: it runs in the comptime evaluator
|
||||
/// (VM / interp), NEVER in the shipped binary, so the backend does not lower it.
|
||||
/// Covers the compiler-API surface (`intern`/`find_type`/`build_options`/… —
|
||||
/// bodiless decls whose Zig/VM handler is the impl) AND user compiler-domain
|
||||
/// functions like post-link callbacks (bodied, but emit-skipped). The ABI alone
|
||||
/// marks it — there is no `extern <lib>` and no fake `#library "compiler"`.
|
||||
/// - `.pure` — a pure / naked function (inline asm body), no calling-convention
|
||||
/// prologue/epilogue.
|
||||
pub const ABI = enum { default, c, zig, pure };
|
||||
pub const ABI = enum { default, c, compiler, pure };
|
||||
|
||||
/// Linkage modifier written in the postfix slot before `abi(...)`:
|
||||
/// `name :: (sig) -> Ret [extern | export] [abi(.x)] [lib] [;|{…}];`
|
||||
|
||||
@@ -1119,13 +1119,23 @@ pub const Ops = struct {
|
||||
// wrapper, `is_comptime`) is fine — that body is interp-evaluated and its
|
||||
// LLVM emission is dead, so skip the gate there.
|
||||
const enclosing = &self.e.ir_mod.functions.items[self.e.current_func_idx];
|
||||
if (callee_func.compiler_welded and !enclosing.is_comptime) {
|
||||
if ((callee_func.compiler_welded or callee_func.is_compiler_domain) and !enclosing.is_comptime) {
|
||||
const fname = self.e.ir_mod.types.getString(callee_func.name);
|
||||
std.debug.print("error: '{s}' is a comptime-only compiler-library function — it cannot be called at runtime (use it inside #run or a comptime '::')\n", .{fname});
|
||||
std.debug.print("error: '{s}' is a comptime-only compiler-domain function — it cannot be called at runtime (use it inside #run or a comptime '::')\n", .{fname});
|
||||
self.e.comptime_failed = true;
|
||||
self.e.mapRef(c.LLVMGetUndef(self.e.toLLVMType(instruction.ty)));
|
||||
return;
|
||||
}
|
||||
// A comptime-only callee (compiler-API or compiler-domain) reached here from
|
||||
// a COMPTIME (dead) body — the enclosing `#run`/`::` wrapper whose LLVM is
|
||||
// never executed. Such a function has no runtime symbol, so emit `undef`
|
||||
// instead of a real `call` (which would leave an undefined reference for the
|
||||
// AOT linker). The comptime VALUE is produced by the interp/VM, not this dead
|
||||
// body. Mirrors the old `compiler_call` → undef.
|
||||
if (callee_func.compiler_welded or callee_func.is_compiler_domain) {
|
||||
self.e.mapRef(c.LLVMGetUndef(self.e.toLLVMType(instruction.ty)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (callee_func.is_comptime and call_op.args.len == 0) {
|
||||
var interp_inst = Interpreter.init(self.e.ir_mod, self.e.alloc);
|
||||
@@ -1377,25 +1387,6 @@ pub const Ops = struct {
|
||||
self.e.mapRef(c.LLVMBuildCall2(self.e.builder, self.e.getMathF64Type(), f, &args, 1, @tagName(bi.builtin)));
|
||||
}
|
||||
},
|
||||
.out => {
|
||||
// out(str): extract ptr and len from string fat pointer, call write(1, ptr, len)
|
||||
const str_val = self.e.resolveRef(bi.args[0]);
|
||||
const raw_ptr = c.LLVMBuildExtractValue(self.e.builder, str_val, 0, "str.ptr");
|
||||
const str_len = c.LLVMBuildExtractValue(self.e.builder, str_val, 1, "str.len");
|
||||
// On wasm32, count param is i32 (size_t)
|
||||
const count = if (self.e.target_config.isWasm32())
|
||||
c.LLVMBuildTrunc(self.e.builder, str_len, self.e.cached_i32, "len.tr")
|
||||
else
|
||||
str_len;
|
||||
const write_fn = self.e.getOrDeclareWrite();
|
||||
var write_args = [_]c.LLVMValueRef{
|
||||
c.LLVMConstInt(self.e.cached_i32, 1, 0), // fd = stdout
|
||||
raw_ptr,
|
||||
count,
|
||||
};
|
||||
_ = c.LLVMBuildCall2(self.e.builder, self.e.getWriteType(), write_fn, &write_args, 3, "");
|
||||
self.e.advanceRefCounter();
|
||||
},
|
||||
.type_name => {
|
||||
// Dynamic `type_name(t)` at runtime: resolve the TypeId
|
||||
// the arg denotes (reading an `Any`'s runtime type-tag,
|
||||
|
||||
@@ -58,6 +58,9 @@ pub const bound_fns = [_]BoundFn{
|
||||
.{ .sx_name = "declare_type", .handler = handleDeclareType },
|
||||
.{ .sx_name = "pointer_to", .handler = handlePointerTo },
|
||||
.{ .sx_name = "register_type", .handler = handleRegisterType },
|
||||
// ── BuildOptions (migrated off `#compiler` onto `abi(.compiler)`) ─────────
|
||||
.{ .sx_name = "build_options", .handler = handleBuildOptions },
|
||||
.{ .sx_name = "set_post_link_callback", .handler = handleSetPostLinkCallback },
|
||||
};
|
||||
|
||||
// Kind codes accepted by `register_type` — mirror `TypeTable.kindCode`. An
|
||||
@@ -307,3 +310,27 @@ fn memberPair(elem: Value) ?struct { name: []const u8, ty: types.TypeId } {
|
||||
const ty = f[1].asTypeId() orelse return null;
|
||||
return .{ .name = name, .ty = ty };
|
||||
}
|
||||
|
||||
// ── BuildOptions handlers (legacy dual-path, gate-OFF) ──────────────────────
|
||||
// The `abi(.compiler)` re-expression of `build_options` + `set_post_link_callback`,
|
||||
// reading the build config off the interpreter (`interp.build_config`). The VM
|
||||
// services the same names in `comptime_vm.callCompilerFn`; both stay in lockstep.
|
||||
|
||||
/// `build_options() -> BuildOptions` — hand back the opaque zero-field handle. The
|
||||
/// state lives on `interp.build_config`; the handle is never dereferenced.
|
||||
fn handleBuildOptions(_: *Interpreter, _: []const Value) InterpError!Value {
|
||||
return .void_val;
|
||||
}
|
||||
|
||||
/// `set_post_link_callback(self, cb)` — record the callback `FuncId` on the build
|
||||
/// config so `main.zig` re-enters the evaluator post-link. The `cb` arg is a
|
||||
/// `.func_ref` value.
|
||||
fn handleSetPostLinkCallback(interp: *Interpreter, args: []const Value) InterpError!Value {
|
||||
if (args.len != 2) return error.TypeError;
|
||||
const bc = interp.build_config orelse return error.CannotEvalComptime;
|
||||
switch (args[1]) {
|
||||
.func_ref => |id| bc.post_link_callback_fn = id,
|
||||
else => return error.TypeError,
|
||||
}
|
||||
return .void_val;
|
||||
}
|
||||
|
||||
@@ -376,6 +376,55 @@ test "comptime_vm exec: const_string length + str_eq/str_ne" {
|
||||
try std.testing.expectEqual(@as(i64, 3), toI64(try v.run(&fb.func, &.{})));
|
||||
}
|
||||
|
||||
test "comptime_vm exec: error_tag_name_get maps a tag id to its name string" {
|
||||
const alloc = std.testing.allocator;
|
||||
var table = types.TypeTable.init(alloc);
|
||||
defer table.deinit();
|
||||
_ = table.internTag("Foo");
|
||||
const bad = table.internTag("Bad"); // the tag we'll resolve
|
||||
|
||||
// return error_tag_name(<bad tag id>) → the string "Bad"
|
||||
var fb = Fb.init(alloc, &.{}, .string);
|
||||
defer fb.deinit();
|
||||
const b0 = fb.block(&.{});
|
||||
const id = fb.add(b0, inst(.{ .const_int = @intCast(bad) }, .i64));
|
||||
const name = fb.add(b0, inst(.{ .error_tag_name_get = .{ .operand = ref(id) } }, .string));
|
||||
_ = fb.add(b0, inst(.{ .ret = .{ .operand = ref(name) } }, .void));
|
||||
|
||||
var v = vm.Vm.init(alloc);
|
||||
v.table = &table;
|
||||
defer v.deinit();
|
||||
const word = try v.run(&fb.func, &.{});
|
||||
const val = try v.regToValue(alloc, &table, word, .string);
|
||||
defer alloc.free(val.string); // regToValue dupes the bytes
|
||||
try std.testing.expectEqualStrings("Bad", val.string);
|
||||
}
|
||||
|
||||
test "comptime_vm exec: type_is_unsigned(u32) - type_is_unsigned(i64) == 1" {
|
||||
const alloc = std.testing.allocator;
|
||||
var table = types.TypeTable.init(alloc);
|
||||
defer table.deinit();
|
||||
|
||||
// r_u := type_is_unsigned(u32) → 1 ; r_s := type_is_unsigned(i64) → 0
|
||||
// return r_u - r_s → 1 (only the correct unsigned/signed verdicts give 1)
|
||||
var fb = Fb.init(alloc, &.{}, .i64);
|
||||
defer fb.deinit();
|
||||
const b0 = fb.block(&.{});
|
||||
const ct_u = fb.add(b0, inst(.{ .const_type = .u32 }, .type_value));
|
||||
const au = [_]Ref{ref(ct_u)};
|
||||
const r_u = fb.add(b0, inst(.{ .call_builtin = .{ .builtin = .type_is_unsigned, .args = &au } }, .bool));
|
||||
const ct_s = fb.add(b0, inst(.{ .const_type = .i64 }, .type_value));
|
||||
const as = [_]Ref{ref(ct_s)};
|
||||
const r_s = fb.add(b0, inst(.{ .call_builtin = .{ .builtin = .type_is_unsigned, .args = &as } }, .bool));
|
||||
const diff = fb.add(b0, inst(.{ .sub = .{ .lhs = ref(r_u), .rhs = ref(r_s) } }, .i64));
|
||||
_ = fb.add(b0, inst(.{ .ret = .{ .operand = ref(diff) } }, .void));
|
||||
|
||||
var v = vm.Vm.init(alloc);
|
||||
v.table = &table;
|
||||
defer v.deinit();
|
||||
try std.testing.expectEqual(@as(i64, 1), toI64(try v.run(&fb.func, &.{})));
|
||||
}
|
||||
|
||||
test "comptime_vm exec: array_to_slice + index through slice + slice length" {
|
||||
const alloc = std.testing.allocator;
|
||||
var table = types.TypeTable.init(alloc);
|
||||
@@ -1262,7 +1311,7 @@ test "comptime_vm tryEval: pure function → Value; unsupported → null" {
|
||||
_ = fb.add(b0, inst(.{ .ret = .{ .operand = ref(m) } }, .void));
|
||||
const ok_id = module.addFunction(fb.func);
|
||||
|
||||
const v = vm.tryEval(alloc, &module, ok_id) orelse return error.VmShouldHaveHandledIt;
|
||||
const v = vm.tryEval(alloc, &module, ok_id, null, null) orelse return error.VmShouldHaveHandledIt;
|
||||
try std.testing.expectEqual(@as(i64, 42), v.int);
|
||||
|
||||
// fn bad() { compiler_call() } → an unported op → tryEval yields null (caller
|
||||
@@ -1274,7 +1323,7 @@ test "comptime_vm tryEval: pure function → Value; unsupported → null" {
|
||||
_ = fb2.add(c0, inst(.ret_void, .void));
|
||||
const bad_id = module.addFunction(fb2.func);
|
||||
|
||||
try std.testing.expect(vm.tryEval(alloc, &module, bad_id) == null);
|
||||
try std.testing.expect(vm.tryEval(alloc, &module, bad_id, null, null) == null);
|
||||
}
|
||||
|
||||
test "comptime_vm exec: division by zero and unsupported op bail loudly" {
|
||||
@@ -1432,7 +1481,7 @@ test "comptime_vm tryEval: deref of a null pointer bails (null, not a crash)" {
|
||||
|
||||
// The hardened accessors turn the null deref into error.OutOfBounds → run
|
||||
// bails → tryEval returns null (legacy fallback), NOT a debug panic.
|
||||
try std.testing.expect(vm.tryEval(alloc, &module, bad_id) == null);
|
||||
try std.testing.expect(vm.tryEval(alloc, &module, bad_id, null, null) == null);
|
||||
}
|
||||
|
||||
test "comptime_vm: arena allocations are aligned, non-null, and stable across grows" {
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
//! The comptime evaluator is being rebuilt around a flat, byte-addressable memory
|
||||
//! so comptime values are NATIVE BYTES (like runtime), instead of the tagged
|
||||
//! `Value` union the legacy interpreter (`interp.zig`) uses. This module is the
|
||||
//! machine substrate: a linear byte memory with a bump/stack allocator, plus a
|
||||
//! per-call `Frame` holding a register file.
|
||||
//! machine substrate: byte-addressable memory backed by an ARENA of stable host
|
||||
//! allocations (each `allocBytes` never moves; freed wholesale on `deinit`), plus
|
||||
//! a per-call `Frame` holding a register file. `Addr` is the allocation's real
|
||||
//! host pointer, so a flat-memory pointer and an FFI-returned host pointer are the
|
||||
//! same kind of value.
|
||||
//!
|
||||
//! Value model (grows over later sub-steps): a register (`Reg`) is a raw 64-bit
|
||||
//! word that is EITHER an immediate scalar (its bits) OR an `Addr` into flat
|
||||
@@ -17,9 +20,10 @@
|
||||
//! bytes. Layout (sizes/offsets/pointer width) is supplied by the type table when
|
||||
//! the executor lays a value out, so cross-compilation stays correct.
|
||||
//!
|
||||
//! Sub-step 1 (this file): `Machine` (memory + bump/stack alloc + scalar word
|
||||
//! read/write + byte views) and `Frame` (register file + stack reclamation). No
|
||||
//! op execution yet — the executor + op handlers arrive in the next sub-step. The
|
||||
//! `Machine` (arena-backed memory + scalar word read/write + byte views) holds the
|
||||
//! comptime stack + heap; `Frame` is the per-call register file. A `Frame` does NOT
|
||||
//! reclaim the machine's memory on exit — a callee can return an aggregate whose
|
||||
//! register holds an `Addr` into flat memory, and reclaiming would dangle it. The
|
||||
//! legacy interpreter remains the live evaluator until the VM reaches parity.
|
||||
|
||||
const std = @import("std");
|
||||
@@ -28,6 +32,7 @@ const types = @import("types.zig");
|
||||
const mod_mod = @import("module.zig");
|
||||
const interp_mod = @import("interp.zig");
|
||||
const host_ffi = @import("host_ffi.zig");
|
||||
const errors_mod = @import("../errors.zig");
|
||||
const Value = interp_mod.Value;
|
||||
const Inst = inst_mod.Inst;
|
||||
const Ref = inst_mod.Ref;
|
||||
@@ -186,7 +191,7 @@ pub var last_bail_reason: ?[]const u8 = null;
|
||||
/// hardened to return `error.OutOfBounds` (not a debug panic) on a null/out-of-
|
||||
/// range/oversized access, so a malformed run bails to `null` (→ legacy fallback)
|
||||
/// rather than crashing the compiler. On a bail, `last_bail_reason` names the cause.
|
||||
pub fn tryEval(gpa: std.mem.Allocator, module: *const Module, func_id: inst_mod.FuncId) ?Value {
|
||||
pub fn tryEval(gpa: std.mem.Allocator, module: *const Module, func_id: inst_mod.FuncId, build_config: ?*interp_mod.BuildConfig, source_map: ?*const std.StringHashMap([:0]const u8)) ?Value {
|
||||
last_bail_reason = null;
|
||||
const func = module.getFunction(func_id);
|
||||
if (func.is_extern or func.blocks.items.len == 0) {
|
||||
@@ -197,6 +202,8 @@ pub fn tryEval(gpa: std.mem.Allocator, module: *const Module, func_id: inst_mod.
|
||||
defer vm.deinit();
|
||||
vm.table = &module.types;
|
||||
vm.module = module;
|
||||
vm.build_config = build_config;
|
||||
vm.source_map = source_map;
|
||||
|
||||
// `runEntry` materializes the implicit `*Context` (a comptime const-init /
|
||||
// `#run` wrapper is nullary in user args, so the implicit ctx is its sole
|
||||
@@ -276,6 +283,16 @@ pub const Vm = struct {
|
||||
/// The module — resolves a `call`'s callee `FuncId` to its `Function`. Optional
|
||||
/// so leaf functions (no calls) need none; a `call` bails loudly if it is absent.
|
||||
module: ?*const Module = null,
|
||||
/// The mutable build configuration (`BuildOptions` accumulator) — the SAME
|
||||
/// `BuildConfig` `EmitLLVM` owns and `main.zig` reads post-link. Threaded in at
|
||||
/// the `#run`/const-init eval sites so an `abi(.compiler)` `BuildOptions` function
|
||||
/// (e.g. `set_post_link_callback`) records into it directly. Null at lowering-time
|
||||
/// type-fn evals (no build config exists yet); such a function bails loudly.
|
||||
build_config: ?*interp_mod.BuildConfig = null,
|
||||
/// File → source text (the diagnostics' `import_sources`), threaded from the host
|
||||
/// so `trace_resolve` can turn a packed `(func_id, span.start)` comptime frame into
|
||||
/// `file:line:col` + the source line. Null → line/col degrade to 1 / "".
|
||||
source_map: ?*const std.StringHashMap([:0]const u8) = null,
|
||||
/// Current call-recursion depth, guarded against host stack overflow on deep /
|
||||
/// infinite comptime recursion (mirrors the legacy interp's `call_depth`).
|
||||
depth: u32 = 0,
|
||||
@@ -819,6 +836,76 @@ pub const Vm = struct {
|
||||
const fid: u64 = if (self.call_stack.items.len > 0) self.call_stack.items[self.call_stack.items.len - 1].index() else 0;
|
||||
return .{ .value = (fid << 32) | @as(u64, ins.span.start) };
|
||||
},
|
||||
// Dump the comptime call-frame chain (`trace.print_interpreter_frames`) —
|
||||
// the VM-native mirror of the legacy `printInterpFrames`. Walks the active
|
||||
// `call_stack` (skipping the last frame, the `print_interpreter_frames`
|
||||
// fn itself, like the legacy) and writes ` at <name>` lines straight to
|
||||
// fd 1 (consistent with `out`'s now-direct libc `write`).
|
||||
.interp_print_frames => {
|
||||
const module = self.module orelse return self.failMsg("comptime interp_print_frames: no module");
|
||||
const n = self.call_stack.items.len;
|
||||
if (n <= 1) return .{ .value = null_addr };
|
||||
var buf = std.ArrayList(u8).empty;
|
||||
defer buf.deinit(self.gpa);
|
||||
buf.appendSlice(self.gpa, "comptime call frames (most recent call last):\n") catch return self.failMsg("comptime interp_print_frames: out of memory");
|
||||
var i: usize = 0;
|
||||
while (i < n - 1) : (i += 1) {
|
||||
const fname = module.types.getString(module.getFunction(self.call_stack.items[i]).name);
|
||||
buf.appendSlice(self.gpa, " at ") catch return self.failMsg("comptime interp_print_frames: out of memory");
|
||||
buf.appendSlice(self.gpa, fname) catch return self.failMsg("comptime interp_print_frames: out of memory");
|
||||
buf.append(self.gpa, '\n') catch return self.failMsg("comptime interp_print_frames: out of memory");
|
||||
}
|
||||
_ = std.c.write(1, buf.items.ptr, buf.items.len);
|
||||
return .{ .value = null_addr };
|
||||
},
|
||||
// Unpack a comptime frame `(func_id << 32 | span.start)` and build a
|
||||
// `Frame { file, line, col, func, line_text }` aggregate in flat memory —
|
||||
// the VM-native mirror of the legacy interp's `.trace_resolve`. `ins.ty`
|
||||
// is the `Frame` struct, so each field's type/offset comes from the table.
|
||||
.trace_resolve => |u| {
|
||||
const table = try self.requireTable();
|
||||
const module = self.module orelse return self.failMsg("comptime trace_resolve: no module");
|
||||
const raw = frame.get(u.operand.index());
|
||||
const fid: u32 = @intCast(raw >> 32);
|
||||
const offset: u32 = @truncate(raw);
|
||||
if (fid >= module.functions.items.len) return self.failMsg("comptime trace_resolve: func id out of range");
|
||||
const func = module.getFunction(inst_mod.FuncId.fromIndex(fid));
|
||||
const func_name = module.types.getString(func.name);
|
||||
const file_full = func.source_file orelse "";
|
||||
const file = std.fs.path.basename(file_full);
|
||||
var line: i64 = 1;
|
||||
var col: i64 = 1;
|
||||
var line_text: []const u8 = "";
|
||||
if (self.source_map) |sm| {
|
||||
if (sm.get(file_full)) |src| {
|
||||
const loc = errors_mod.SourceLoc.compute(src, offset);
|
||||
line = @intCast(loc.line);
|
||||
col = @intCast(loc.col);
|
||||
line_text = errors_mod.lineAt(src, offset);
|
||||
}
|
||||
}
|
||||
const fty = ins.ty;
|
||||
if (fty.isBuiltin() or table.get(fty) != .@"struct")
|
||||
return self.failMsg("comptime trace_resolve: result type is not a Frame struct");
|
||||
const sfields = table.get(fty).@"struct".fields;
|
||||
if (sfields.len != 5) return self.failMsg("comptime trace_resolve: Frame struct is not 5 fields");
|
||||
const addr = self.machine.allocBytes(table.typeSizeBytes(fty), table.typeAlignBytes(fty));
|
||||
// { file, line, col, func, line_text } — positional, matching the legacy build.
|
||||
try self.writeField(table, addr + fieldOffset(table, fty, 0), sfields[0].ty, try self.makeStringValue(table, file));
|
||||
try self.writeField(table, addr + fieldOffset(table, fty, 1), sfields[1].ty, @bitCast(line));
|
||||
try self.writeField(table, addr + fieldOffset(table, fty, 2), sfields[2].ty, @bitCast(col));
|
||||
try self.writeField(table, addr + fieldOffset(table, fty, 3), sfields[3].ty, try self.makeStringValue(table, func_name));
|
||||
try self.writeField(table, addr + fieldOffset(table, fty, 4), sfields[4].ty, try self.makeStringValue(table, line_text));
|
||||
return .{ .value = addr };
|
||||
},
|
||||
// `error_tag_name(e)` — the runtime tag id (a word) → its name string via
|
||||
// the always-linked tag-name table. Pure: builds a `{ptr,len}` string in
|
||||
// flat memory. Mirrors the legacy interp's `error_tag_name_get`.
|
||||
.error_tag_name_get => |u| {
|
||||
const table = try self.requireTable();
|
||||
const id: u32 = @intCast(frame.get(u.operand.index()));
|
||||
return .{ .value = try self.makeStringValue(table, table.getTagName(id)) };
|
||||
},
|
||||
|
||||
// ── Calls ───────────────────────────────────────────
|
||||
// Direct call: resolve the static callee `FuncId` and dispatch.
|
||||
@@ -840,6 +927,21 @@ pub const Vm = struct {
|
||||
// `comptime_func` run on this same VM, or a scalar static value),
|
||||
// memoized. Mirrors the legacy interp's `getGlobal`.
|
||||
.global_get => |gid| return .{ .value = try self.evalGlobal(gid) },
|
||||
// `&global` — only `&__sx_default_context` is materialised at comptime
|
||||
// (its address sees runtime use via the implicit-ctx plumbing). Return
|
||||
// the context's flat-memory address — an aggregate value IS its address,
|
||||
// so a later `load`/field read sees the materialised Context. Mirrors the
|
||||
// legacy interp's `global_addr` (the sole supported global); any other
|
||||
// global bails to legacy fallback.
|
||||
.global_addr => |gid| {
|
||||
const module = self.module orelse return self.failMsg("comptime VM: global_addr needs a module");
|
||||
if (gid.index() < module.globals.items.len and
|
||||
std.mem.eql(u8, module.types.getString(module.globals.items[gid.index()].name), "__sx_default_context"))
|
||||
{
|
||||
return .{ .value = try self.materializeDefaultContext(module) };
|
||||
}
|
||||
return self.failMsg("comptime global_addr: only `&__sx_default_context` is materialised at comptime");
|
||||
},
|
||||
// A function value is its encoded func-ref word (see `funcRefWord`).
|
||||
.func_ref => |fid| return .{ .value = funcRefWord(fid) },
|
||||
|
||||
@@ -1005,6 +1107,14 @@ pub const Vm = struct {
|
||||
return error.Unsupported;
|
||||
}
|
||||
|
||||
/// Like `failMsg` but for a runtime-formatted reason (e.g. naming the offending
|
||||
/// variant). Allocated in `gpa` so it survives to the host's diagnostic render;
|
||||
/// the build fails on this path, so the small leak is moot.
|
||||
fn failFmt(self: *Vm, comptime fmt: []const u8, args: anytype) error{Unsupported} {
|
||||
self.detail = std.fmt.allocPrint(self.gpa, fmt, args) catch "comptime VM: out of memory formatting diagnostic";
|
||||
return error.Unsupported;
|
||||
}
|
||||
|
||||
fn badRef(self: *Vm) error{Unsupported} {
|
||||
self.detail = "comptime VM: malformed IR — operand ref out of range (unresolved name?)";
|
||||
return error.Unsupported;
|
||||
@@ -1322,6 +1432,26 @@ pub const Vm = struct {
|
||||
if (std.mem.eql(u8, name, "register_type")) {
|
||||
return self.registerTypeVm(args, frame, ref_types);
|
||||
}
|
||||
// ── BuildOptions (migrated off `#compiler` onto `abi(.compiler)`) ───────
|
||||
// `build_options()` hands back an opaque, zero-field `BuildOptions` handle;
|
||||
// the real state lives on the threaded `BuildConfig`. Return the null
|
||||
// sentinel word (the handle is never dereferenced — every operation takes it
|
||||
// as an ignored `self`). Mirrors the legacy `hookBuildOptions` (`.void_val`).
|
||||
if (std.mem.eql(u8, name, "build_options")) {
|
||||
return @as(Reg, null_addr);
|
||||
}
|
||||
// `set_post_link_callback(self, cb)` — record the callback `FuncId` on the
|
||||
// build config so `main.zig` re-enters the evaluator post-link. The cb arg is
|
||||
// a `func_ref` word. Mirrors the legacy `hookSetPostLinkCallback`.
|
||||
if (std.mem.eql(u8, name, "set_post_link_callback")) {
|
||||
if (args.len != 2) return self.failMsg("comptime set_post_link_callback: expected (self, cb)");
|
||||
const bc = self.build_config orelse
|
||||
return self.failMsg("comptime set_post_link_callback: no build config threaded into the VM");
|
||||
const fid = funcRefToId(frame.get(args[1].index())) orelse
|
||||
return self.failMsg("comptime set_post_link_callback: cb arg is not a function value");
|
||||
bc.post_link_callback_fn = fid;
|
||||
return @as(Reg, null_addr);
|
||||
}
|
||||
return null; // not a known compiler function → caller bails to legacy
|
||||
}
|
||||
|
||||
@@ -1428,7 +1558,7 @@ pub const Vm = struct {
|
||||
/// `Type` elements with no name) from flat memory into `TypeId`s.
|
||||
fn decodeTypeSlice(self: *Vm, table: *const types.TypeTable, slice_word: Reg, slice_ty: TypeId, out: *std.ArrayList(TypeId)) Error!void {
|
||||
if (slice_ty.isBuiltin() or table.get(slice_ty) != .slice)
|
||||
return self.failMsg("comptime define: tuple elements arg is not a slice");
|
||||
return self.failMsg("comptime define(): tuple elements arg is not a slice");
|
||||
const elem_ty = table.get(slice_ty).slice.element; // Type (.type_value)
|
||||
const len = try self.sliceLen(slice_word);
|
||||
const base = try self.sliceData(table, slice_word);
|
||||
@@ -1436,10 +1566,38 @@ pub const Vm = struct {
|
||||
for (0..@intCast(len)) |i| {
|
||||
const e = base + @as(Addr, @intCast(i)) * stride;
|
||||
const t: TypeId = @enumFromInt(@as(u32, @intCast(try self.readField(table, e, .type_value))));
|
||||
out.append(self.gpa, t) catch return self.failMsg("comptime define: out of memory");
|
||||
out.append(self.gpa, t) catch return self.failMsg("comptime define(): out of memory");
|
||||
}
|
||||
}
|
||||
|
||||
/// Resolve the `TypeId` a reflection builtin (`type_name` / `type_is_unsigned`)
|
||||
/// queries, given the arg's IR type `aty` and its register word `w`. A
|
||||
/// `.type_value` word IS a `TypeId`; an Any box `{ tag@0, value@8 }` yields its
|
||||
/// tag (the boxed value's runtime type), unless tag == `type_value` — a boxed
|
||||
/// Type (the `type_of(x)` shape) whose real id sits in the value slot. The
|
||||
/// VM-native mirror of the legacy `Value.reflectTypeId`.
|
||||
fn reflectArgTypeId(self: *Vm, aty: TypeId, w: Reg) Error!TypeId {
|
||||
// A `TypeId` index is a u32; a word that doesn't fit is a garbage/mis-read
|
||||
// value (e.g. a wrong slice stride yielding an `Any` element at the wrong
|
||||
// offset — see 0522). Bail loudly instead of letting `@intCast` abort: the
|
||||
// VM must never crash.
|
||||
if (aty == .type_value) return TypeId.fromIndex(try self.typeIdxOf(w));
|
||||
if (aty == .any) {
|
||||
const tag = try self.machine.readWord(w, 8);
|
||||
if (tag == @as(u64, TypeId.type_value.index()))
|
||||
return TypeId.fromIndex(try self.typeIdxOf(try self.machine.readWord(w + 8, 8)));
|
||||
return TypeId.fromIndex(try self.typeIdxOf(tag));
|
||||
}
|
||||
return self.failMsg("comptime reflection builtin: arg is not a Type value or an Any box");
|
||||
}
|
||||
|
||||
/// Narrow a 64-bit word to a `u32` `TypeId` index, bailing (never crashing) when
|
||||
/// it doesn't fit — the tripwire for a mis-read reflection arg.
|
||||
fn typeIdxOf(self: *Vm, w: u64) Error!u32 {
|
||||
return std.math.cast(u32, w) orelse
|
||||
self.failMsg("comptime reflection builtin: type word out of TypeId range (mis-read arg?)");
|
||||
}
|
||||
|
||||
/// Service a comptime metatype `#builtin` (`meta.sx`'s `declare`/`define`)
|
||||
/// natively on flat memory, the VM-native mirror of the legacy
|
||||
/// `interp.execBuiltinInner` arms. Returns the result word, or `null` for a
|
||||
@@ -1458,27 +1616,27 @@ pub const Vm = struct {
|
||||
// define(handle, info) → complete the declared slot from a TypeInfo VALUE.
|
||||
.define => {
|
||||
const table = try self.requireTable();
|
||||
if (bi.args.len != 2) return self.failMsg("comptime define: expected (handle, info)");
|
||||
if (bi.args.len != 2) return self.failMsg("comptime define(): expected (handle, info)");
|
||||
const handle = try self.argTypeId(bi.args, frame, 0);
|
||||
// `info`: a TypeInfo tagged-union value `{ tag@0, payload@tag_size }`.
|
||||
const info_ty = try self.refTy(ref_types, bi.args[1]);
|
||||
if (info_ty.isBuiltin() or table.get(info_ty) != .tagged_union)
|
||||
return self.failMsg("comptime define: info arg is not a TypeInfo tagged union");
|
||||
return self.failMsg("comptime define(): info arg is not a TypeInfo tagged union");
|
||||
const tu = table.get(info_ty).tagged_union;
|
||||
// The `{ tag@0, payload@tag_size }` read below assumes a tag-headed
|
||||
// layout (true for `TypeInfo`); a `backing_type` union is laid out
|
||||
// differently, so bail rather than read the tag from the wrong bytes.
|
||||
if (tu.backing_type != null)
|
||||
return self.failMsg("comptime define: info is a backing_type tagged union (unexpected layout)");
|
||||
return self.failMsg("comptime define(): info is a backing_type tagged union (unexpected layout)");
|
||||
const info_addr = frame.get(bi.args[1].index());
|
||||
const tag_size: Addr = @intCast(table.typeSizeBytes(tu.tag_type));
|
||||
const tag = try self.machine.readWord(info_addr, tag_size);
|
||||
if (tag >= tu.fields.len) return self.failMsg("comptime define: TypeInfo tag out of range");
|
||||
if (tag >= tu.fields.len) return self.failMsg("comptime define(): TypeInfo tag out of range");
|
||||
// The active payload (EnumInfo / StructInfo / TupleInfo) is a struct
|
||||
// holding ONE slice field; its bytes live at `info_addr + tag_size`.
|
||||
const payload_ty = tu.fields[@intCast(tag)].ty;
|
||||
if (payload_ty.isBuiltin() or table.get(payload_ty) != .@"struct" or table.get(payload_ty).@"struct".fields.len != 1)
|
||||
return self.failMsg("comptime define: TypeInfo payload is not a single-slice info struct");
|
||||
return self.failMsg("comptime define(): TypeInfo payload is not a single-slice info struct");
|
||||
return try self.defineFromInfo(table, handle, @intCast(tag), payload_ty, info_addr + tag_size);
|
||||
},
|
||||
// type_name(x) → the type's name as a string. The arg is a Type value
|
||||
@@ -1488,20 +1646,19 @@ pub const Vm = struct {
|
||||
.type_name => {
|
||||
const table = try self.requireTable();
|
||||
if (bi.args.len < 1) return self.failMsg("comptime type_name: missing argument");
|
||||
const aty = try self.refTy(ref_types, bi.args[0]);
|
||||
const w = frame.get(bi.args[0].index());
|
||||
const tid: TypeId = blk: {
|
||||
if (aty == .type_value) break :blk TypeId.fromIndex(@intCast(w));
|
||||
if (aty == .any) {
|
||||
const tag = try self.machine.readWord(w, 8);
|
||||
if (tag == @as(u64, TypeId.type_value.index()))
|
||||
break :blk TypeId.fromIndex(@intCast(try self.machine.readWord(w + 8, 8)));
|
||||
break :blk TypeId.fromIndex(@intCast(tag));
|
||||
}
|
||||
return self.failMsg("comptime type_name: arg is not a Type value or an Any box");
|
||||
};
|
||||
const tid = try self.reflectArgTypeId(try self.refTy(ref_types, bi.args[0]), frame.get(bi.args[0].index()));
|
||||
return try self.makeStringValue(table, table.typeName(tid));
|
||||
},
|
||||
// type_is_unsigned(x) → is x's type an unsigned int? Resolves the TypeId
|
||||
// the same way as type_name (a `.type_value` word, or an Any box whose tag
|
||||
// IS the boxed value's type), then queries `isUnsignedInt`. Mirrors the
|
||||
// legacy `type_is_unsigned` builtin (`reflectTypeId` + `isUnsignedInt`).
|
||||
.type_is_unsigned => {
|
||||
const table = try self.requireTable();
|
||||
if (bi.args.len < 1) return self.failMsg("comptime type_is_unsigned: missing argument");
|
||||
const tid = try self.reflectArgTypeId(try self.refTy(ref_types, bi.args[0]), frame.get(bi.args[0].index()));
|
||||
return @as(Reg, @intFromBool(table.isUnsignedInt(tid)));
|
||||
},
|
||||
// type_info($T) → reflect a type INTO a TypeInfo VALUE (the inverse of
|
||||
// define's decode). The arg folded to a `const_type` (a `.type_value`
|
||||
// word = the source TypeId); build the value in flat memory.
|
||||
@@ -1528,8 +1685,8 @@ pub const Vm = struct {
|
||||
const tbl = @constCast(table);
|
||||
const cur = table.get(handle);
|
||||
const ident = nominalIdentOf(cur) orelse
|
||||
return self.failMsg("comptime define: handle is not a declare()'d nominal slot");
|
||||
if (cur != .tagged_union) return self.failMsg("comptime define: handle is not a declare()'d slot");
|
||||
return self.failMsg("comptime define(): handle is not a declare()'d nominal slot");
|
||||
if (cur != .tagged_union) return self.failMsg("comptime define(): handle is not a declare()'d slot");
|
||||
|
||||
// The info struct's single field is the member/element slice; read its
|
||||
// fat-pointer (embedded at field-0 offset within the info struct).
|
||||
@@ -1541,7 +1698,7 @@ pub const Vm = struct {
|
||||
var members = std.ArrayList(NamedMember).empty;
|
||||
defer members.deinit(self.gpa);
|
||||
try self.decodeMemberSlice(table, slice_word, slice_field_ty, &members);
|
||||
if (members.items.len == 0) return self.failMsg("comptime define: enum has no variants");
|
||||
if (members.items.len == 0) return self.failMsg("comptime define(): enum has no variants");
|
||||
// A FULLY payloadless variant set (every payload `void`) is an actual
|
||||
// `.@"enum"` (a kind change → `replaceKeyedInfo`); minting it as an
|
||||
// all-void tagged_union trips `verifySizes` at codegen (issue 0142).
|
||||
@@ -1551,16 +1708,16 @@ pub const Vm = struct {
|
||||
break;
|
||||
};
|
||||
if (all_void) {
|
||||
const names = self.gpa.alloc(types.StringId, members.items.len) catch return self.failMsg("comptime define: out of memory");
|
||||
const names = self.gpa.alloc(types.StringId, members.items.len) catch return self.failMsg("comptime define(): out of memory");
|
||||
for (members.items, 0..) |m, i| {
|
||||
for (names[0..i]) |prev| if (prev == m.name) return self.failMsg("comptime define: duplicate variant name");
|
||||
for (names[0..i]) |prev| if (prev == m.name) return self.failFmt("comptime define(): duplicate variant name '{s}'", .{tbl.getString(m.name)});
|
||||
names[i] = m.name;
|
||||
}
|
||||
tbl.replaceKeyedInfo(handle, .{ .@"enum" = .{ .name = ident.name, .variants = names, .nominal_id = ident.nominal_id } });
|
||||
} else {
|
||||
const flds = self.gpa.alloc(types.TypeInfo.StructInfo.Field, members.items.len) catch return self.failMsg("comptime define: out of memory");
|
||||
const flds = self.gpa.alloc(types.TypeInfo.StructInfo.Field, members.items.len) catch return self.failMsg("comptime define(): out of memory");
|
||||
for (members.items, 0..) |m, i| {
|
||||
for (flds[0..i]) |prev| if (prev.name == m.name) return self.failMsg("comptime define: duplicate variant name");
|
||||
for (flds[0..i]) |prev| if (prev.name == m.name) return self.failFmt("comptime define(): duplicate variant name '{s}'", .{tbl.getString(m.name)});
|
||||
flds[i] = .{ .name = m.name, .ty = m.ty };
|
||||
}
|
||||
// Name/id unchanged → still a tagged_union → stable key.
|
||||
@@ -1571,10 +1728,10 @@ pub const Vm = struct {
|
||||
var members = std.ArrayList(NamedMember).empty;
|
||||
defer members.deinit(self.gpa);
|
||||
try self.decodeMemberSlice(table, slice_word, slice_field_ty, &members);
|
||||
if (members.items.len == 0) return self.failMsg("comptime define: struct has no fields");
|
||||
const flds = self.gpa.alloc(types.TypeInfo.StructInfo.Field, members.items.len) catch return self.failMsg("comptime define: out of memory");
|
||||
if (members.items.len == 0) return self.failMsg("comptime define(): struct has no fields");
|
||||
const flds = self.gpa.alloc(types.TypeInfo.StructInfo.Field, members.items.len) catch return self.failMsg("comptime define(): out of memory");
|
||||
for (members.items, 0..) |m, i| {
|
||||
for (flds[0..i]) |prev| if (prev.name == m.name) return self.failMsg("comptime define: duplicate field name");
|
||||
for (flds[0..i]) |prev| if (prev.name == m.name) return self.failFmt("comptime define(): duplicate field name '{s}'", .{tbl.getString(m.name)});
|
||||
flds[i] = .{ .name = m.name, .ty = m.ty };
|
||||
}
|
||||
// tagged_union slot → struct is a kind change → `replaceKeyedInfo`.
|
||||
@@ -1584,12 +1741,12 @@ pub const Vm = struct {
|
||||
var elems = std.ArrayList(TypeId).empty;
|
||||
defer elems.deinit(self.gpa);
|
||||
try self.decodeTypeSlice(table, slice_word, slice_field_ty, &elems);
|
||||
if (elems.items.len == 0) return self.failMsg("comptime define: tuple has no elements");
|
||||
const tys = self.gpa.alloc(TypeId, elems.items.len) catch return self.failMsg("comptime define: out of memory");
|
||||
if (elems.items.len == 0) return self.failMsg("comptime define(): tuple has no elements");
|
||||
const tys = self.gpa.alloc(TypeId, elems.items.len) catch return self.failMsg("comptime define(): out of memory");
|
||||
@memcpy(tys, elems.items);
|
||||
tbl.replaceKeyedInfo(handle, .{ .tuple = .{ .fields = tys, .names = null } });
|
||||
},
|
||||
else => return self.failMsg("comptime define: unknown TypeInfo variant"),
|
||||
else => return self.failMsg("comptime define(): unknown TypeInfo variant"),
|
||||
}
|
||||
return @as(Reg, handle.index());
|
||||
}
|
||||
|
||||
@@ -403,6 +403,12 @@ pub const LLVMEmitter = struct {
|
||||
// Pass 2: Emit function bodies
|
||||
for (self.ir_mod.functions.items, 0..) |func, i| {
|
||||
if (func.is_extern or func.blocks.items.len == 0) continue;
|
||||
// A compiler-domain function (`abi(.compiler)` with a body — a post-link
|
||||
// callback / compiler-side helper) runs ONLY in the comptime evaluator,
|
||||
// never in the shipped binary. Skip its body emission (like `is_extern`);
|
||||
// its only references are in comptime code, so DCE drops the leftover
|
||||
// declaration. See current/PLAN-COMPILER-VM.md (S3).
|
||||
if (func.is_compiler_domain) continue;
|
||||
self.emitFunction(&func, @intCast(i));
|
||||
}
|
||||
|
||||
@@ -875,7 +881,7 @@ pub const LLVMEmitter = struct {
|
||||
// runs entirely on the VM (no buffered output); anything it can't handle
|
||||
// (`print`, an unported op) bails → `null` → the legacy interpreter below.
|
||||
const vm_result: ?Value = if (self.comptime_flat)
|
||||
comptime_vm.tryEval(self.alloc, self.ir_mod, func_id)
|
||||
comptime_vm.tryEval(self.alloc, self.ir_mod, func_id, &self.build_config, self.import_sources)
|
||||
else
|
||||
null;
|
||||
if (self.comptime_flat and self.comptime_flat_trace) {
|
||||
@@ -982,7 +988,7 @@ pub const LLVMEmitter = struct {
|
||||
// bail / implicit-ctx) falls through to the legacy interpreter
|
||||
// below, which produces the identical result. Default OFF.
|
||||
const vm_result: ?Value = if (self.comptime_flat)
|
||||
comptime_vm.tryEval(self.alloc, self.ir_mod, func_id)
|
||||
comptime_vm.tryEval(self.alloc, self.ir_mod, func_id, &self.build_config, self.import_sources)
|
||||
else
|
||||
null;
|
||||
// Coverage trace (gated): report whether the VM handled this
|
||||
@@ -1384,8 +1390,14 @@ pub const LLVMEmitter = struct {
|
||||
c.LLVMAddAttributeAtIndex(llvm_func, param1_idx, sret_attr);
|
||||
}
|
||||
|
||||
// Set linkage
|
||||
switch (func.linkage) {
|
||||
// Set linkage. A compiler-domain function (`abi(.compiler)` with a body) is
|
||||
// declared here but its body is Pass-2-skipped (it runs only in the comptime
|
||||
// evaluator). An INTERNAL declaration with no body fails LLVM verification, so
|
||||
// give it EXTERNAL linkage — a valid "defined elsewhere" declaration that the
|
||||
// linker drops once DCE removes its (comptime-only) references.
|
||||
if (func.is_compiler_domain) {
|
||||
c.LLVMSetLinkage(llvm_func, c.LLVMExternalLinkage);
|
||||
} else switch (func.linkage) {
|
||||
.external => c.LLVMSetLinkage(llvm_func, c.LLVMExternalLinkage),
|
||||
.internal => c.LLVMSetLinkage(llvm_func, c.LLVMInternalLinkage),
|
||||
.private => c.LLVMSetLinkage(llvm_func, c.LLVMPrivateLinkage),
|
||||
|
||||
@@ -431,7 +431,6 @@ pub const BuiltinCall = struct {
|
||||
};
|
||||
|
||||
pub const BuiltinId = enum(u16) {
|
||||
out,
|
||||
sqrt,
|
||||
sin,
|
||||
cos,
|
||||
@@ -577,13 +576,21 @@ pub const Function = struct {
|
||||
/// `__sx_ctx` value to the args of a call. Extern decls and
|
||||
/// `abi(.c)` functions have it false.
|
||||
has_implicit_ctx: bool = false,
|
||||
/// True for a `fn abi(.zig) extern compiler` welded to the comptime
|
||||
/// `compiler` library. Such a function has no real symbol — the comptime
|
||||
/// interpreter dispatches it to its registered Zig handler
|
||||
/// (`compiler_lib.findFn`) instead of dlsym. Comptime-only; a runtime call
|
||||
/// has no backing symbol. See design/comptime-compiler-api.md.
|
||||
/// True for a bodiless `abi(.compiler)` compiler-API function (`intern`,
|
||||
/// `find_type`, `build_options`, …). Such a function has no real symbol — the
|
||||
/// comptime evaluator dispatches it to its registered Zig/VM handler
|
||||
/// (`compiler_lib.findFn` / `Vm.callCompilerFn`) instead of dlsym. Comptime-only;
|
||||
/// a runtime call has no backing symbol (the `emitCall` gate rejects it).
|
||||
compiler_welded: bool = false,
|
||||
|
||||
/// True for a BODIED `abi(.compiler)` function — a user compiler-domain function
|
||||
/// (e.g. a post-link callback). Unlike `compiler_welded`, it HAS an sx body the
|
||||
/// comptime evaluator runs; but it NEVER runs in the shipped binary, so the
|
||||
/// backend does not lower it (emit_llvm Pass 2 skips it, like `is_extern`). Its
|
||||
/// only references are in comptime code (the `#run` that registers it) → DCE
|
||||
/// drops the leftover declaration. See current/PLAN-COMPILER-VM.md (S3).
|
||||
is_compiler_domain: bool = false,
|
||||
|
||||
pub const Param = struct {
|
||||
name: StringId,
|
||||
ty: TypeId,
|
||||
|
||||
@@ -1940,13 +1940,6 @@ pub const Interpreter = struct {
|
||||
|
||||
fn execBuiltinInner(self: *Interpreter, bi: inst_mod.BuiltinCall, frame: *Frame) InterpError!ExecResult {
|
||||
switch (bi.builtin) {
|
||||
.out => {
|
||||
const str_val = frame.getRef(bi.args[0]);
|
||||
if (str_val.asString(self)) |s| {
|
||||
self.output.appendSlice(self.alloc, s) catch {};
|
||||
}
|
||||
return .{ .value = .void_val };
|
||||
},
|
||||
.size_of => {
|
||||
// Return a default size (8 bytes for most types)
|
||||
return .{ .value = .{ .int = 8 } };
|
||||
|
||||
@@ -1296,8 +1296,8 @@ pub fn resolveFuncByName(self: *Lowering, name: []const u8) ?FuncId {
|
||||
|
||||
pub fn resolveBuiltin(name: []const u8) ?inst_mod.BuiltinId {
|
||||
const builtins = .{
|
||||
// Note: "print" is NOT here — it's a comptime-expanded function, not a simple builtin
|
||||
.{ "out", inst_mod.BuiltinId.out },
|
||||
// Note: "print" is NOT here — it's a comptime-expanded function, not a simple builtin.
|
||||
// "out" is NOT here either — it's a plain sx function (libc `write`), not a builtin.
|
||||
.{ "sqrt", inst_mod.BuiltinId.sqrt },
|
||||
.{ "sin", inst_mod.BuiltinId.sin },
|
||||
.{ "cos", inst_mod.BuiltinId.cos },
|
||||
|
||||
@@ -529,7 +529,7 @@ pub fn runComptimeTypeFunc(self: *Lowering, func_id: FuncId, span: ast.Span) ?Ty
|
||||
const comptime_flat = build_opts.comptime_flat or std.c.getenv("SX_COMPTIME_FLAT") != null or
|
||||
build_opts.comptime_flat_strict or std.c.getenv("SX_COMPTIME_FLAT_STRICT") != null;
|
||||
const vm_result: ?interp_mod.Value = if (comptime_flat)
|
||||
comptime_vm.tryEval(self.alloc, self.module, func_id)
|
||||
comptime_vm.tryEval(self.alloc, self.module, func_id, null, null)
|
||||
else
|
||||
null;
|
||||
if (comptime_flat and std.c.getenv("SX_COMPTIME_FLAT_TRACE") != null) {
|
||||
@@ -543,11 +543,16 @@ pub fn runComptimeTypeFunc(self: *Lowering, func_id: FuncId, span: ast.Span) ?Ty
|
||||
return checkComptimeTypeResult(self, tid_vm, span);
|
||||
}
|
||||
|
||||
// Strict mode: NO fallback — a VM bail is a build-gating failure naming the
|
||||
// reason (the interp-retirement enumeration gate). Returning null leaves the
|
||||
// type unresolved → a downstream diagnostic fails the build.
|
||||
// Strict mode: NO fallback — render the VM's bail reason as the SAME
|
||||
// build-gating diagnostic the non-strict legacy path emits below (the VM and
|
||||
// legacy set identical detail strings, e.g. "comptime define(): duplicate
|
||||
// variant name 'x'"), so a comptime type-construction failure (1179/1180)
|
||||
// produces its proper user diagnostic with no legacy interp in the loop — the
|
||||
// 4B step toward deleting the fallback. (4B / VM-native diagnostics.)
|
||||
if (build_opts.comptime_flat_strict or std.c.getenv("SX_COMPTIME_FLAT_STRICT") != null) {
|
||||
std.debug.print("error: comptime type-fn bailed on the VM (strict, no fallback): {s}\n", .{comptime_vm.last_bail_reason orelse "<unknown>"});
|
||||
if (self.diagnostics) |d| {
|
||||
d.addFmt(.err, span, "comptime type construction failed: {s}", .{comptime_vm.last_bail_reason orelse "<unknown>"});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -499,6 +499,12 @@ pub fn detectContextDecl(decls: []const *const Node) bool {
|
||||
pub fn funcWantsImplicitCtx(self: *const Lowering, fd: *const ast.FnDecl) bool {
|
||||
if (!self.implicit_ctx_enabled) return false;
|
||||
if (fd.abi == .c) return false;
|
||||
// A BODILESS `abi(.compiler)` decl (compiler-API surface) is dispatched by name
|
||||
// to a Zig/VM handler with exactly the declared args; an implicit `__sx_ctx`
|
||||
// prepend would shift every arg (breaking the handler's arity check). No sx
|
||||
// context, like an extern import. (A BODIED `abi(.compiler)` function is a real
|
||||
// sx function the VM runs — it gets the normal implicit-ctx treatment.)
|
||||
if (fnIsBodilessCompiler(fd)) return false;
|
||||
// `extern` imports and `export` defines are external C symbols —
|
||||
// C ABI, no sx context (Phase 2, gap iv).
|
||||
if (fd.extern_export != .none) return false;
|
||||
@@ -2229,7 +2235,13 @@ pub fn declareFunction(self: *Lowering, fd: *const ast.FnDecl, name: []const u8)
|
||||
// declareExtern routing below; the optional `extern LIB "csym"` lib/rename
|
||||
// axis is extern_lib/extern_name. (`export` defines take the beginFunction
|
||||
// path, not here.) The `#import c` auto-synthesis also produces this shape.
|
||||
const is_extern_decl = fd.extern_export == .extern_;
|
||||
// A bodiless `abi(.compiler)` decl (the compiler-API surface) has no runtime
|
||||
// body — the Zig/VM handler is the impl — so it lowers exactly like an `extern`
|
||||
// import (declared, never defined; the comptime evaluator dispatches it via
|
||||
// `compiler_welded`). A BODIED `abi(.compiler)` function (a compiler-domain
|
||||
// callback) is NOT extern — it has a body the VM evaluates — and is handled
|
||||
// below (`is_compiler_domain` + `is_comptime`, body lowered, emit-skipped).
|
||||
const is_extern_decl = fd.extern_export == .extern_ or fnIsBodilessCompiler(fd);
|
||||
var is_variadic = false;
|
||||
var effective_params = fd.params;
|
||||
// A lib-less C-import with a C-variadic `...` tail: drop the trailing slice
|
||||
@@ -2298,6 +2310,15 @@ pub fn declareFunction(self: *Lowering, fd: *const ast.FnDecl, name: []const u8)
|
||||
func.is_variadic = is_variadic;
|
||||
func.has_implicit_ctx = wants_ctx;
|
||||
if (weldedCompilerFn(self, fd, name)) func.compiler_welded = true;
|
||||
// A BODIED `abi(.compiler)` function is a user compiler-domain function (e.g. a
|
||||
// post-link callback): the VM runs its sx body, but it NEVER runs in the binary
|
||||
// so the backend skips it (emit_llvm Pass 2). Flag `is_compiler_domain` (the
|
||||
// emit-skip) + `is_comptime` (so any compiler-API calls inside it are permitted
|
||||
// by the `emitCall` gate, and its dead LLVM decl is treated like a #run wrapper).
|
||||
if (fd.abi == .compiler and !fnIsBodilessCompiler(fd)) {
|
||||
func.is_compiler_domain = true;
|
||||
func.is_comptime = true;
|
||||
}
|
||||
// A non-generic `-> Type` builder is a comptime type constructor — only ever
|
||||
// evaluated at lowering time (`runComptimeTypeFunc`) to mint a type, never
|
||||
// called at runtime. Flag it `is_comptime` so its emitted body is dead: the
|
||||
@@ -2309,20 +2330,25 @@ pub fn declareFunction(self: *Lowering, fd: *const ast.FnDecl, name: []const u8)
|
||||
self.fn_decl_fids.put(fd, fid) catch {};
|
||||
}
|
||||
|
||||
/// A `fn abi(.zig) extern <lib>` binds the comptime `compiler` library. Validate
|
||||
/// it (the bound lib must be `compiler`; the name must be on the function-export
|
||||
/// list) and return whether it is a welded compiler function — the interpreter
|
||||
/// dispatches such a call to its registered Zig handler instead of dlsym. Any
|
||||
/// failure is a build-gating `.err` (never a silent fall-through to dlsym).
|
||||
/// A BODILESS `abi(.compiler)` decl (ends in `;`, no sx body) — the compiler-API
|
||||
/// surface (`intern`/`find_type`/`build_options`/…), whose Zig/VM handler is the
|
||||
/// impl. Distinguished from a BODIED `abi(.compiler)` function (a user
|
||||
/// compiler-domain function, e.g. a post-link callback) by its synthesized
|
||||
/// empty-block body. The two lower differently: bodiless = declared-not-defined
|
||||
/// (extern-like); bodied = body lowered for VM eval but emit-skipped (S3).
|
||||
fn fnIsBodilessCompiler(fd: *const ast.FnDecl) bool {
|
||||
return fd.abi == .compiler and fd.body.data == .block and fd.body.data.block.stmts.len == 0;
|
||||
}
|
||||
|
||||
/// A bodiless `abi(.compiler)` decl is a compiler-API function: the comptime
|
||||
/// evaluator dispatches the call to its registered Zig/VM handler instead of dlsym.
|
||||
/// The ABI alone marks it (no `extern <lib>`, no fake `#library`). Validate the name
|
||||
/// is on the function-export list; failure is a build-gating `.err` (never a silent
|
||||
/// fall-through to dlsym).
|
||||
fn weldedCompilerFn(self: *Lowering, fd: *const ast.FnDecl, name: []const u8) bool {
|
||||
if (fd.abi != .zig) return false;
|
||||
const diags = self.diagnostics;
|
||||
if (fd.extern_lib == null or !std.mem.eql(u8, fd.extern_lib.?, compiler_lib.lib_name)) {
|
||||
if (diags) |d| d.addFmt(.err, fd.name_span, "abi(.zig) function '{s}' must bind the compiler library — write `extern {s}`", .{ name, compiler_lib.lib_name });
|
||||
return false;
|
||||
}
|
||||
if (!fnIsBodilessCompiler(fd)) return false;
|
||||
if (compiler_lib.findFn(name) == null) {
|
||||
if (diags) |d| d.addFmt(.err, fd.name_span, "'{s}' is not a function exported by the '{s}' library", .{ name, compiler_lib.lib_name });
|
||||
if (self.diagnostics) |d| d.addFmt(.err, fd.name_span, "'{s}' is not a function exported by the compiler", .{name});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -2570,8 +2596,11 @@ pub fn lowerFunctionBodyInto(self: *Lowering, fd: *const ast.FnDecl, fid: FuncId
|
||||
|
||||
// `extern` imports are pure declarations — never promote the stub to a real
|
||||
// function or lower the (empty placeholder) body. Mirrors the declare-only
|
||||
// handling in lowerFunction / lazyLowerFunction.
|
||||
if (fd.extern_export == .extern_) return;
|
||||
// handling in lowerFunction / lazyLowerFunction. A bodiless `abi(.compiler)`
|
||||
// decl (the compiler-API surface) is declare-only too — the Zig/VM handler is
|
||||
// the impl. A BODIED `abi(.compiler)` function DOES lower its body (for VM eval);
|
||||
// it is emit-skipped later via `is_compiler_domain`, not here.
|
||||
if (fd.extern_export == .extern_ or fnIsBodilessCompiler(fd)) return;
|
||||
|
||||
const ret_ty = self.resolveReturnType(fd);
|
||||
|
||||
@@ -2681,7 +2710,13 @@ pub fn lowerFunction(self: *Lowering, fd: *const ast.FnDecl, name: []const u8, i
|
||||
|
||||
// Check if the function body is a builtin or extern declaration (no body
|
||||
// needed). `extern` imports are declare-only too (empty placeholder body).
|
||||
if (fd.body.data == .builtin_expr or fd.body.data == .compiler_expr or fd.extern_export == .extern_) {
|
||||
// A bodiless `abi(.compiler)` decl (the compiler-API surface) is likewise
|
||||
// declare-only — its Zig/VM handler is the impl. A BODIED `abi(.compiler)`
|
||||
// function DOES need its body lowered for VM eval (emit-skipped later via
|
||||
// `is_compiler_domain`), so it falls through to normal lowering below.
|
||||
if (fd.body.data == .builtin_expr or fd.body.data == .compiler_expr or
|
||||
fd.extern_export == .extern_ or fnIsBodilessCompiler(fd))
|
||||
{
|
||||
// Already declared by scanDecls/declareFunction (which handles #extern renames)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,12 +228,13 @@ pub const TypeResolver = struct {
|
||||
const cc: types.TypeInfo.CallConv = switch (ft.abi) {
|
||||
.default => .default,
|
||||
.c => .c,
|
||||
// `.zig` (compiler-lib weld) and `.pure` (naked asm) are
|
||||
// `.compiler` (compiler-domain fn) and `.pure` (naked asm) are
|
||||
// decl-level ABIs with no function-pointer-type calling
|
||||
// convention of their own; the IR function-type CC models only
|
||||
// sx-default vs C. Neither occurs in a function-TYPE position in
|
||||
// current usage — treated as sx-default here.
|
||||
.zig, .pure => .default,
|
||||
// sx-default vs C. An `abi(.compiler)` function-TYPE param marks
|
||||
// the bound function compiler-domain (handled at the call/bind
|
||||
// site, not here) — its CC is still sx-default.
|
||||
.compiler, .pure => .default,
|
||||
};
|
||||
break :blk table.functionTypeCC(param_ids.items, ret_ty, cc);
|
||||
},
|
||||
|
||||
@@ -80,20 +80,18 @@ test "parser: comptime type-metaprogramming surface parses" {
|
||||
}
|
||||
|
||||
// Lock: the `compiler`-library binding surface PARSES — `name :: #library "x";`
|
||||
// (already supported) plus the new postfix `abi(.zig)` annotation (in the slot
|
||||
// before `extern`) followed by the library handle, on a function declaration. The
|
||||
// AST must carry the binding: `abi == .zig`, `extern_export == .extern_`, and the
|
||||
// library handle in `extern_lib`. No semantics yet — this is the first testable
|
||||
// sub-step of Phase 1 (parse only).
|
||||
test "parser: abi(.zig) extern <lib> binding parses on a fn decl" {
|
||||
// (already supported) plus the postfix `abi(.compiler)` annotation, marking a
|
||||
// compiler-domain / compiler-API function — no `extern`, no fake `#library`. The
|
||||
// AST must carry `abi == .compiler`, `extern_export == .none`, `extern_lib ==
|
||||
// null`, and a synthesized empty-block (bodiless) body.
|
||||
test "parser: abi(.compiler) binding parses on a bodiless fn decl" {
|
||||
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena.deinit();
|
||||
const alloc = arena.allocator();
|
||||
|
||||
const src =
|
||||
\\compiler :: #library "compiler";
|
||||
\\text_of :: (id: StringId) -> string abi(.zig) extern compiler;
|
||||
\\intern :: (s: string) -> StringId abi(.zig) extern compiler;
|
||||
\\text_of :: (id: StringId) -> string abi(.compiler);
|
||||
\\intern :: (s: string) -> StringId abi(.compiler);
|
||||
\\
|
||||
;
|
||||
var parser = Parser.init(alloc, src);
|
||||
@@ -101,14 +99,10 @@ test "parser: abi(.zig) extern <lib> binding parses on a fn decl" {
|
||||
|
||||
try std.testing.expect(root.data == .root);
|
||||
const decls = root.data.root.decls;
|
||||
try std.testing.expectEqual(@as(usize, 3), decls.len);
|
||||
try std.testing.expectEqual(@as(usize, 2), decls.len);
|
||||
|
||||
// The `#library` decl still parses to a `library_decl` node carrying the name.
|
||||
try std.testing.expect(decls[0].data == .library_decl);
|
||||
try std.testing.expectEqualStrings("compiler", decls[0].data.library_decl.name);
|
||||
try std.testing.expectEqualStrings("compiler", decls[0].data.library_decl.lib_name);
|
||||
|
||||
// The two `abi(.zig) extern compiler` fns: `.fn_decl` with the binding fields set.
|
||||
// The two `abi(.compiler)` fns: `.fn_decl` with the compiler-domain ABI set,
|
||||
// NO extern linkage, NO bound library.
|
||||
for ([_][]const u8{ "text_of", "intern" }) |bn| {
|
||||
var found: ?*const Node = null;
|
||||
for (decls) |d| {
|
||||
@@ -119,11 +113,10 @@ test "parser: abi(.zig) extern <lib> binding parses on a fn decl" {
|
||||
const d = found orelse return error.MissingDecl;
|
||||
try std.testing.expect(d.data == .fn_decl);
|
||||
const fd = d.data.fn_decl;
|
||||
try std.testing.expectEqual(ast.ABI.zig, fd.abi);
|
||||
try std.testing.expectEqual(ast.ExternExportModifier.extern_, fd.extern_export);
|
||||
try std.testing.expect(fd.extern_lib != null);
|
||||
try std.testing.expectEqualStrings("compiler", fd.extern_lib.?);
|
||||
// Bodyless extern import: synthesized empty block, no `#builtin`/`#compiler`.
|
||||
try std.testing.expectEqual(ast.ABI.compiler, fd.abi);
|
||||
try std.testing.expectEqual(ast.ExternExportModifier.none, fd.extern_export);
|
||||
try std.testing.expect(fd.extern_lib == null);
|
||||
// Bodyless compiler-domain decl: synthesized empty block, no `#builtin`/`#compiler`.
|
||||
try std.testing.expect(fd.body.data == .block);
|
||||
}
|
||||
}
|
||||
@@ -173,18 +166,19 @@ test "parser: abi(.c) and abi(.pure) parse standalone" {
|
||||
try std.testing.expectEqual(ast.ABI.pure, decls[1].data.fn_decl.abi);
|
||||
}
|
||||
|
||||
// Lock: the `compiler`-library binding PARSES on a STRUCT decl — `Name :: struct
|
||||
// abi(.zig) extern <lib> { … }`. The AST struct_decl must carry `abi == .zig` and
|
||||
// the library handle in `extern_lib`, with the field list intact. No semantics
|
||||
// yet (parse-only) — this is the second testable sub-step of Phase 1.
|
||||
test "parser: abi(.zig) extern <lib> binding parses on a struct decl" {
|
||||
// Lock: the postfix `abi(...)` slot PARSES on a STRUCT decl — `Name :: struct
|
||||
// abi(.compiler) extern <lib> { … }`. The AST struct_decl carries the abi + the
|
||||
// library handle in `extern_lib`, with the field list intact. Parse-only — the
|
||||
// struct-weld semantics were stripped (compiler-API types are VM-native now); this
|
||||
// just locks that the annotation slot still parses without perturbing fields.
|
||||
test "parser: abi(...) extern <lib> annotation parses on a struct decl" {
|
||||
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena.deinit();
|
||||
const alloc = arena.allocator();
|
||||
|
||||
const src =
|
||||
\\compiler :: #library "compiler";
|
||||
\\Field :: struct abi(.zig) extern compiler { name: StringId; ty: Type; }
|
||||
\\Field :: struct abi(.compiler) extern compiler { name: StringId; ty: Type; }
|
||||
\\
|
||||
;
|
||||
var parser = Parser.init(alloc, src);
|
||||
@@ -194,7 +188,7 @@ test "parser: abi(.zig) extern <lib> binding parses on a struct decl" {
|
||||
|
||||
try std.testing.expect(decls[1].data == .struct_decl);
|
||||
const sd = decls[1].data.struct_decl;
|
||||
try std.testing.expectEqual(ast.ABI.zig, sd.abi);
|
||||
try std.testing.expectEqual(ast.ABI.compiler, sd.abi);
|
||||
try std.testing.expect(sd.extern_lib != null);
|
||||
try std.testing.expectEqualStrings("compiler", sd.extern_lib.?);
|
||||
// Field list survives the binding annotation.
|
||||
|
||||
@@ -1998,6 +1998,17 @@ pub const Parser = struct {
|
||||
try self.expect(.semicolon);
|
||||
const stmts = try self.allocator.alloc(*Node, 0);
|
||||
break :blk try self.createNode(semi_start, .{ .block = .{ .stmts = stmts, .produces_value = false } });
|
||||
} else if (abi == .compiler and self.current.tag == .semicolon) blk: {
|
||||
// A bodiless `abi(.compiler)` decl: the compiler-API surface
|
||||
// (`intern`/`find_type`/`build_options`/…). It has no sx body — the
|
||||
// Zig/VM handler IS the implementation — so synthesize the empty-block
|
||||
// placeholder, exactly like an `extern` import. (A BODIED
|
||||
// `abi(.compiler)` function — e.g. a post-link callback — keeps its
|
||||
// `{ … }` and falls through to `parseBlock` below.)
|
||||
const semi_start = self.current.loc.start;
|
||||
self.advance();
|
||||
const stmts = try self.allocator.alloc(*Node, 0);
|
||||
break :blk try self.createNode(semi_start, .{ .block = .{ .stmts = stmts, .produces_value = false } });
|
||||
} else if (self.current.tag == .hash_builtin) blk: {
|
||||
const bi_start = self.current.loc.start;
|
||||
self.advance();
|
||||
@@ -3832,16 +3843,16 @@ pub const Parser = struct {
|
||||
try self.expect(.l_paren);
|
||||
try self.expect(.dot);
|
||||
if (self.current.tag != .identifier)
|
||||
return self.fail("expected ABI name ('.c', '.zig', or '.pure') after '.'");
|
||||
return self.fail("expected ABI name ('.c', '.compiler', or '.pure') after '.'");
|
||||
const abi_name = self.tokenSlice(self.current);
|
||||
const abi: ast.ABI = if (std.mem.eql(u8, abi_name, "c"))
|
||||
.c
|
||||
else if (std.mem.eql(u8, abi_name, "zig"))
|
||||
.zig
|
||||
else if (std.mem.eql(u8, abi_name, "compiler"))
|
||||
.compiler
|
||||
else if (std.mem.eql(u8, abi_name, "pure"))
|
||||
.pure
|
||||
else
|
||||
return self.fail("unknown ABI (expected '.c', '.zig', or '.pure')");
|
||||
return self.fail("unknown ABI (expected '.c', '.compiler', or '.pure')");
|
||||
self.advance();
|
||||
try self.expect(.r_paren);
|
||||
return abi;
|
||||
|
||||
@@ -1001,7 +1001,7 @@ pub const Analyzer = struct {
|
||||
}
|
||||
|
||||
// Built-in names that aren't declared in source
|
||||
const builtins = [_][]const u8{ "io", "true", "false", "cast", "closure", "out", "size_of", "align_of", "malloc", "free", "memcpy", "memset", "context" };
|
||||
const builtins = [_][]const u8{ "io", "true", "false", "cast", "closure", "size_of", "align_of", "malloc", "free", "memcpy", "memset", "context" };
|
||||
for (builtins) |b| {
|
||||
if (std.mem.eql(u8, name, b)) return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user