Names in the .asm: one owner per name (2026-10-09)¶
Commits 96fcdaf (cppcomp) and d8f4eeb (cmmcomp), in [Unreleased] of the
CHANGELOG. This note records what a user can no longer write and why, so the
manual can say it (issue #40).
The problem¶
Both compilers turn every source name into a word of the .asm, and the
assembler has a single table for data and one for labels. Nothing checked
that the .asm spelling of a user name was free. Measured in simulation,
code up to 607bff4:
Source |
What happened |
|---|---|
|
C+- dropped the |
global |
C++: one word for both, silently. C+- refused, with a misleading message |
global |
overwritten by the post-increment or by |
global |
the loop label: no output at all |
global |
took the remainder of every unsigned division |
|
the frame pointer |
The rules¶
A name whose
.asmspelling is an instruction is refused. The list comes from the ISA table inCompilers/common/asm_share.c(asm_is_mnemonic()), whichScripts/check_isa.pykeeps equal to the assembler, so a new instruction is reserved without touching the compilers. The check is on the.asmspelling: a localADDofmainismain_ADDand is legal; a localADDof a functionSisS_ADD, an instruction, and is refused.Every name the compiler makes starts with
__: loop and switch labels,aux_var, the stdlib’s scratch words, thefloat_*routines, cppcomp’s runtime routines and temporaries. C+- refuses a user name starting with__; C++ refuses any name with__in it, as the C++ standard reserves those.A name has one owner. A name whose
.asmspelling already belongs to a global, to a local of another function, to a function, or to the imaginary part of acomp(zkeeps it inz_i) is refused, and the message names both owners. C++ also refuses two overloads that map to the same.asmname.
Reserved words: a function may not be called fim (the program ends at the
label @fim, which Aurora reads), global (marks the globals in the
simulation log) or num_ins (a key of that log). A variable named fim
stays legal: data and labels are separate tables in asmcomp.
Evidence¶
Negative fixtures, one per case, in Compilers/CMMComp/NegTests/names_*.cmm
and Compilers/CPPComp/NegTests/names_*.cpp (the regress checks each is
refused with the right message). Positive: cmm_names printed
7 1969225728 1983905800 4 5 9 with the old compiler, 7 2 10 4 5 9 now;
test90 printed udm_r = 1 before. The 71 C+- golden .asm that changed
differ only by the __ prefix. Full regress on 2026-10-10: 202 of 203; the one
failure was the sapho_all block check, which did not know LINKAS
(fixed in 3a96072, the check rerun alone passes).
For the documentation (issue #40)¶
The user-facing text says: a name may not be spelt like an instruction of
the processor once the compiler prefixes it (a local x of f becomes
f_x); names starting with __ belong to the compiler (C++: any name
containing __); a comp z also owns z_i; two names that become the same
.asm word are an error, and the message says which two; a function may not
be called fim, global or num_ins. Old programs that broke one of these
rules compiled into a wrong program; they now stop with an error naming the
line.