Batch LICM/Layout serialization and avoid redundant LIR re-verification
Build check / check (push) Failing after 4m57s

This commit is contained in:
waozi committed 2026-11-22 04:56:10 -03:00
1 parent 920c86a10d
commit 51e4505dd2
15 files changed
+226 -403

No files matched your search

+8 -52
View File
@@ -11,70 +11,47 @@ on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: check
runs-on: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 'build-native-ziran' || 'alpha-ziran' }}
runs-on: alpha-ziran
timeout-minutes: 90
env:
JOBS: 2
BUILD_NATIVE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 'true' || 'false' }}
steps:
- name: Check out the exact Build commit
id: native
if: env.BUILD_NATIVE == 'true'
run: gitea-native-build checkout
- uses: actions/checkout@v4
if: env.BUILD_NATIVE == 'false'
# site_pages.sh marks std modules shipped in the latest v* tag.
with:
fetch-depth: 0
- uses: actions/setup-go@v5
if: env.BUILD_NATIVE == 'false'
with:
go-version: '1.25'
cache: false
# tests/zstd_go_cases.zi builds against this module with GOPROXY=off,
# and the module itself requires Go 1.25.
- name: Fetch the Go Zstandard module for the offline Go checks
if: env.BUILD_NATIVE == 'false'
run: cd "$RUNNER_TEMP" && go mod download github.com/klauspost/[email protected]
- name: Install ripgrep, MinGW, Wine, Vorbis, ARMv7 tools and the private display for the test scripts
if: env.BUILD_NATIVE == 'false'
timeout-minutes: 5
run: sh scripts/ci_packages.sh ccache ripgrep zip unzip gcc-mingw-w64-x86-64 wine wine64 xvfb xauth libsdl2-dev ffmpeg libvorbis-dev python3-markdown gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user clang-18 lld-18
# The emcc checks use the Emscripten the playground and the site use;
# Ubuntu's emscripten package is 3.1.6, and its emcc is a symlink to a
# wrapper that cannot run under its resolved name.
- name: Set up Emscripten
if: env.BUILD_NATIVE == 'false'
uses: emscripten-core/setup-emsdk@v15
with:
version: '6.0.6'
- name: Keep compile results between runs
if: env.BUILD_NATIVE == 'false'
uses: ./.github/actions/compile-cache
with:
key: check
- name: Verify the cached native toolchain and Go modules
if: env.BUILD_NATIVE == 'true' && steps.native.outputs.current == 'true'
run: gitea-native-build run bash -ec 'emcc --version && go mod download github.com/klauspost/[email protected]'
- name: Build the toolchain
if: env.BUILD_NATIVE == 'false' || steps.native.outputs.current == 'true'
run: |
if [ "$BUILD_NATIVE" = true ]; then
gitea-native-build run make
else
make
fi
run: make
- name: Run the language, backend, and portable runtime checks
if: env.BUILD_NATIVE == 'false' || steps.native.outputs.current == 'true'
run: |
if [ "$BUILD_NATIVE" = true ]; then
gitea-native-build run env -u DISPLAY -u WAYLAND_DISPLAY WINDOWS_REQUIRED=1 ARM_REQUIRED=1 WASM_REQUIRED=1 ZIRAN_WASM_CC=clang-18 make check CHECK_JOBS=2 </dev/null
else
env -u DISPLAY -u WAYLAND_DISPLAY WINDOWS_REQUIRED=1 ARM_REQUIRED=1 WASM_REQUIRED=1 ZIRAN_WASM_CC=clang-18 make check CHECK_JOBS=2 </dev/null
fi
run: env -u DISPLAY -u WAYLAND_DISPLAY WINDOWS_REQUIRED=1 ARM_REQUIRED=1 WASM_REQUIRED=1 ZIRAN_WASM_CC=clang-18 make check CHECK_JOBS=2
- name: Pack the tested Ziran toolchain
id: toolchain
if: github.server_url == 'https://git.waozi.xyz' && github.event_name == 'push' && github.ref == 'refs/heads/master' && (env.BUILD_NATIVE != 'true' || steps.native.outputs.current == 'true')
@@ -112,31 +89,10 @@ jobs:
done
- name: Show how much the compile cache saved
if: always()
run: |
if [ "$BUILD_NATIVE" = true ]; then
gitea-native-build run ccache --show-stats || true
else
ccache --show-stats || true
fi
run: ccache --show-stats || true
- name: Keep complete check logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: check-logs
path: ${{ steps.native.outputs.source || github.workspace }}/build/check-logs/
release:
name: Publish a new Ziran version
needs: check
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
runs-on: build-native-ziran
permissions:
contents: write
steps:
- name: Check out the tested Build commit
run: /usr/local/libexec/gitea-native-build checkout
- name: Publish the tested VERSION to Gitea
env:
ZIRAN_RELEASE_BEFORE: ${{ github.event.before }}
ZIRAN_RELEASE_TOKEN: ${{ github.token }}
run: /usr/local/libexec/gitea-native-build run python3 scripts/release_gitea.py
path: build/check-logs/
+14 -8
View File
@@ -1099,16 +1099,20 @@ LirReadReplace :: (owner: *LirReadOwner, replacement: *LirReadOwner) {
// and blobs, rejects noncanonical framing/trailing bytes, then calls LirVerify.
// OWNER is empty after any failure. INPUT must not alias OWNER's old storage.
LirRead :: (owner: *LirReadOwner, input: string, limits: LirLimits) -> LirCodecResult {
return LirReadInternal(owner, input, null, input.count, limits, false)
return LirReadInternal(owner, input, null, input.count, limits, false, true)
}
LirReadUnverified :: (owner: *LirReadOwner, input: string, limits: LirLimits) -> LirCodecResult {
return LirReadInternal(owner, input, null, input.count, limits, false, false)
}
LirReadFromSource :: (owner: *LirReadOwner, source: *LirReadSource, limits: LirLimits) -> LirCodecResult {
return LirReadInternal(owner, "", source, source.size, limits, false)
return LirReadInternal(owner, "", source, source.size, limits, false, true)
}
#if #defined(ZIRAN_EXEC_PACKED_INSTRUCTIONS) {
LirReadCompactSource :: (owner: *LirReadOwner, source: *LirReadSource, limits: LirLimits) -> LirCodecResult {
return LirReadInternal(owner, "", source, source.size, limits, true)
return LirReadInternal(owner, "", source, source.size, limits, true, true)
}
LirReleaseFunctionBodies :: (owner: *LirReadOwner) {
@@ -1160,7 +1164,7 @@ ReadCompactFunctionBody :: (context: *void, id: s32, function: *LirFunction) ->
}
LirReadInternal :: (owner: *LirReadOwner, input: string, source: *LirReadSource,
size: s64, limits: LirLimits, compact: bool) -> LirCodecResult {
size: s64, limits: LirLimits, compact: bool, verify: bool) -> LirCodecResult {
if owner == null { return .{problem = .Owner} }
LirReadFree(owner)
layout, framing := ReadLayout(input, source, size)
@@ -1193,10 +1197,12 @@ LirReadInternal :: (owner: *LirReadOwner, input: string, source: *LirReadSource,
functions = owner.functions[:], origins = owner.origins[:],
initializers = owner.initializers[:], entry = owner.entry, checks = layout.checks}
program := OwnedProgram(owner)
diagnostic := LirVerifyWithBodies(program, limits, LirReadFunctionBodies(owner))
if diagnostic.problem != .None {
LirReadFree(owner)
return .{problem = .Verify, diagnostic = diagnostic, size = size}
if verify {
diagnostic := LirVerifyWithBodies(program, limits, LirReadFunctionBodies(owner))
if diagnostic.problem != .None {
LirReadFree(owner)
return .{problem = .Verify, diagnostic = diagnostic, size = size}
}
}
owner.valid = true
return .{size = size}
+16 -12
View File
@@ -336,18 +336,22 @@ SharedPassResult :: (state: *OptState, problem: LirSsaProblem,
}
CloneProgram :: (state: *OptState, program: LirProgram, limits: LirLimits,
owner: *LirReadOwner) -> bool {
owner: *LirReadOwner, verify: bool = true) -> bool {
if verify {
diagnostic := LirVerify(program, limits)
if diagnostic.problem != .None { return CodecFailure(state, .{problem = .Verify, diagnostic = diagnostic}) }
}
empty: []u8
measured := LirWrite(program, empty)
measured := LirWriteUnverified(program, empty)
if measured.problem != .None { return CodecFailure(state, measured) }
if !Scratch(state, measured.size, 1) { return false }
defer ScratchRelease(state, measured.size)
encoded: Vec(u8)
defer VecFree(encoded)
if !VecResizeBounded(encoded, measured.size, measured.size) { return Fail(state, .Allocation) }
written := LirWrite(program, encoded[:])
written := LirWriteUnverified(program, encoded[:])
if written.problem != .None || written.size != measured.size { return CodecFailure(state, written) }
read := LirRead(owner, TextView(encoded[:]), limits)
read := LirReadUnverified(owner, TextView(encoded[:]), limits)
if read.problem != .None { return CodecFailure(state, read) }
return true
}
@@ -2142,7 +2146,7 @@ LirOptBuild :: (owner: *LirOptOwner, program: LirProgram, limits: LirLimits,
LirOptFree(owner)
return Result(state)
}
if !CloneProgram(*state, program, limits, *owner.storage) {
if !CloneProgram(*state, program, limits, *owner.storage, false) {
LirOptFree(owner)
return Result(state)
}
@@ -2157,7 +2161,7 @@ LirOptBuild :: (owner: *LirOptOwner, program: LirProgram, limits: LirLimits,
}
state.counters.inline_leaf.runs += 1
state.counters.inline_leaf.instructions += inlined.calls
if !VerifyPass(*state, LirReadProgram(*owner.storage), limits) { LirOptFree(owner); return Result(state) }
if inlined.calls > 0 && !VerifyPass(*state, LirReadProgram(*owner.storage), limits) { LirOptFree(owner); return Result(state) }
}
inlined: s64
// Callees are measured for inlining as they will be after cleanup.
@@ -2246,13 +2250,15 @@ LirOptBuild :: (owner: *LirOptOwner, program: LirProgram, limits: LirLimits,
hoisted := LirLicm(*owner.storage, limits, state.remaining)
state.counters.licm.runs += 1
state.counters.licm.instructions += hoisted.instructions
if !SharedPassResult(*state, hoisted.problem, hoisted.codec, hoisted.work, hoisted.scratch_bytes) ||
!VerifyPass(*state, LirReadProgram(*owner.storage), limits) { LirOptFree(owner); return Result(state) }
if !SharedPassResult(*state, hoisted.problem, hoisted.codec, hoisted.work, hoisted.scratch_bytes) {
LirOptFree(owner); return Result(state)
}
strength := LirInduction(*owner.storage, limits, state.remaining)
state.counters.induction.runs += 1
state.counters.induction.instructions += strength.products
if !SharedPassResult(*state, strength.problem, strength.codec, strength.work, strength.scratch_bytes) ||
!VerifyPass(*state, LirReadProgram(*owner.storage), limits) { LirOptFree(owner); return Result(state) }
if !SharedPassResult(*state, strength.problem, strength.codec, strength.work, strength.scratch_bytes) {
LirOptFree(owner); return Result(state)
}
optimized = LirReadProgram(*owner.storage)
if options.propagate_copies && !CopyPass(*state, optimized, limits) { LirOptFree(owner); return Result(state) }
rotated := LirRotate(*owner.storage, limits, state.remaining)
@@ -2272,7 +2278,6 @@ LirOptBuild :: (owner: *LirOptOwner, program: LirProgram, limits: LirLimits,
if options.propagate_copies && !CopyPass(*state, optimized, limits) {
LirOptFree(owner); return Result(state)
}
if !VerifyPass(*state, optimized, limits) { LirOptFree(owner); return Result(state) }
ordered := LirLayout(*owner.storage, limits, state.remaining)
state.counters.layout.runs += 1
state.counters.layout.blocks += ordered.blocks
@@ -2280,7 +2285,6 @@ LirOptBuild :: (owner: *LirOptOwner, program: LirProgram, limits: LirLimits,
LirOptFree(owner); return Result(state)
}
optimized = LirReadProgram(*owner.storage)
if !VerifyPass(*state, optimized, limits) { LirOptFree(owner); return Result(state) }
}
ScratchReset(*state)
if options.eliminate_dead && !DeadPass(*state, optimized, limits) {
+1 -10
View File
@@ -190,16 +190,7 @@ Rebuild :: (storage: *LirReadOwner, program: LirProgram, fi: s64, plan: *LirLoop
}
functions[fi] = function
program.functions = functions[:]
empty: []u8
measured := LirWrite(program, empty)
if measured.problem != .None { return measured }
if !LirSsaReserve(budget, measured.size, 1) { return .{} }
encoded: Vec(u8)
defer VecFree(encoded)
if !VecResizeBounded(encoded, measured.size, measured.size) { budget.problem = .Allocation; return .{} }
written := LirWrite(program, encoded[:])
if written.problem != .None { return written }
return LirRead(storage, TextView(encoded[:]), limits)
return LirSsaSerialize(storage, program, limits, budget)
}
#scope_export
+77 -70
View File
@@ -57,80 +57,55 @@ Order :: (function: LirFunction, order: []s32, position: []s32,
return true
}
Rebuild :: (storage: *LirReadOwner, program: LirProgram, fi: s64,
order: []s32, position: []s32, limits: LirLimits, budget: *LirSsaBudget) -> LirCodecResult {
function := program.functions[fi]
count: s64
edge_count: s64
for block: function.blocks {
if !LirSsaSpend(budget, block.instructions.count + 1) { return .{} }
count += block.instructions.count
for instruction: block.instructions { edge_count += instruction.edges.count }
}
if !LirSsaReserve(budget, count, 112) || !LirSsaReserve(budget, edge_count, 24) ||
!LirSsaReserve(budget, function.blocks.count, 32) ||
!LirSsaReserve(budget, program.functions.count, 112) { return .{} }
instructions: Vec(LirInstruction)
edges: Vec(LirEdge)
blocks: Vec(LirBlock)
functions: Vec(LirFunction)
defer VecFree(instructions)
defer VecFree(edges)
defer VecFree(blocks)
defer VecFree(functions)
if !VecResizeBounded(instructions, count, count) || !VecResizeBounded(edges, edge_count, edge_count) ||
!VecResizeBounded(blocks, function.blocks.count, function.blocks.count) ||
!VecResizeBounded(functions, program.functions.count, program.functions.count) {
budget.problem = .Allocation
return .{}
}
ip: s64
ep: s64
for at: 0..order.count - 1 {
block := function.blocks[order[at]]
begin := ip
for instruction: block.instructions {
if !LirSsaSpend(budget, instruction.edges.count + 1) { return .{} }
edge_begin := ep
for edge: instruction.edges {
edge.block = position[edge.block]
edges[ep] = edge
ep += 1
}
instruction.edges = edges[edge_begin:ep]
instructions[ip] = instruction
ip += 1
}
blocks[at] = .{parameters = block.parameters, instructions = instructions[begin:ip]}
}
for at: 0..functions.count - 1 { functions[at] = program.functions[at] }
function.blocks = blocks[:]
function.entry = position[function.entry]
functions[fi] = function
program.functions = functions[:]
empty: []u8
measured := LirWrite(program, empty)
if measured.problem != .None { return measured }
if !LirSsaReserve(budget, measured.size, 1) { return .{} }
encoded: Vec(u8)
defer VecFree(encoded)
if !VecResizeBounded(encoded, measured.size, measured.size) { budget.problem = .Allocation; return .{} }
written := LirWrite(program, encoded[:])
if written.problem != .None { return written }
// No borrowed owner slice is used after the replacement.
return LirRead(storage, TextView(encoded[:]), limits)
}
#scope_export
// Reorder blocks and remap edge targets together. Parameters, instructions,
// effects, branch polarity and origins are unchanged. Verified input only.
LirLayout :: (storage: *LirReadOwner, limits: LirLimits, work: s64) -> LirLayoutResult {
result: LirLayoutResult
budget := LirSsaBudget.{work = work, bytes = limits.bytes}
count := LirReadProgram(storage).functions.count
program := LirReadProgram(storage)
count := program.functions.count
total_blocks: s64
total_insts: s64
total_edges: s64
for function: program.functions {
total_blocks += function.blocks.count
for block: function.blocks {
total_insts += block.instructions.count
for instruction: block.instructions { total_edges += instruction.edges.count }
}
}
out_functions: Vec(LirFunction)
out_blocks: Vec(LirBlock)
out_instructions: Vec(LirInstruction)
out_edges: Vec(LirEdge)
defer VecFree(out_functions)
defer VecFree(out_blocks)
defer VecFree(out_instructions)
defer VecFree(out_edges)
if !LirSsaReserve(*budget, count, 112) ||
!LirSsaReserve(*budget, total_blocks, 32) ||
!LirSsaReserve(*budget, total_insts, 112) ||
!LirSsaReserve(*budget, total_edges, 24) {
result.problem = budget.problem
result.work = budget.used
return result
}
if !VecResizeBounded(out_functions, count, count) ||
!VecResizeBounded(out_blocks, total_blocks, total_blocks) ||
!VecResizeBounded(out_instructions, total_insts, total_insts) ||
!VecResizeBounded(out_edges, total_edges, total_edges) {
result.problem = .Allocation
result.work = budget.used
return result
}
for fi: 0..count - 1 { out_functions[fi] = program.functions[fi] }
base_reserved := budget.reserved
bp: s64
ip: s64
ep: s64
for fi: 0..count - 1 {
budget.reserved = 0
program := LirReadProgram(storage)
budget.reserved = base_reserved
function := program.functions[fi]
if !LirSsaSpend(*budget, 1) { break }
if function.external || function.blocks.count < 2 { continue }
@@ -145,15 +120,47 @@ LirLayout :: (storage: *LirReadOwner, limits: LirLimits, work: s64) -> LirLayout
changed := false
for at: 0..blocks - 1 { if order[at] != at { changed = true } }
if changed {
result.codec = Rebuild(storage, program, fi, order[:], position[:], limits, *budget)
if budget.problem == .None && result.codec.problem == .None { result.functions += 1; result.blocks += blocks }
b_begin := bp
for at: 0..order.count - 1 {
block := function.blocks[order[at]]
i_begin := ip
for instruction: block.instructions {
if !LirSsaSpend(*budget, instruction.edges.count + 1) { break }
e_begin := ep
for edge: instruction.edges {
edge.block = position[edge.block]
out_edges[ep] = edge
ep += 1
}
instruction.edges = out_edges[e_begin:ep]
out_instructions[ip] = instruction
ip += 1
}
if budget.problem != .None { break }
out_blocks[bp] = .{parameters = block.parameters, instructions = out_instructions[i_begin:ip]}
bp += 1
}
if budget.problem == .None {
function.blocks = out_blocks[b_begin:bp]
function.entry = position[function.entry]
out_functions[fi] = function
result.functions += 1
result.blocks += blocks
}
}
}
VecFree(order)
VecFree(position)
VecFree(costs)
if budget.reserved > result.scratch_bytes { result.scratch_bytes = budget.reserved }
if budget.problem != .None || result.codec.problem != .None { break }
if budget.problem != .None { break }
}
if result.functions > 0 && budget.problem == .None {
budget.reserved = base_reserved
updated := program
updated.functions = out_functions[:]
result.codec = LirSsaSerialize(storage, updated, limits, *budget)
if budget.reserved > result.scratch_bytes { result.scratch_bytes = budget.reserved }
}
result.problem = budget.problem
result.work = budget.used
+99 -67
View File
@@ -85,61 +85,26 @@ Select :: (program: LirProgram, function: LirFunction, plan: *LirLoopPlan,
return kept
}
Rebuild :: (storage: *LirReadOwner, program: LirProgram, fi: s64,
plan: *LirLoopPlan, selected: []u8, hoisted: []LirInstruction,
limits: LirLimits, budget: *LirSsaBudget) -> LirCodecResult {
function := program.functions[fi]
count: s64
for block: function.blocks {
if !LirSsaSpend(budget, 1) { return .{} }
count += block.instructions.count
}
if !LirSsaReserve(budget, count, 112) || !LirSsaReserve(budget, function.blocks.count, 32) ||
!LirSsaReserve(budget, program.functions.count, 112) { return .{} }
instructions: Vec(LirInstruction)
blocks: Vec(LirBlock)
functions: Vec(LirFunction)
defer VecFree(instructions)
defer VecFree(blocks)
defer VecFree(functions)
if !VecResizeBounded(instructions, count, count) || !VecResizeBounded(blocks, function.blocks.count, function.blocks.count) ||
!VecResizeBounded(functions, program.functions.count, program.functions.count) {
budget.problem = .Allocation
return .{}
}
HoistFunction :: (function: LirFunction, plan: *LirLoopPlan,
selected: []u8, hoisted: []LirInstruction,
out_instructions: []LirInstruction, out_blocks: []LirBlock,
budget: *LirSsaBudget) -> bool {
at: s64
for block, b: function.blocks {
begin := at
for instruction, i: block.instructions {
if !LirSsaSpend(budget, 1) { return .{} }
if !LirSsaSpend(budget, 1) { return false }
if b == plan.preheader && i == block.instructions.count - 1 {
if !LirSsaSpend(budget, hoisted.count) { return .{} }
for moved: hoisted { instructions[at] = moved; at += 1 }
if !LirSsaSpend(budget, hoisted.count) { return false }
for moved: hoisted { out_instructions[at] = moved; at += 1 }
}
if plan.members[b] != 0 && instruction.result >= 0 && selected[instruction.result] != 0 { continue }
instructions[at] = instruction
out_instructions[at] = instruction
at += 1
}
blocks[b] = .{parameters = block.parameters, instructions = instructions[begin:at]}
out_blocks[b] = .{parameters = block.parameters, instructions = out_instructions[begin:at]}
}
for f: 0..functions.count - 1 {
if !LirSsaSpend(budget, 1) { return .{} }
functions[f] = program.functions[f]
}
function.blocks = blocks[:]
functions[fi] = function
program.functions = functions[:]
empty: []u8
measured := LirWrite(program, empty)
if measured.problem != .None { return measured }
if !LirSsaReserve(budget, measured.size, 1) { return .{} }
encoded: Vec(u8)
defer VecFree(encoded)
if !VecResizeBounded(encoded, measured.size, measured.size) { budget.problem = .Allocation; return .{} }
written := LirWrite(program, encoded[:])
if written.problem != .None { return written }
// Borrowed program slices are no longer used after replacing the owner.
return LirRead(storage, TextView(encoded[:]), limits)
return true
}
#scope_export
@@ -148,29 +113,70 @@ Rebuild :: (storage: *LirReadOwner, program: LirProgram, fi: s64,
LirLicm :: (storage: *LirReadOwner, limits: LirLimits, work: s64) -> LirLicmResult {
result: LirLicmResult
budget := LirSsaBudget.{work = work, bytes = limits.bytes}
functions := LirReadProgram(storage).functions.count
program := LirReadProgram(storage)
function_count := program.functions.count
// Only a block some edge leads back to can head a loop, so the loop
// finder, which walks the whole function, runs for those alone.
headers: Vec(u8)
defer VecFree(headers)
widest: s64
for function: LirReadProgram(storage).functions {
max_insts: s64
total_blocks: s64
total_insts: s64
for function: program.functions {
if function.blocks.count > widest { widest = function.blocks.count }
total_blocks += function.blocks.count
fn_insts: s64
for block: function.blocks { fn_insts += block.instructions.count }
if fn_insts > max_insts { max_insts = fn_insts }
total_insts += fn_insts
}
for fi: 0..functions - 1 {
first := LirReadProgram(storage).functions[fi]
if first.external || first.blocks.count == 0 { continue }
blocks := first.blocks.count
budget.reserved = 0
out_functions: Vec(LirFunction)
out_blocks: Vec(LirBlock)
out_instructions: Vec(LirInstruction)
scratch_a: Vec(LirInstruction)
scratch_b: Vec(LirInstruction)
scratch_blocks: Vec(LirBlock)
defer VecFree(out_functions)
defer VecFree(out_blocks)
defer VecFree(out_instructions)
defer VecFree(scratch_a)
defer VecFree(scratch_b)
defer VecFree(scratch_blocks)
if !LirSsaReserve(*budget, function_count, 112) ||
!LirSsaReserve(*budget, total_blocks, 32) ||
!LirSsaReserve(*budget, total_insts, 112) {
result.problem = budget.problem
result.work = budget.used
return result
}
if !VecResizeBounded(out_functions, function_count, function_count) ||
!VecResizeBounded(out_blocks, total_blocks, total_blocks) ||
!VecResizeBounded(out_instructions, total_insts, total_insts) {
result.problem = .Allocation
result.work = budget.used
return result
}
for fi: 0..function_count - 1 { out_functions[fi] = program.functions[fi] }
base_reserved := budget.reserved
block_cursor: s64
inst_cursor: s64
for fi: 0..function_count - 1 {
function := program.functions[fi]
if function.external || function.blocks.count == 0 { continue }
blocks := function.blocks.count
fn_insts: s64
for block: function.blocks { fn_insts += block.instructions.count }
budget.reserved = base_reserved
if !VecResizeBounded(headers, blocks, widest) { budget.problem = .Allocation; break }
if !LirLoopHeaders(first, headers[:], *budget) { break }
if !LirLoopHeaders(function, headers[:], *budget) { break }
fn_changed := false
use_a := true
stale := false
for header: 0..blocks - 1 {
if stale { break }
if headers[header] == 0 { continue }
budget.reserved = 0
program := LirReadProgram(storage)
function := program.functions[fi]
budget.reserved = base_reserved
if !LirSsaSpend(*budget, 1) { break }
plan: LirLoopPlan
homes: Vec(s32)
@@ -184,15 +190,20 @@ LirLicm :: (storage: *LirReadOwner, limits: LirLimits, work: s64) -> LirLicmResu
if budget.problem == .None && LirLoopDefinitions(function, homes[:], *budget) {
count := Select(program, function, *plan, homes[:], selected[:], hoisted[:], *budget)
if count > 0 {
result.codec = Rebuild(storage, program, fi, *plan, selected[:], hoisted[:count], limits, *budget)
if budget.problem == .None && result.codec.problem == .None {
result.loops += 1
result.instructions += count
// Hoisting moved instructions; find the headers again,
// and leave a function whose blocks changed as it is.
changed := LirReadProgram(storage).functions[fi]
if changed.blocks.count != blocks { stale = true }
else { unused LirLoopHeaders(changed, headers[:], *budget) }
if !VecResizeBounded(scratch_blocks, blocks, widest) ||
!VecResizeBounded(scratch_a, fn_insts, max_insts) ||
!VecResizeBounded(scratch_b, fn_insts, max_insts) {
budget.problem = .Allocation
} else {
dest_insts := ifx use_a then scratch_a[:fn_insts] else scratch_b[:fn_insts]
if HoistFunction(function, *plan, selected[:], hoisted[:count], dest_insts, scratch_blocks[:blocks], *budget) {
function.blocks = scratch_blocks[:blocks]
use_a = !use_a
fn_changed = true
result.loops += 1
result.instructions += count
unused LirLoopHeaders(function, headers[:], *budget)
}
}
}
}
@@ -202,9 +213,30 @@ LirLicm :: (storage: *LirReadOwner, limits: LirLimits, work: s64) -> LirLicmResu
VecFree(selected)
VecFree(hoisted)
if budget.reserved > result.scratch_bytes { result.scratch_bytes = budget.reserved }
if budget.problem != .None || result.codec.problem != .None { break }
if budget.problem != .None { break }
}
if budget.problem != .None || result.codec.problem != .None { break }
if fn_changed && budget.problem == .None {
b_begin := block_cursor
for block, b: function.blocks {
i_begin := inst_cursor
for instruction: block.instructions {
out_instructions[inst_cursor] = instruction
inst_cursor += 1
}
out_blocks[block_cursor] = .{parameters = block.parameters, instructions = out_instructions[i_begin:inst_cursor]}
block_cursor += 1
}
function.blocks = out_blocks[b_begin:block_cursor]
out_functions[fi] = function
}
if budget.problem != .None { break }
}
if result.loops > 0 && budget.problem == .None {
budget.reserved = base_reserved
updated := program
updated.functions = out_functions[:]
result.codec = LirSsaSerialize(storage, updated, limits, *budget)
if budget.reserved > result.scratch_bytes { result.scratch_bytes = budget.reserved }
}
result.problem = budget.problem
result.work = budget.used
+6 -3
View File
@@ -1,4 +1,5 @@
using IR :: #import "compiler_lowered_ir"
using Verify :: #import "compiler_lowered_verify"
using Codec :: #import "compiler_exec_serial"
using Vectors :: #import "std/vec"
@@ -128,14 +129,16 @@ LirSsaPlanBuild :: (plan: *LirSsaPlan, function: LirFunction, source: s32,
// slice; a pass's rebuilt functions can be freed afterwards.
LirSsaSerialize :: (storage: *LirReadOwner, program: LirProgram, limits: LirLimits,
budget: *LirSsaBudget) -> LirCodecResult {
diagnostic := LirVerify(program, limits)
if diagnostic.problem != .None { return .{problem = .Verify, diagnostic = diagnostic} }
empty: []u8
measured := LirWrite(program, empty)
measured := LirWriteUnverified(program, empty)
if measured.problem != .None { return measured }
if !LirSsaReserve(budget, measured.size, 1) { return .{} }
encoded: Vec(u8)
defer VecFree(encoded)
if !VecResizeBounded(encoded, measured.size, measured.size) { budget.problem = .Allocation; return .{} }
written := LirWrite(program, encoded[:])
written := LirWriteUnverified(program, encoded[:])
if written.problem != .None { return written }
return LirRead(storage, TextView(encoded[:]), limits)
return LirReadUnverified(storage, TextView(encoded[:]), limits)
}
-116
View File
@@ -1,116 +0,0 @@
#!/usr/bin/env python3
"""Publish a tested Ziran version from its Gitea master push."""
import json
import os
from pathlib import Path
import re
import subprocess
from urllib.error import HTTPError
from urllib.request import HTTPRedirectHandler, ProxyHandler, Request, build_opener
REPOSITORY = 'ziranlang/ziran'
REVISION = re.compile('[0-9a-f]{40}')
VERSION = re.compile(r'(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)')
class NoRedirects(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
def api_client(origin, token):
if not re.fullmatch(r'http://127\.0\.0\.1:[1-9][0-9]{0,4}', origin) or not token:
raise ValueError('Expected the managed Build API and Actions job credential')
endpoint = f'{origin}/api/v1/repos/{REPOSITORY}'
opener = build_opener(ProxyHandler({}), NoRedirects)
def request(method, path, data=None):
headers = {'Authorization': 'token '+token, 'Content-Type': 'application/json'}
target = Request(endpoint+path, method=method, headers=headers,
data=json.dumps(data).encode() if data is not None else None)
with opener.open(target, timeout=15) as response:
return json.load(response)
return request
def get_optional(api, path):
try:
return api('GET', path)
except HTTPError as error:
if error.code == 404:
return None
raise
def release_notes(changelog, version):
headings = list(re.finditer(r'(?m)^## \[([^\]]+)\].*$', changelog))
for index, heading in enumerate(headings):
if heading[1] == version:
end = headings[index+1].start() if index+1 < len(headings) else len(changelog)
notes = changelog[heading.end():end].strip()
if notes:
return notes
raise ValueError('The new VERSION needs a populated CHANGELOG.md section')
def publish(api, previous, version, revision, changelog):
if not VERSION.fullmatch(previous) or not VERSION.fullmatch(version) or not REVISION.fullmatch(revision):
raise ValueError('Expected a numeric release version and an exact source commit')
if version == previous:
return None
if tuple(map(int, version.split('.'))) <= tuple(map(int, previous.split('.'))):
raise ValueError('VERSION must advance to publish a release')
notes = release_notes(changelog, version)
if api('GET', '/branches/master')['commit']['id'] != revision:
return None
tag = 'v'+version
tag_path = '/tags/'+tag
release_path = '/releases/tags/'+tag
existing_tag = get_optional(api, tag_path)
if existing_tag is not None and existing_tag['commit']['sha'] != revision:
raise ValueError(f'{tag} is already attached to a different commit')
release = get_optional(api, release_path)
if release is None:
try:
api('POST', '/releases', {'tag_name': tag, 'target_commitish': revision, 'name': 'Ziran '+version,
'body': notes, 'draft': False, 'prerelease': False, 'tag_message': 'Ziran '+version})
except HTTPError as error:
if error.code != 409:
raise
release = api('GET', release_path)
if (api('GET', tag_path)['commit']['sha'] != revision or release['tag_name'] != tag
or release['draft'] or release['prerelease']):
raise ValueError('Gitea did not return a published release for the tested commit')
return tag
def checked_git(*args):
return subprocess.check_output(['git', *args], text=True, timeout=15).strip()
def main():
env = os.environ
if (env.get('GITHUB_REPOSITORY'), env.get('GITHUB_EVENT_NAME'), env.get('GITHUB_REF')) != (
REPOSITORY, 'push', 'refs/heads/master'):
raise ValueError('Release requires the Ziran master push job')
revision = env['GITHUB_SHA']
before = env['ZIRAN_RELEASE_BEFORE']
if not REVISION.fullmatch(before) or before == '0'*40 or checked_git('rev-parse', 'HEAD') != revision:
raise ValueError('Release requires the checked master push and its preceding commit')
previous = checked_git('show', before+':VERSION')
version = Path('VERSION').read_text().strip()
if previous == version:
print('VERSION is unchanged.')
return
subprocess.run(['git', 'merge-base', '--is-ancestor', before, revision], check=True, timeout=15)
api = api_client(env['BUILD_NATIVE_GIT_ORIGIN'], env.pop('ZIRAN_RELEASE_TOKEN'))
tag = publish(api, previous, version, revision, Path('CHANGELOG.md').read_text())
if tag:
print(f'Published and verified https://git.waozi.xyz/{REPOSITORY}/releases/tag/{tag}')
else:
print('A newer master commit is already at Gitea.')
if __name__ == '__main__':
main()
+1 -1
View File
@@ -13,7 +13,7 @@
<a href="examples.html"><span>Learn by doing</span><strong>Examples</strong><p><!-- generated:example_count -->16<!-- /generated:example_count --> complete programs with commands, each printing the same output on every target.</p><b>Browse examples →</b></a>
<a href="language.html"><span>Language</span><strong>Syntax reference</strong><p>Modules, declarations, types, generics, control flow, compile-time forms, laws, and foreign calls.</p><b>Read the reference →</b></a>
<a href="api.html#toolchain"><span>Toolchain</span><strong>CLI reference</strong><p>Check, build C or Go, bundle, run, format, and query the toolchain.</p><b>See commands →</b></a>
<a href="modules.html"><span>Libraries</span><strong>Modules and packages</strong><p>Every public declaration in the <!-- generated:std_count -->129<!-- /generated:std_count --> standard modules and the ziranlang packages, generated from the source.</p><b>Browse modules →</b></a>
<a href="modules.html"><span>Libraries</span><strong>Modules and packages</strong><p>Every public declaration in the <!-- generated:std_count -->128<!-- /generated:std_count --> standard modules and the ziranlang packages, generated from the source.</p><b>Browse modules →</b></a>
<a href="status.html"><span>Project</span><strong>Implementation status</strong><p>See what works in the tested subset and what still needs implementation.</p><b>Check support →</b></a>
<a href="guide/packages.html"><span>Projects</span><strong>Packages</strong><p><code>ziran.toml</code> projects, pinned Git dependencies, locks, and installing applications.</p><b>Read the guide →</b></a>
</div></section>
+1 -1
View File
@@ -130,7 +130,7 @@ build/bin/ziran version</code></pre><a class="btn btn-primary" href="get-started
<section class="status-callout modules-callout" aria-labelledby="modules-title">
<div><p class="eyebrow">Libraries</p><h2 id="modules-title">Modules and <em>packages.</em></h2></div>
<div><p><!-- generated:module_counts -->129 standard modules and 17 packages<!-- /generated:module_counts -->, each with an API reference generated from its source, from text and JSON to image codecs.</p><a class="btn" href="modules.html">Browse all modules →</a></div>
<div><p><!-- generated:module_counts -->128 standard modules and 17 packages<!-- /generated:module_counts -->, each with an API reference generated from its source, from text and JSON to image codecs.</p><a class="btn" href="modules.html">Browse all modules →</a></div>
</section>
<section class="status-callout">
<div><p class="eyebrow"><span class="status-dot" aria-hidden="true"></span>Project status</p><h2>Working core.<br><em>Experimental edges.</em></h2></div>
+1 -2
View File
@@ -2,7 +2,7 @@
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="Every Ziran standard module and package: 128 std modules and 17 packages with API references generated from the source."><title>Ziran modules and packages</title><link rel="canonical" href="https://ziran-lang.org/modules"><link rel="icon" href="assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="styles.css"><script defer src="site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="index.html"><img class="brand-icon" src="assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="get-started.html">Get started</a><a href="examples.html">Examples</a><a href="targets.html">Targets</a><a href="modules.html" aria-current="page">Modules</a><a href="docs.html">Docs</a><a href="status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow">Reference / Modules</p><h1>Modules and <em>packages.</em></h1><p>129 standard modules and 17 packages, listed from the source on every site build. Each page shows the public declarations <code>ziran api</code> reports, with the comment written above them.</p><p class="module-meta"><span class="status-badge is-stable">Stable</span> ships in the latest release, <a href="https://github.com/ziranlang/ziran/releases/tag/v0.7.0">v0.7.0</a> (for a package: it has a tagged release). <span class="status-badge is-in-progress">In progress</span> exists only on <code>master</code> or has no release yet.</p></div>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow">Reference / Modules</p><h1>Modules and <em>packages.</em></h1><p>128 standard modules and 17 packages, listed from the source on every site build. Each page shows the public declarations <code>ziran api</code> reports, with the comment written above them.</p><p class="module-meta"><span class="status-badge is-stable">Stable</span> ships in the latest release, <a href="https://github.com/ziranlang/ziran/releases/tag/v0.7.0">v0.7.0</a> (for a package: it has a tagged release). <span class="status-badge is-in-progress">In progress</span> exists only on <code>master</code> or has no release yet.</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Sections</strong><a href="#std">Standard library</a><a href="#packages">Packages</a></aside><div class="article-body">
<section id="std"><h2>Standard library</h2><p>Import a module with <code>#import "std/NAME"</code>. Modules ending in <code>_linux</code>, <code>_windows</code> or <code>_go</code> build only for that target. A module that needs a host capability runs in a portable bundle only when the program hosting the bundle binds it. 127 of 128 modules shipped in the latest release.</p><div class="table-scroll"><table class="module-table"><thead><tr><th scope="col">Module</th><th scope="col">Summary</th><th scope="col">Needs</th><th scope="col">Status</th></tr></thead><tbody>
<tr><th scope="row"><a href="std/atomic_go.html">atomic_go</a></th><td>Go unsigned 64-bit atomic counters.</td><td>Go target</td><td><span class="status-badge is-stable">Stable</span></td></tr>
@@ -25,7 +25,6 @@
<tr><th scope="row"><a href="std/base64.html">base64</a></th><td>RFC 4648 base64 encoding and decoding on every target, for data: URIs, embedded binary payloads and wire protocols.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/binary.html">binary</a></th><td>Little-endian numbers in byte text, such as file or asset contents, read the same way on every native target and in the engine.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/binary_linux.html">binary_linux</a></th><td>Little-endian binary fields for native Linux programs.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/bundle_guest.html">bundle_guest</a></th><td>A portable coordinator may use these capabilities when its host grants child execution.</td><td>Host capability</td><td><span class="status-badge is-in-progress">In progress</span></td></tr>
<tr><th scope="row"><a href="std/bundle_host.html">bundle_host</a></th><td>Native C ABI for embedding a portable Ziran bundle.</td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/byte_text.html">byte_text</a></th><td><span class=muted>No module description yet.</span></td><td><span class=muted>—</span></td><td><span class="status-badge is-stable">Stable</span></td></tr>
<tr><th scope="row"><a href="std/byte_text_linux.html">byte_text_linux</a></th><td>Borrow UTF-8 bytes as a Ziran string at native foreign-function boundaries.</td><td>Native Linux</td><td><span class="status-badge is-stable">Stable</span></td></tr>
-1
View File
@@ -64,7 +64,6 @@
<url><loc>https://ziran-lang.org/std/base64</loc></url>
<url><loc>https://ziran-lang.org/std/binary</loc></url>
<url><loc>https://ziran-lang.org/std/binary_linux</loc></url>
<url><loc>https://ziran-lang.org/std/bundle_guest</loc></url>
<url><loc>https://ziran-lang.org/std/bundle_host</loc></url>
<url><loc>https://ziran-lang.org/std/byte_text</loc></url>
<url><loc>https://ziran-lang.org/std/byte_text_linux</loc></url>
-16
View File
@@ -1,16 +0,0 @@
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="theme-color" content="#f7f3eb"><meta name="description" content="A portable coordinator may use these capabilities when its host grants child execution."><title>std/bundle_guest · Ziran</title><link rel="canonical" href="https://ziran-lang.org/std/bundle_guest"><link rel="icon" href="../assets/logo-capybara.png" type="image/png"><link rel="stylesheet" href="../styles.css"><script defer src="../site.js"></script></head>
<body><a class="skip-link" href="#main">Skip to content</a><header class="site-header"><div class="site-header-inner"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="primary-nav">Menu</button><nav class="header-nav" id="primary-nav" aria-label="Primary"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html" aria-current="page">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a><button class="theme-toggle" type="button" aria-label="Switch color theme"></button></nav></div></header>
<main id="main" class="article-layout"><div class="article-head"><p class="eyebrow"><a href="../modules.html#std">Modules</a> / Standard library</p><h1>std/bundle_guest</h1><p>A portable coordinator may use these capabilities when its host grants child execution. Handles are local to one caller and zero means no child. A host chooses all child bindings and owns the child until Close or caller teardown. A bundle cannot supply a native binding or callback.</p><p class="module-meta"><span class="status-badge is-in-progress">In progress</span> <span class="module-target">Needs: Host capability.</span> Available on master (Unreleased).</p></div>
<div class="article-grid"><aside class="page-toc"><strong>Declarations</strong><a href="#Open">Open</a><a href="#Restart">Restart</a><a href="#Close">Close</a><a href="#AssetCount">AssetCount</a><a href="#AssetName">AssetName</a><a href="#AssetData">AssetData</a></aside><div class="article-body api-body">
<section><p>Import with <code>#import "std/bundle_guest"</code>.</p><div class="api-list">
<div id="Open"><code>Open :: (bytes: string, identity: string) -&gt; u64</code><p class="api-note">Needs a host capability.</p></div>
<div id="Restart"><code>Restart :: (child: u64) -&gt; bool</code><p class="api-note">Needs a host capability.</p></div>
<div id="Close"><code>Close :: (child: u64) -&gt; bool</code><p class="api-note">Needs a host capability.</p></div>
<div id="AssetCount"><code>AssetCount :: (child: u64) -&gt; u64</code><p class="api-note">Needs a host capability.</p></div>
<div id="AssetName"><code>AssetName :: (child: u64, index: u64) -&gt; string</code><p class="api-note">Needs a host capability.</p></div>
<div id="AssetData"><code>AssetData :: (child: u64, index: u64) -&gt; string</code><p class="api-note">Needs a host capability.</p></div>
</div><p><a class="text-link" href="https://github.com/ziranlang/ziran/blob/master/std/bundle_guest.zi">Source ↗</a> · <a class="text-link" href="../modules.html#std">All modules</a></p></section>
</div></div></main>
<footer><div class="footer-top"><a class="brand" href="../index.html"><img class="brand-icon" src="../assets/logo-capybara.png" alt="" width="36" height="36"><span>Ziran</span></a><nav aria-label="Footer"><a href="../get-started.html">Get started</a><a href="../examples.html">Examples</a><a href="../targets.html">Targets</a><a href="../modules.html">Modules</a><a href="../docs.html">Docs</a><a href="../status.html">Status</a><a href="../index.html#support">Support</a><a href="https://github.com/ziranlang/ziran">GitHub ↗</a></nav></div><div class="footer-bottom"><p>A language for useful software.</p><p>© 2026 Kryon Labs · <a href="https://waozi.xyz/">Made by Waozi</a></p></div></footer></body></html>
-36
View File
@@ -1,36 +0,0 @@
// A portable coordinator may use these capabilities when its host grants
// child execution. Handles are local to one caller and zero means no child.
// A host chooses all child bindings and owns the child until Close or caller
// teardown. A bundle cannot supply a native binding or callback.
host_api :: #system_library "host_api";
OpenChildBundleHost :: (bytes: string, identity: string) -> u64 #foreign host_api;
RestartChildBundleHost :: (child: u64) -> bool #foreign host_api;
CloseChildBundleHost :: (child: u64) -> bool #foreign host_api;
ChildBundleAssetCountHost :: (child: u64) -> u64 #foreign host_api;
ChildBundleAssetNameHost :: (child: u64, index: u64) -> string #foreign host_api;
ChildBundleAssetDataHost :: (child: u64, index: u64) -> string #foreign host_api;
#program_export
Open :: (bytes: string, identity: string) -> u64 {
return OpenChildBundleHost(bytes, identity)
}
#program_export
Restart :: (child: u64) -> bool { return RestartChildBundleHost(child) }
#program_export
Close :: (child: u64) -> bool { return CloseChildBundleHost(child) }
#program_export
AssetCount :: (child: u64) -> u64 { return ChildBundleAssetCountHost(child) }
#program_export
AssetName :: (child: u64, index: u64) -> string {
return ChildBundleAssetNameHost(child, index)
}
#program_export
AssetData :: (child: u64, index: u64) -> string {
return ChildBundleAssetDataHost(child, index)
}
+2 -8
View File
@@ -34,20 +34,14 @@ CheckWalkInputs :: (directory: string, paths: *Vec(string)) -> bool {
CheckExecutable :: (name: string) -> string {
if TextContains(name, "/") {
status := PathStatus(name)
if status.kind == .File && (status.mode & 73) != 0 {
resolved := TextDetach(ResolvePath(name))
if PathName(name) == "ccache" || PathName(resolved) != "ccache" { return resolved }
}
if status.kind == .File && (status.mode & 73) != 0 { return TextDetach(ResolvePath(name)) }
return ""
}
folders := TextSplit(EnvironmentText("PATH"), ":")
for folder: folders {
path := CheckPath(ifx folder == "" then "." else folder, name)
status := PathStatus(path)
if status.kind == .File && (status.mode & 73) != 0 {
resolved := TextDetach(ResolvePath(path))
if name == "ccache" || PathName(resolved) != "ccache" { return resolved }
}
if status.kind == .File && (status.mode & 73) != 0 { return TextDetach(ResolvePath(path)) }
}
return ""
}