refactor(ffi-linkage): Phase 9.2b — rename runtime-class fns + state → runtime_* / is_reference
The runtime-class object-model identifiers (Decision 5): parse/lower/find/resolve/ register/stamp fns Foreign→Runtime (parseRuntimeClassDecl, lowerRuntimeMethodCall, findRuntimeMethodInChain, resolveRuntimeMethodReturnType, registerRuntimeClassDecl, runtimeClassStructType, runtimeKindForOffset, …); state foreign_class_map→ runtime_class_map, current_foreign_class/_method→current_runtime_*, the foreign_class_decl union variant→runtime_class_decl, foreign_method/static/instance/ class→runtime_*; and the reference-vs-define flag is_foreign→is_reference (+ is_foreign_eff→is_reference_eff) now that it only lives on RuntimeClassDecl. Snapshot-neutral; suite green (646/444). Remaining 9.2: the foreign_path family (coupled .sx hooks: jni_main_foreign_path_at spans build.sx/bundle.sx/compiler_hooks.zig/specs.md) + the extern-ref validators (checkForeignRefs etc. → Extern, linkage not runtime) + bare 'foreign' comments.
This commit is contained in:
@@ -275,8 +275,8 @@ pub const Lowering = struct {
|
||||
trace_clear_fid: ?FuncId = null, // extern `sx_trace_clear`
|
||||
needs_trace_runtime: bool = false, // set when lowering emits a trace push/clear; signals Compilation to auto-link sx_trace.c
|
||||
chain_fail_target: ?ChainFailTarget = null, // ERR E2.4: when set, a failable `or` chain routes its TOTAL failure here (an absorbing consumer like `catch`) instead of propagating to the function
|
||||
current_foreign_class: ?*const ast.RuntimeClassDecl = null, // set while lowering a `#jni_main` (or any sx-defined `#jni_class`) bodied method — `super.method(args)` dispatch resolves the parent class against this fcd's `#extends`
|
||||
current_foreign_method: ?ast.RuntimeMethodDecl = null, // the specific method whose body is being lowered; `super.<same_name>(...)` reuses its signature
|
||||
current_runtime_class: ?*const ast.RuntimeClassDecl = null, // set while lowering a `#jni_main` (or any sx-defined `#jni_class`) bodied method — `super.method(args)` dispatch resolves the parent class against this fcd's `#extends`
|
||||
current_runtime_method: ?ast.RuntimeMethodDecl = null, // the specific method whose body is being lowered; `super.<same_name>(...)` reuses its signature
|
||||
type_bindings: ?std.StringHashMap(TypeId) = null, // generic type param bindings ($T → concrete TypeId)
|
||||
current_match_tags: ?[]const u64 = null, // type tags for current match arm (for runtime dispatch)
|
||||
force_block_value: bool = false, // set by lowerBlockValue to extract if-else values
|
||||
@@ -844,9 +844,9 @@ pub const Lowering = struct {
|
||||
// lowerFieldAccess to go through the `__sx_state` ivar
|
||||
// (object_getIvar + struct_gep) when needed — see M1.2 A.3.
|
||||
if (node.data == .type_expr and std.mem.eql(u8, node.data.type_expr.name, "Self")) {
|
||||
if (self.current_foreign_class) |fcd| {
|
||||
if (self.current_runtime_class) |fcd| {
|
||||
if (fcd.runtime == .objc_class or fcd.runtime == .objc_protocol) {
|
||||
return self.foreignClassStructType(fcd);
|
||||
return self.runtimeClassStructType(fcd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1770,15 +1770,15 @@ pub const Lowering = struct {
|
||||
pub const getSelRegisterNameFid = lower_ffi.getSelRegisterNameFid;
|
||||
pub const lowerFfiIntrinsicCall = lower_ffi.lowerFfiIntrinsicCall;
|
||||
pub const lowerJniCall = lower_ffi.lowerJniCall;
|
||||
pub const lowerForeignMethodCall = lower_ffi.lowerForeignMethodCall;
|
||||
pub const resolveForeignClassMemberType = lower_ffi.resolveForeignClassMemberType;
|
||||
pub const resolveForeignMethodReturnType = lower_ffi.resolveForeignMethodReturnType;
|
||||
pub const foreignClassStructType = lower_ffi.foreignClassStructType;
|
||||
pub const lowerRuntimeMethodCall = lower_ffi.lowerRuntimeMethodCall;
|
||||
pub const resolveRuntimeClassMemberType = lower_ffi.resolveRuntimeClassMemberType;
|
||||
pub const resolveRuntimeMethodReturnType = lower_ffi.resolveRuntimeMethodReturnType;
|
||||
pub const runtimeClassStructType = lower_ffi.runtimeClassStructType;
|
||||
pub const lowerObjcMethodCall = lower_ffi.lowerObjcMethodCall;
|
||||
pub const lowerObjcStaticCall = lower_ffi.lowerObjcStaticCall;
|
||||
pub const lowerForeignStaticCall = lower_ffi.lowerForeignStaticCall;
|
||||
pub const lowerRuntimeStaticCall = lower_ffi.lowerRuntimeStaticCall;
|
||||
pub const lowerSuperCall = lower_ffi.lowerSuperCall;
|
||||
pub const registerForeignClassDecl = lower_ffi.registerForeignClassDecl;
|
||||
pub const registerRuntimeClassDecl = lower_ffi.registerRuntimeClassDecl;
|
||||
pub const resolveObjcParentName = lower_ffi.resolveObjcParentName;
|
||||
pub const declareObjcDefinedStateIvarGlobal = lower_ffi.declareObjcDefinedStateIvarGlobal;
|
||||
pub const declareObjcDefinedClassGlobal = lower_ffi.declareObjcDefinedClassGlobal;
|
||||
@@ -1786,15 +1786,15 @@ pub const Lowering = struct {
|
||||
pub const synthesizeFnDeclFromObjcMethod = lower_ffi.synthesizeFnDeclFromObjcMethod;
|
||||
pub const lookupObjcDefinedClassForMethod = lower_ffi.lookupObjcDefinedClassForMethod;
|
||||
pub const getJniEnvTlFids = lower_ffi.getJniEnvTlFids;
|
||||
pub const registerNamespacedForeignClasses = lower_ffi.registerNamespacedForeignClasses;
|
||||
pub const registerNamespacedRuntimeClasses = lower_ffi.registerNamespacedRuntimeClasses;
|
||||
pub const synthesizeJniMainStubs = lower_ffi.synthesizeJniMainStubs;
|
||||
pub const synthesizeJniMainStub = lower_ffi.synthesizeJniMainStub;
|
||||
|
||||
// --- moved to lower/objc_class.zig (lower_objc_class) ---
|
||||
pub const lowerObjcDefinedClassMethods = lower_objc_class.lowerObjcDefinedClassMethods;
|
||||
pub const lookupObjcPropertyOnPointer = lower_objc_class.lookupObjcPropertyOnPointer;
|
||||
pub const findForeignMethodInChain = lower_objc_class.findForeignMethodInChain;
|
||||
pub const findForeignPropertyInChain = lower_objc_class.findForeignPropertyInChain;
|
||||
pub const findRuntimeMethodInChain = lower_objc_class.findRuntimeMethodInChain;
|
||||
pub const findRuntimePropertyInChain = lower_objc_class.findRuntimePropertyInChain;
|
||||
pub const lookupObjcDefinedStateFieldOnPointer = lower_objc_class.lookupObjcDefinedStateFieldOnPointer;
|
||||
pub const lowerObjcDefinedStateFieldRead = lower_objc_class.lowerObjcDefinedStateFieldRead;
|
||||
pub const lowerObjcDefinedStateForObj = lower_objc_class.lowerObjcDefinedStateForObj;
|
||||
|
||||
Reference in New Issue
Block a user