refactor(ffi-linkage): Phase 9.1a — rename collision-free linkage identifiers
Mechanical src/ rename of the linkage-family identifiers whose extern_* target is collision-free: callForeign→callExtern, marshalForeignArg→marshalExternArg, dedupeForeignSymbol→dedupeExternSymbol, foreign_name_map→extern_name_map, is_foreign_c_api→is_extern_c_api. Snapshot-neutral (internal only); suite green (646 corpus / 444 unit, 0 failed). Deferred (need per-site analysis — target name already exists): is_foreign↔is_extern (38 existing), foreign_lib/foreign_name↔extern_lib/extern_name (15/16 existing), foreign_expr (still built by c_import.zig auto-synthesis). Runtime-class family (ForeignClassDecl etc. → Runtime*, Decision 5) is Phase 9.2.
This commit is contained in:
@@ -405,7 +405,7 @@ pub const Interpreter = struct {
|
||||
/// underlying address. The returned `usize` is only valid for the
|
||||
/// duration of this call — caller-allocated buffers are tracked in
|
||||
/// `tmp` so they get freed once the call returns.
|
||||
fn marshalForeignArg(self: *Interpreter, v: Value, tmp: *std.ArrayList([]u8)) !usize {
|
||||
fn marshalExternArg(self: *Interpreter, v: Value, tmp: *std.ArrayList([]u8)) !usize {
|
||||
return switch (v) {
|
||||
.int => |i| @bitCast(i),
|
||||
.boolean => |b| @intFromBool(b),
|
||||
@@ -488,7 +488,7 @@ pub const Interpreter = struct {
|
||||
}
|
||||
}
|
||||
|
||||
fn callForeign(self: *Interpreter, func: *const inst_mod.Function, args: []const Value) InterpError!Value {
|
||||
fn callExtern(self: *Interpreter, func: *const inst_mod.Function, args: []const Value) InterpError!Value {
|
||||
const name = self.module.types.getString(func.name);
|
||||
|
||||
// A foreign call may not return (e.g. `process.exit` → `_exit`), which
|
||||
@@ -513,7 +513,7 @@ pub const Interpreter = struct {
|
||||
tmp.deinit(self.alloc);
|
||||
}
|
||||
for (args, 0..) |a, i| {
|
||||
packed_args[i] = self.marshalForeignArg(a, &tmp) catch return error.TypeError;
|
||||
packed_args[i] = self.marshalExternArg(a, &tmp) catch return error.TypeError;
|
||||
}
|
||||
const argv = packed_args[0..args.len];
|
||||
|
||||
@@ -569,7 +569,7 @@ pub const Interpreter = struct {
|
||||
// Dispatch to host libc via dlsym. Lets `#run` (and the
|
||||
// post-link bundler) call ordinary foreign symbols like
|
||||
// `puts`, `getenv`, `posix_spawn`, etc.
|
||||
return self.callForeign(func, args);
|
||||
return self.callExtern(func, args);
|
||||
}
|
||||
|
||||
// Track the sx call chain for `trace.print_interpreter_frames()`.
|
||||
|
||||
Reference in New Issue
Block a user