w6a: drop chained-ptr-write workaround (c5f30f2 unblocked it)

This commit is contained in:
2026-05-11 22:35:01 +09:00
parent c5f30f2fce
commit 4ff63a0a40
3 changed files with 10 additions and 24 deletions

View File

@@ -449,11 +449,10 @@ type aoperand = struct {
asym: str, asym: str,
}; };
// `from` and `to` are pointer-to-aoperand (rather than embedded). The // `from` and `to` are pointer-to-aoperand (rather than embedded).
// C cgen we currently bootstrap on doesn't support chained-dot through // The C cgen doesn't support chained-dot through embedded value
// embedded structs (e.g. p.to.atype where `to` is a value field), but // fields, so allocating each operand once per prog lets us write
// it does support chained-dot through pointer fields. Allocating each // `p.to.atype` directly.
// operand once per prog lets us write `p.to.atype` straightforwardly.
type aprog = struct { type aprog = struct {
as_: i32, as_: i32,
from: *aoperand, from: *aoperand,
@@ -936,13 +935,7 @@ fn addprog(a: *asm_, opc: i32, lbl: str) *aprog = {
pr.from = amalloc(a.a, 48u64): *aoperand; pr.from = amalloc(a.a, 48u64): *aoperand;
pr.to = amalloc(a.a, 48u64): *aoperand; pr.to = amalloc(a.a, 48u64): *aoperand;
if (a.head == nil) { a.head = pr; } if (a.head == nil) { a.head = pr; }
else { else { a.tail.link = pr; };
// `a.tail.link = pr` would be a chained-dot write through a
// pointer field, which the C cgen we bootstrap on doesn't
// support (silently drops the store). Bind a local first.
let tail: *aprog = a.tail;
tail.link = pr;
};
a.tail = pr; a.tail = pr;
return pr; return pr;
}; };

View File

@@ -354,13 +354,7 @@ fn addprog(a: *asm_, opc: i32, lbl: str) *aprog = {
pr.from = amalloc(a.a, 48u64): *aoperand; pr.from = amalloc(a.a, 48u64): *aoperand;
pr.to = amalloc(a.a, 48u64): *aoperand; pr.to = amalloc(a.a, 48u64): *aoperand;
if (a.head == nil) { a.head = pr; } if (a.head == nil) { a.head = pr; }
else { else { a.tail.link = pr; };
// `a.tail.link = pr` would be a chained-dot write through a
// pointer field, which the C cgen we bootstrap on doesn't
// support (silently drops the store). Bind a local first.
let tail: *aprog = a.tail;
tail.link = pr;
};
a.tail = pr; a.tail = pr;
return pr; return pr;
}; };

View File

@@ -130,11 +130,10 @@ type aoperand = struct {
asym: str, asym: str,
}; };
// `from` and `to` are pointer-to-aoperand (rather than embedded). The // `from` and `to` are pointer-to-aoperand (rather than embedded).
// C cgen we currently bootstrap on doesn't support chained-dot through // The C cgen doesn't support chained-dot through embedded value
// embedded structs (e.g. p.to.atype where `to` is a value field), but // fields, so allocating each operand once per prog lets us write
// it does support chained-dot through pointer fields. Allocating each // `p.to.atype` directly.
// operand once per prog lets us write `p.to.atype` straightforwardly.
type aprog = struct { type aprog = struct {
as_: i32, as_: i32,
from: *aoperand, from: *aoperand,