W7f: sweep dead/legacy/fallback leftovers after native-pipeline removal
Post-deletion cleanup (units run only on wasm): - types.h/compiler.cpp: drop the native-era SharedUnit fields so_name, bin_file_name, and the opt_so_optional cache-mode plumbing (no native optional .so path remains). The per-unit compile lock is re-keyed from so_name+.lock to wasm_name+.lock (still per-unit). - unit_info() and to_string(SharedUnit*) no longer expose .so artifact fields. - backend.h: drop the stale "+ fallback-token gate" comment. - Docs/comments corrected to wasm-only reality: README, tests/README, site/doc C++ preprocessor + error_pages + unit_info pages, site/info intro, site/demo/unit-browser artifact card; the Phase-5 native-vs-wasm benchmark harness (tests/wasm_benchmark.py) reframed for the wasm-only backend. Audit confirmed no live references remain to so_handle, load_shared_unit, compiler_load_shared_unit, compiler_invoke*/_cli/_websocket/_serve_http, COMPILE_SCRIPT/COMPILE_WASM_UNITS, or the native export-symbol constants; request_ref_handler/dv_call_handler are kept (live wasm funcref casts). Swept via the pi agent (delegated to a gpt-5.3-codex-spark sub-model); independently re-verified on the host: run_cli_tests --include-wasm-kill => 87 passed, 0 failed, 0 skipped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -157,16 +157,16 @@ RENDER(Request& context)
|
||||
</div>
|
||||
<div class="detail-card">
|
||||
<strong>Runtime Flags</strong>
|
||||
<span>loaded <?= unit_flag_label(selected_info["loaded"]) ?>, stale <?= unit_flag_label(selected_info["stale"]) ?>, current <?= unit_flag_label(selected_info["current_unit"]) ?></span>
|
||||
<span>wasm <?= unit_flag_label(selected_info["wasm_available"]) ?>, stale <?= unit_flag_label(selected_info["stale"]) ?>, current <?= unit_flag_label(selected_info["current_unit"]) ?></span>
|
||||
</div>
|
||||
<div class="detail-card">
|
||||
<strong>Artifacts</strong>
|
||||
<code><?= selected_info["so_name"].to_string() ?></code>
|
||||
<code><?= selected_info["wasm_name"].to_string() ?></code>
|
||||
</div>
|
||||
<div class="detail-card">
|
||||
<strong>Timestamps</strong>
|
||||
<span>Source file: <?= time_format_relative(selected_info["source_mtime"].to_u64()) ?><br>
|
||||
Binary: <?= time_format_relative(selected_info["compiled_mtime"].to_u64()) ?><br>
|
||||
Wasm: <?= time_format_relative(selected_info["compiled_mtime"].to_u64()) ?><br>
|
||||
Meta info: <?= time_format_relative(selected_info["metadata_mtime"].to_u64()) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,7 @@ INIT(Request& context)
|
||||
:content
|
||||
Defines a worker-load hook for the current `.uce` unit.
|
||||
|
||||
When a worker loads the unit's compiled shared object into memory, the runtime checks whether the unit exposes `INIT(Request& context)`. If it does, the hook runs once for that load before the unit begins serving later requests from that in-memory copy.
|
||||
When a worker instantiates the unit's compiled wasm module, the runtime checks whether the unit exposes `INIT(Request& context)`. If it does, the hook runs once for that instance before the unit begins serving requests from that worker-local copy.
|
||||
|
||||
Because UCE usually loads units on demand during a request, `INIT()` still receives a valid `Request& context`. Use it for worker-local initialization, not for request-local state that should reset each request.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ unit_call
|
||||
:content
|
||||
UCE runs a small custom source-to-source preprocessor before Clang sees a `.uce` or `.ws.uce` file.
|
||||
|
||||
The template rewriting implementation lives in `src/lib/compiler-parser.cpp`, with orchestration in `src/lib/compiler.cpp`. It does not try to parse all of C++. Instead, it performs a narrow character-wise rewrite that understands literal output, inline code islands, `#load`, and `EXPORT` harvesting, then writes a generated `.cpp` file and compiles that file into a shared object.
|
||||
The template rewriting implementation lives in `src/lib/compiler-parser.cpp`, with orchestration in `src/lib/compiler.cpp`. It does not try to parse all of C++. Instead, it performs a narrow character-wise rewrite that understands literal output, inline code islands, `#load`, and `EXPORT` harvesting, then writes a generated `.cpp` file and compiles that file into a WebAssembly side module.
|
||||
|
||||
## Syntax
|
||||
|
||||
@@ -32,7 +32,7 @@ The template rewriting implementation lives in `src/lib/compiler-parser.cpp`, wi
|
||||
|
||||
## Pipeline
|
||||
|
||||
- The generated file starts by including the logical runtime header `uce_lib.h`; native and WASM compile scripts provide the include path.
|
||||
- The generated file starts by including the logical runtime header `uce_lib.h`; the wasm unit compile script provides the include path.
|
||||
- It then inlines the configured setup template from `SETUP_TEMPLATE` (by default `scripts/setup.h.template`), which defines the internal hook `__uce_set_current_request(Request*)`.
|
||||
- It inserts `#line 1` before page code so compiler diagnostics point back to the original `.uce` file.
|
||||
- Each literal region is rewritten into one or more `print(R"...( ... )...");` calls using a safe raw-string delimiter selected for that literal content.
|
||||
@@ -47,8 +47,8 @@ The template rewriting implementation lives in `src/lib/compiler-parser.cpp`, wi
|
||||
- Lines beginning with `RENDER:NAME(...)` are rewritten into exported `__uce_render_NAME(...)` functions.
|
||||
- Lines beginning with `COMPONENT:NAME(...)` are rewritten into exported `__uce_component_NAME(...)` functions for the component helpers.
|
||||
- The final generated source is written to `BIN_DIRECTORY + src_path + "/" + source_file + ".cpp"`.
|
||||
- `scripts/compile` then compiles that generated `.cpp` into `source_file + ".so"` with `clang++ -shared -std=c++20 ...`.
|
||||
- When a worker loads the compiled unit into memory, the runtime checks for `INIT(Request& context)` and calls it once for that worker-side load.
|
||||
- `scripts/compile_wasm_unit` then compiles that generated `.cpp` into `source_file + ".wasm"` as a PIC WebAssembly side module.
|
||||
- When a worker instantiates the compiled unit, the runtime checks for `INIT(Request& context)` and calls it once for that worker-side instance.
|
||||
- On each request, the first time a given unit is entered through `RENDER()`, `CLI()`, or any `COMPONENT...` handler, the runtime checks for `ONCE(Request& context)` and calls it before the selected handler.
|
||||
|
||||
## Generated Files
|
||||
@@ -56,7 +56,7 @@ The template rewriting implementation lives in `src/lib/compiler-parser.cpp`, wi
|
||||
For a source file like `/some/path/page.uce`, the preprocessor produces:
|
||||
|
||||
- generated C++: `BIN_DIRECTORY/some/path/page.uce.cpp`
|
||||
- shared object: `BIN_DIRECTORY/some/path/page.uce.so`
|
||||
- wasm side module: `BIN_DIRECTORY/some/path/page.uce.wasm`
|
||||
- export list: `BIN_DIRECTORY/some/path/page.uce.exports.txt`
|
||||
|
||||
## Examples
|
||||
@@ -153,7 +153,7 @@ The page template can then render `context.call["fragments"]["head"]` inside `<h
|
||||
- `EXPORT` harvesting only triggers when the current line starts with `EXPORT` at column 1 and is followed by whitespace.
|
||||
- Relative `#load` paths are expanded against the including unit's source directory.
|
||||
- `unit_render()` and `unit_call()` are runtime APIs. `#load` is a compile-time composition feature.
|
||||
- `INIT()` runs when the shared object is loaded into a worker during a request-triggered load, so it still receives a valid `Request& context`.
|
||||
- `INIT()` runs when the wasm unit is instantiated by a worker during a request-triggered load, so it still receives a valid `Request& context`.
|
||||
- `ONCE()` is tracked per request and per resolved unit file. A file entered multiple times in one request only runs `ONCE()` once.
|
||||
|
||||
## Limitations
|
||||
|
||||
@@ -42,7 +42,7 @@ RENDER(Request& context)
|
||||
}
|
||||
```
|
||||
|
||||
The compiling page is only used while `PROACTIVE_COMPILE_ENABLED` is on (the default) — otherwise nothing would finish the build, and the runtime falls back to the blocking compile.
|
||||
The compiling page is only used while `PROACTIVE_COMPILE_ENABLED` is on (the default) — otherwise nothing would finish the build asynchronously, and the runtime waits for the on-request wasm compile.
|
||||
|
||||
## page_compiler_error
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ The returned tree includes:
|
||||
- request and invocation counters
|
||||
- best, worst, last, and average render time
|
||||
- compile counters plus best, worst, last, and average compile time
|
||||
- file mtimes, stale status, ABI compatibility status, load status, and exported API declarations
|
||||
- file mtimes, stale status, ABI compatibility status, wasm availability, and exported API declarations
|
||||
|
||||
If `path` is relative, it is resolved relative to the current executing unit.
|
||||
|
||||
|
||||
+3
-3
@@ -166,7 +166,7 @@ RENDER(Request& context)
|
||||
<h1>Make dynamic websites like it's 2006.</h1>
|
||||
<p class="hero-lead">
|
||||
UCE is a deliberately direct web runtime: files are pages, templates live next to control flow,
|
||||
nginx fronts the whole thing, and a request can compile into a shared object on first hit.
|
||||
nginx fronts the whole thing, and a request can compile into a wasm module on first hit.
|
||||
It is built in the image of PHP's non-architecture, but with an explicit request object,
|
||||
component rendering, and a built-in WebSocket broker.
|
||||
</p>
|
||||
@@ -177,7 +177,7 @@ RENDER(Request& context)
|
||||
</div>
|
||||
<div class="signal-grid">
|
||||
<? render_signal("Files are routes", "A .uce page is the thing you edit and the thing nginx serves."); ?>
|
||||
<? render_signal("Compile on demand", "First request builds a shared object, later requests reuse it."); ?>
|
||||
<? render_signal("Compile on demand", "First request builds a wasm module, later requests reuse it."); ?>
|
||||
<? render_signal("WebSockets included", "Same runtime, same page path, broker-managed connection state."); ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -314,7 +314,7 @@ RENDER(Request& context)
|
||||
</details>
|
||||
<details>
|
||||
<summary>What makes it different from old PHP?</summary>
|
||||
<p>The request object is explicit, components and named handlers are native, markdown support is built in, and WebSockets use a broker-owned connection model inside the runtime.</p>
|
||||
<p>The request object is explicit, components and named handlers are first-class, markdown support is built in, and WebSockets use a broker-owned connection model inside the runtime.</p>
|
||||
</details>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user