W7e: delete the native unit pipeline (.so compile + dlopen execution)

Units now run exclusively on wasm; the native generated-C++ -> clang -> .so ->
dlopen path and its request-time fallback are removed.

- Dispatch (linux_fastcgi.cpp): the 4 handle_complete branches + the CLI-socket
  path route every request through wasm (wasm_ready compiles cold/stale on
  demand); a wasm-unavailable unit now yields a clean error page
  (fail_wasm_unavailable / render_request_failure) instead of native execution.
  compiler_invoke / _cli / _websocket / _serve_http deleted.
- compiler.cpp (-1274): removed the native .so compile (COMPILE_SCRIPT),
  load_shared_unit, dlopen/dlsym/dlclose, compiler_load_shared_unit, and the
  SharedUnit .so function-pointer fields (on_setup/on_render/on_component/
  on_websocket/on_cli/on_once/on_init) in types.h/types.cpp. compile_shared_unit
  now builds only the .wasm side-module; the .uce preprocessor/parser front-end
  is kept (it emits the C++ the wasm compile consumes).
- unit_call()/component()/once/init now resolve across units through the wasm
  host component resolver (uce_host_component_resolve) instead of native dlsym;
  configured runtime error pages render through the wasm backend.
- Dropped the WASM_BACKEND_ENABLED feature flag and dead COMPILE_SCRIPT /
  COMPILE_WASM_UNITS config; unit ABI freshness tied to UCE_UNIT_ABI_VERSION;
  guard against serving a stale .wasm for a deleted source; retired the obsolete
  W5 native-vs-wasm toggle script. Docs updated.

Implemented via the pi agent (with 3 delegated sub-reviews); independently
re-verified on the build 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:
root
2026-06-14 23:20:50 +00:00
co-authored by Claude Opus 4.8
parent fb728d63bc
commit cf51336873
16 changed files with 352 additions and 1344 deletions
+4 -1
View File
@@ -564,7 +564,10 @@ String compiler_preprocess_shared_unit_char_wise(Request* context, SharedUnit* s
parsed_content.resize(parsed_content.length() - current_line.length());
nibble(current_line, "\"");
String unit_name = nibble(current_line, "\"");
SharedUnit* sub_su = compiler_load_shared_unit(context, unit_name, su->src_path, true);
String resolved_unit = unit_name;
if(resolved_unit != "" && resolved_unit[0] != '/')
resolved_unit = expand_path(resolved_unit, su->src_path);
SharedUnit* sub_su = (resolved_unit == "" ? 0 : get_shared_unit(context, resolved_unit, true));
if(sub_su)
parsed_content.append("#include \"" + sub_su->bin_path + "/" + sub_su->pre_file_name + "\"\n");
}
+156 -1118
View File
File diff suppressed because it is too large Load Diff
-7
View File
@@ -13,16 +13,9 @@ String preprocess_shared_unit(Request* context, SharedUnit* su);
String compiler_generated_cpp_path(Request* context, String source_file);
String compiler_generated_cpp_path(SharedUnit* su);
void setup_unit_paths(Request* context, SharedUnit* su, String file_name);
void load_shared_unit(Request* context, SharedUnit* su);
void compile_shared_unit(Request* context, SharedUnit* su);
SharedUnit* get_shared_unit(Request* context, String file_name, bool opt_so_optional = false);
void compiler_invoke(Request* context, String file_name);
void compiler_invoke_websocket(Request* context, String file_name);
void compiler_invoke_cli(Request* context, String file_name);
void compiler_invoke_serve_http(Request* context, String file_name, String handler_name = "");
SharedUnit* compiler_load_shared_unit(Request* context, String file_name, String current_path = "", bool opt_so_optional = false);
String compiler_error_page_unit(Request* context, String config_key);
bool compiler_render_error_page(Request* context, String config_key, s32 status_code, String status_reason, DValue error_info);
bool compiler_unit_compile_pending(Request* context, String file_name);
String compiler_site_directory(Request* context);
StringList compiler_scan_site_units(Request* context);
-3
View File
@@ -1314,10 +1314,7 @@ StringMap make_server_settings()
StringMap cfg;
cfg["BIN_DIRECTORY"] = "/tmp/uce/work";
cfg["COMPILE_SCRIPT"] = "scripts/compile";
cfg["WASM_COMPILE_SCRIPT"] = "scripts/compile_wasm_unit";
cfg["COMPILE_WASM_UNITS"] = "0";
cfg["WASM_BACKEND_ENABLED"] = "1";
cfg["WASM_BACKEND_VERBOSE"] = "0";
cfg["WASM_CORE_PATH"] = "";
cfg["WASM_MEMORY_LIMIT_BYTES"] = std::to_string(512ull * 1024 * 1024);
-6
View File
@@ -79,12 +79,6 @@ String http_status_reason(s32 code)
SharedUnit::~SharedUnit()
{
#ifndef __UCE_WASM_CORE__
if(so_handle)
{
dlclose(so_handle);
}
#endif
}
String nibble(String div, String& haystack)
-13
View File
@@ -74,7 +74,6 @@ struct SharedUnit {
String compile_output_file_name;
String setup_file_name;
StringList api_declarations;
std::map<String, void*> api_functions;
String src_path;
String bin_path;
@@ -84,16 +83,6 @@ struct SharedUnit {
String wasm_file_name;
String pre_file_name;
void* so_handle = 0;
request_handler on_setup = 0;
request_ref_handler on_render = 0;
request_ref_handler on_component = 0;
request_ref_handler on_websocket = 0;
request_ref_handler on_cli = 0;
request_ref_handler on_once = 0;
request_ref_handler on_init = 0;
String compiler_messages;
String compile_status = "unknown";
String compile_error_status = "";
@@ -153,8 +142,6 @@ String nibble(String div, String& haystack);
#include "dvalue.h"
void compiler_invoke(Request* context, String file_name);
struct Request {
ServerState* server = 0;