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:
@@ -0,0 +1,43 @@
|
||||
/* SPDX-License-Identifier: LicenseRef-Starship-1.0
|
||||
* Copyright (c) 2023-2026 Robert A. James
|
||||
*/
|
||||
/* place.h -- place a train's F18 artifact on a node: resolution without a linker (ABI.md section 5).
|
||||
*
|
||||
* docs/v4.0.0/plans/2026-11-19-f18-artifact-build.md section 12, task 4. The host placer, in C: the
|
||||
* oracle for the loader on the node (the ADR's step 6), not part of the engine. One pass, in order:
|
||||
* 1. CHECK, before anything is written (fail closed): the artifact is valid (artifact.h), for this
|
||||
* node's cell width and size; every import is from the nucleus (hash 0: section 10, ruling 4), its
|
||||
* name is in the FORTH vocabulary, not in line, and the effect derived for it there (effect.c) is
|
||||
* the one the artifact expects; the train and its entries fit below DLIMIT.
|
||||
* 2. PLACE, at HERE, the base. The code is split at each export (ruling 2a): the code before the first
|
||||
* export goes first, with no entry; then each export's entry, laid as (HEADER) lays one (dict.f18:
|
||||
* the name, then the word ID, the flags, the name's word address and the link), then its code up to
|
||||
* the next export's. So every cell of the code moves by the entries laid before it.
|
||||
* 3. FIX each relocation: a branch field or a whole cell given the moved address of its target, or the
|
||||
* import's xt. A branch whose target its slot cannot reach from its new place is refused, in step 1.
|
||||
* 4. ENTER: each entry goes into the vocabulary whose head cell is given (CURRENT's), the next word ID
|
||||
* is taken from (NEXT-ID), DP is moved past the train, and the kernel is told of each xt, as
|
||||
* (WORD-DEFINED) is told of an entry (HEADER) makes.
|
||||
*/
|
||||
#ifndef V4_PLACE_H
|
||||
#define V4_PLACE_H
|
||||
|
||||
#include "v4/node.h"
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct {
|
||||
v4_cell dp; /* word address of DP: the next free byte */
|
||||
v4_cell dlimit; /* the byte address dictionary space ends at */
|
||||
v4_cell head; /* the head cell of the vocabulary the entries go into */
|
||||
v4_cell forth; /* FORTH's head cell, (LATEST): where an import's name is looked up */
|
||||
v4_cell next_id; /* word address of (NEXT-ID) */
|
||||
void (*defined)(void *ctx, v4_cell xt); /* the kernel told of an entry made, or NULL */
|
||||
void *ctx;
|
||||
} v4_train_env;
|
||||
|
||||
/* Place the artifact `a` of `len` bytes on node `n`. 1, with the exports' xts in xts[0 .. *count)
|
||||
* in the artifact's order, or 0 with why in *why and the node unchanged. */
|
||||
int v4_train_place(v4_node *n, const unsigned char *a, size_t len, const v4_train_env *env,
|
||||
v4_cell *xts, unsigned max, unsigned *count, const char **why);
|
||||
|
||||
#endif /* V4_PLACE_H */
|
||||
Reference in New Issue
Block a user