v4: the host placer, and a small train placed on Hera at her HERE (ADR step 3, task 4)

place.c places a train's artifact as ABI.md section 5 has it, the
code split at each export with its entry before it. test_mesh_boot
places tests/train-place, built by mkf18a with an import from the
nucleus: its words run by name, the nucleus's ABS is reached, the
kernel records each export, and six refusals leave Hera unchanged.
mkf18a refuses a word that runs on into an export. Failed first;
gates pass, POST 990/990. Plan section 13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-20 12:44:50 +00:00
parent cf2a321807
commit f7769c0e93
16 changed files with 2246 additions and 10 deletions
+30
View File
@@ -175,6 +175,16 @@ static int import_effect(void *ctx, v4_cell addr, v4_effect *out)
return 0;
}
/* For the run-on check: a word walked with its range ending at the next word, and every other address of
* the train known through the whole train's walk, as a call or a tail call. */
typedef struct { build_t *b; v4_effects *whole; v4_cell end; } run_on_t;
static int run_on_effect(void *ctx, v4_cell addr, v4_effect *out)
{
run_on_t *ro = ctx;
if (addr >= 0 && addr < ro->end) { *out = v4_effect_of(ro->whole, addr, V4_EFFECT_CALLED); return 1; }
return import_effect(ro->b, addr, out);
}
/* the nucleus assembled, and its effects: 1, or 0 having failed */
static v4_effects *nfx;
static int nucleus_ready(build_t *b, const char *dir)
@@ -489,6 +499,26 @@ int f18a_build(const f18a_args *a, unsigned char **out, size_t *len, char *err,
e++;
}
/* a word that runs on into an export (plan section 12, 2a as corrected): placement splits the code at
* each export, putting its entry there, so the word before it must not reach it but by a call or a jump */
for (k = 0; k + 1u < nwords && !b.failed; k++) {
v4_text_word_info nx;
v4_effect ef;
v4_effects *one;
run_on_t ro;
v4_text_word_at(&tx, k, &wi);
v4_text_word_at(&tx, k + 1u, &nx);
if (nx.addr <= wi.addr) continue;
if (!v4_effect_of(fx, nx.addr, (nx.flags & 8) ? V4_EFFECT_INLINE : V4_EFFECT_CALLED).fixed) continue;
ro.b = &b; ro.whole = fx; ro.end = code_end;
one = v4_effects_new(&n, wi.addr, nx.addr, run_on_effect, &ro);
if (!one) { fail(&b, "out of memory"); break; }
ef = v4_effect_of(one, wi.addr, (wi.flags & 8) ? V4_EFFECT_INLINE : V4_EFFECT_CALLED);
v4_effects_free(one);
if (!ef.fixed && ef.why && strcmp(ef.why, "it runs outside the code") == 0 && ef.at == nx.addr)
fail(&b, "%s runs on into %s, an export: placement splits the code there", wi.name, nx.name);
}
/* the relocations: every branch can reach every word of a node */
for (k = 0; k < v4_text_addresses(&tx) && !b.failed; k++) {
const v4_text_addr *r = &b.rec[k];
+2 -1
View File
@@ -21,7 +21,8 @@
* V4_ROM_WORDS=..", framed as "config", then the map. The ROM: the ROM's file as given.
* It refuses what the ABI cannot carry: a header, a store or a start in the source; an export's name
* over 31 characters; a port or a request it can see that the word does not declare, or one declared by
* a word it calls.
* a word it calls; a word that runs on into the next export with no call or jump, since placement splits
* the code at each export (plan section 12, 2a).
*/
#ifndef V4_TOOLS_F18A_H
#define V4_TOOLS_F18A_H