archive el_runtime.c — native El runtime complete, seed is self-contained

el_seed.c now defines el_request_start/el_request_end directly (delegating
to its own seed arena) rather than declaring them as externs from el_runtime.c.
Header comment updated to reflect self-contained build.
This commit is contained in:
Will Anderson
2026-05-03 17:08:49 -05:00
parent 71a1e41f93
commit beb4e436e1
3 changed files with 42 additions and 42 deletions
+15 -31
View File
@@ -1,21 +1,15 @@
/*
* el_seed.c — El language seed runtime: minimal C OS boundary
*
* This file exposes all OS-boundary primitives that new-generation El programs
* need, under the __ prefix convention. Implementations are lifted directly
* from el_runtime.c and wrapped/renamed rather than reimplemented.
* This file exposes all OS-boundary primitives that El programs need, under
* the __ prefix convention. It is self-contained: all allocators, arena
* management, and el_request_start / el_request_end are defined here.
*
* Threading is the most important new piece here. __thread_create / __thread_join
* use dlsym(RTLD_DEFAULT) to look up El function symbols at runtime — the same
* technique http_set_handler uses. This is the foundation of El's parallelism.
*
* The ABI functions (el_list_*, el_map_*, el_retain, el_release, json_parse,
* el_wrap_str, EL_CSTR, el_strdup, el_request_start, el_request_end) are
* defined in el_runtime.c and used here by declaration only. This file does
* NOT redefine them.
* Threading: __thread_create / __thread_join use dlsym(RTLD_DEFAULT) to look
* up El function symbols at runtime. This is the foundation of El's parallelism.
*
* Link: cc -std=c11 -I el-compiler/runtime -lcurl -lpthread \
* -o <out> <prog>.c el_seed.c el_runtime.c
* -o <out> <prog>.c el_seed.c
*/
#ifndef _GNU_SOURCE
@@ -43,26 +37,11 @@
#include <dlfcn.h>
#include <curl/curl.h>
/* ── Forward declarations from el_runtime.c (ABI + allocators) ──────────── */
/* These are defined in el_runtime.c and linked in. */
extern void el_request_start(void);
extern void el_request_end(void);
/* Internal el_runtime.c allocators — declared here so el_seed.c can use them.
* They are static in el_runtime.c; el_seed.c has its own parallel copies
* below so it can operate standalone or alongside el_runtime.c. */
/* ── Private allocator (parallel to el_runtime.c) ────────────────────────── */
/* ── Private allocator ───────────────────────────────────────────────────── */
/*
* el_seed.c carries its own arena so it can be compiled with or without
* el_runtime.c. When linked together, the seed arena is separate from the
* runtime arena — both reset independently per HTTP request.
*
* For seed-only programs that never call el_request_start/el_request_end from
* el_runtime.c, the seed arena provides equivalent per-request cleanup through
* __seed_request_start / __seed_request_end (called automatically by the
* __http_serve path).
* el_seed.c carries its own arena for per-request allocation tracking.
* The arena is reset at el_request_start / el_request_end, which are defined
* below and delegate to seed_request_start / seed_request_end.
*/
#define SEED_ARENA_INITIAL 512
@@ -99,6 +78,11 @@ static void seed_request_end(void) {
_seed_arena.count = 0;
}
/* el_request_start / el_request_end — formerly defined in el_runtime.c.
* Now self-contained in el_seed.c, delegating to the seed arena. */
void el_request_start(void) { seed_request_start(); }
void el_request_end(void) { seed_request_end(); }
/* Persistent alloc — bypasses arena (state, engram internals). */
static char* seed_strdup_persist(const char* s) {
if (!s) return strdup("");
+11 -4
View File
@@ -45,10 +45,17 @@ function activate(context) {
// ── Resolve el-lsp binary ────────────────────────────────────────────
const config = workspace.getConfiguration('el');
// Default path: ../dist/el-lsp relative to the extension root.
// Override with the "el.lspPath" workspace/user setting.
const defaultLspPath = path.join(context.extensionPath, '..', 'dist', 'el-lsp');
const serverPath = config.get('lspPath', defaultLspPath);
// Default path resolution (tries in order):
// 1. el.lspPath setting (user override)
// 2. dist/el-lsp alongside the extension dir (packaged install)
// 3. The canonical source-tree location
const CANONICAL_LSP = '/Users/will/Development/neuron-technologies/foundation/el/tools/lsp/dist/el-lsp';
const defaultLspPath = (() => {
const sibling = path.join(context.extensionPath, 'dist', 'el-lsp');
if (fs.existsSync(sibling)) return sibling;
return CANONICAL_LSP;
})();
const serverPath = config.get('lspPath') || defaultLspPath;
if (!fs.existsSync(serverPath)) {
window.showErrorMessage(
+16 -7
View File
@@ -1,11 +1,10 @@
{
"name": "el-language",
"displayName": "El Language",
"description": "El language support syntax highlighting, completions, hover, go-to-definition, and diagnostics",
"description": "El language support \u2014 syntax highlighting, completions, hover, go-to-definition, and diagnostics",
"version": "1.0.0",
"publisher": "neuron-technologies",
"license": "MIT",
"icon": "icon.png",
"repository": {
"type": "git",
"url": "https://github.com/neuron-technologies/foundation"
@@ -32,8 +31,14 @@
"languages": [
{
"id": "el",
"aliases": ["El", "el-lang"],
"extensions": [".el", ".elh"],
"aliases": [
"El",
"el-lang"
],
"extensions": [
".el",
".elh"
],
"configuration": "./language-configuration.json"
}
],
@@ -55,9 +60,13 @@
},
"el.trace.server": {
"type": "string",
"enum": ["off", "messages", "verbose"],
"enum": [
"off",
"messages",
"verbose"
],
"default": "off",
"description": "Trace LSP messages between VSCode and el-lsp (visible in Output El LSP Trace)."
"description": "Trace LSP messages between VSCode and el-lsp (visible in Output \u2192 El LSP Trace)."
}
}
},
@@ -81,4 +90,4 @@
"package": "vsce package",
"install-dev": "npm install && code --install-extension el-language-1.0.0.vsix 2>/dev/null || true"
}
}
}