Skip to content

Commit b3af9ed

Browse files
committed
Drop M7 FFI source-shape guards
1 parent 7e2dfd4 commit b3af9ed

2 files changed

Lines changed: 7 additions & 124 deletions

File tree

notes/ci-source-search-policy.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ output, CSVs, or marker files. Generic file/text helpers remain available for
2323
those artifacts, but must not be paired with `src/*.c`, `src/*.h`,
2424
`src/*.dasc`, `tests/*.lua`, or `tools/*.sh` snippet checks.
2525

26+
2026-07-01 follow-up: removed the stale M7 Perl guards that read
27+
`src/lj_ccall.c`, `src/lj_cconv.c`, `src/lj_carith.c`, and `src/lib_bit.c`.
28+
Their useful signal now lives in the existing parser-token behavior fixtures:
29+
`t-ffi-ccall-struct-overflow.c`, `t-ffi-cconv-init-snapshot.c`,
30+
`t-ffi-cdata-conv-snapshot.c`, `t-ffi-carith-check64-snapshot.c`, and
31+
`t-ffi-carith-arg-snapshot.c`.
32+
2633
The only supported shell entrypoint under `tools/ci/` is
2734
`tools/ci/lua_test.sh`. Run focused cases as
2835
`tools/ci/lua_test.sh <case...>`; do not add per-case compatibility wrapper

tests/suites/m7_ffi.lua

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -88,126 +88,6 @@ local function build_clib_ldscript_fixture(t)
8888
return write_ld_script(script, so)
8989
end
9090

91-
local function assert_ccall_struct_arg_uses_cached_align(t)
92-
local script = [[
93-
my $path = shift @ARGV;
94-
open my $fh, "<", $path or die "$path: $!\n";
95-
local $/;
96-
my $src = <$fh>;
97-
$src =~ /(static int ccall_struct_arg.*?\n})/s
98-
or die "missing ccall_struct_arg body\n";
99-
my $body = $1;
100-
my $conv = index($body, "lj_cconv_ct_tv_l");
101-
die "missing ccall_struct_arg conversion call\n" if $conv < 0;
102-
die "missing cached stack alignment before conversion\n"
103-
unless $body =~ /MSize\s+align\s*=\s*\(1u\s*<<\s*ctype_align\(ctype_info_acq\(d\)\)\)\s*-\s*1;/;
104-
my $tail = substr($body, $conv);
105-
die "ccall_struct_arg reads d ctype info after wait-capable conversion\n"
106-
if $tail =~ /ctype_info_acq\s*\(\s*d\s*\)/;
107-
]]
108-
utils.capture_command("perl -e " .. shell_quote(script) .. " " ..
109-
shell_quote(t:path("src", "lj_ccall.c")),
110-
{ stderr = true })
111-
end
112-
113-
local function assert_cconv_ct_tv_snapshots_destination(t)
114-
local script = [[
115-
my $path = shift @ARGV;
116-
open my $fh, "<", $path or die "$path: $!\n";
117-
local $/;
118-
my $src = <$fh>;
119-
$src =~ /(void lj_cconv_ct_tv_l\(.*?\n})/s
120-
or die "missing lj_cconv_ct_tv_l body\n";
121-
my $body = $1;
122-
my $copy = index($body, "cconv_ctype_copy(&dsnap, d);");
123-
my $assign = index($body, "d = &dsnap;");
124-
die "missing destination snapshot copy in lj_cconv_ct_tv_l\n"
125-
if $copy < 0 || $assign < 0 || $copy > $assign;
126-
my $first_wait = length($body);
127-
for my $needle ("cconv_ctype_snapshot_wait", "cconv_rawid_wait",
128-
"lj_ctype_enumconst_wait") {
129-
my $idx = index($body, $needle);
130-
$first_wait = $idx if $idx >= 0 && $idx < $first_wait;
131-
}
132-
die "destination snapshot is after a wait-capable ctype lookup\n"
133-
if $assign > $first_wait;
134-
]]
135-
utils.capture_command("perl -e " .. shell_quote(script) .. " " ..
136-
shell_quote(t:path("src", "lj_cconv.c")),
137-
{ stderr = true })
138-
end
139-
140-
local function assert_cconv_ct_ct_snapshots_operands(t)
141-
local script = [[
142-
my $path = shift @ARGV;
143-
open my $fh, "<", $path or die "$path: $!\n";
144-
local $/;
145-
my $src = <$fh>;
146-
$src =~ /(void lj_cconv_ct_ct_l\(.*?\n})/s
147-
or die "missing lj_cconv_ct_ct_l body\n";
148-
my $body = $1;
149-
my @required = (
150-
"cconv_ctype_copy(&dsnap, d);",
151-
"cconv_ctype_copy(&ssnap, s);",
152-
"d = &dsnap;",
153-
"s = &ssnap;"
154-
);
155-
my $last = -1;
156-
for my $needle (@required) {
157-
my $idx = index($body, $needle);
158-
die "missing raw C-to-C operand snapshot step: $needle\n" if $idx < 0;
159-
die "raw C-to-C operand snapshot steps are out of order\n" if $idx < $last;
160-
$last = $idx;
161-
}
162-
my $first_wait = length($body);
163-
for my $needle ("cconv_ctype_snapshot_wait", "cconv_rawid_wait",
164-
"lj_ctype_enumconst_wait") {
165-
my $idx = index($body, $needle);
166-
$first_wait = $idx if $idx >= 0 && $idx < $first_wait;
167-
}
168-
die "raw C-to-C operand snapshots are after a wait-capable ctype lookup\n"
169-
if $last > $first_wait;
170-
]]
171-
utils.capture_command("perl -e " .. shell_quote(script) .. " " ..
172-
shell_quote(t:path("src", "lj_cconv.c")),
173-
{ stderr = true })
174-
end
175-
176-
local function assert_carith_operands_use_snapshots(t)
177-
local script = [[
178-
my ($carith, $bit) = @ARGV;
179-
open my $fh, "<", $carith or die "$carith: $!\n";
180-
local $/;
181-
my $src = <$fh>;
182-
die "arithmetic ctype refresh helpers remain\n"
183-
if $src =~ /carith_refresh_(?:prior_)?ctypes/;
184-
die "missing arithmetic operand snapshot helper\n"
185-
unless $src =~ /static void carith_set_operand_snapshot/;
186-
die "missing arithmetic operand ID snapshot helper\n"
187-
unless $src =~ /static void carith_set_operand_id/;
188-
die "lj_carith_check64 source still returns a live CType pointer\n"
189-
if $src =~ /CType\s+\*\*spct/;
190-
while ($src =~ /^([^\n]*ctype_get\(cts[^\n]*)$/mg) {
191-
my $line = $1;
192-
next if $line =~ /carith_ctype_copy\s*\(/;
193-
die "raw ctype_get in lj_carith.c outside local copy: $line\n";
194-
}
195-
open my $bfh, "<", $bit or die "$bit: $!\n";
196-
$src = <$bfh>;
197-
die "missing bit library CType copy helper\n"
198-
unless $src =~ /static void bit_ctype_copy/;
199-
while ($src =~ /^([^\n]*ctype_get\(cts[^\n]*)$/mg) {
200-
my $line = $1;
201-
next if $line =~ /bit_ctype_copy\s*\(/;
202-
die "raw ctype_get in lib_bit.c outside local copy: $line\n";
203-
}
204-
]]
205-
utils.capture_command("perl -e " .. shell_quote(script) .. " " ..
206-
shell_quote(t:path("src", "lj_carith.c")) .. " " ..
207-
shell_quote(t:path("src", "lib_bit.c")),
208-
{ stderr = true })
209-
end
210-
21191
return function(add)
21292
add({
21393
name = "m7_ffi_ccall_native",
@@ -216,7 +96,6 @@ return function(add)
21696
local struct_so
21797
assert_recorded_ffi_calls_gate_fails(t)
21898
clean_build(t)
219-
assert_ccall_struct_arg_uses_cached_align(t)
22099
struct_so = build_shared_library(t,
221100
t:tmp("lj_t-ffi-ccall-struct-overflow.so"),
222101
"t-ffi-ccall-struct-overflow-lib.c")
@@ -297,7 +176,6 @@ return function(add)
297176
description = "FFI arithmetic/raw conversion behavior",
298177
run = function(t)
299178
clean_build(t)
300-
assert_carith_operands_use_snapshots(t)
301179
build_and_run_c(t, t:tmp("lj_t-ffi-carith-check64-snapshot"),
302180
"t-ffi-carith-check64-snapshot.c",
303181
{ build = false, timeout = "20s" })
@@ -476,8 +354,6 @@ assert(cl.lj_clib_ldscript_value() == 42)
476354
description = "FFI ctype metadata snapshot behavior",
477355
run = function(t)
478356
clean_build(t)
479-
assert_cconv_ct_ct_snapshots_operands(t)
480-
assert_cconv_ct_tv_snapshots_destination(t)
481357
build_and_run_c(t, t:tmp("lj_t-ffi-typeinfo-snapshot"),
482358
"t-ffi-typeinfo-snapshot.c", { timeout = "20s" })
483359
build_and_run_c(t, t:tmp("lj_t-ffi-tonumber-snapshot"),

0 commit comments

Comments
 (0)