mem: Step 8 — delete context global from std.sx
The `context : Context = ---;` global in `library/modules/std.sx` had
no remaining readers — all `context.X` lookups in user code resolve
through `current_ctx_ref` (Step 5), `push Context.{...}` uses an alloca
slot (Step 6), and `allocViaContext` sources from the lowering's
current ref. `emitDefaultContextInit` (the only writer) was already
removed in Step 5.
`inferExprType` for the `context` identifier now returns the registered
`Context` type when implicit-ctx is enabled, mirroring the lowering's
identifier-handling fast path. Without this, `context.allocator` would
type as `s64` (the fallback) and the field access would fail.
11 JNI/ObjC IR snapshots regen — the `@context` LLVM global is gone
from each.
152/152 example tests pass.
This commit is contained in:
@@ -33,8 +33,6 @@ Context :: struct {
|
||||
data: *void;
|
||||
}
|
||||
|
||||
context : Context = ---;
|
||||
|
||||
// --- Slice & string allocation ---
|
||||
|
||||
cstring :: (size: s64) -> string {
|
||||
|
||||
@@ -9929,6 +9929,11 @@ pub const Lowering = struct {
|
||||
return binding.ty;
|
||||
}
|
||||
}
|
||||
// `context` is the implicit-ctx identifier; type is Context
|
||||
// when the program has registered it (i.e. std.sx imported).
|
||||
if (self.implicit_ctx_enabled and std.mem.eql(u8, id.name, "context")) {
|
||||
if (self.module.types.findByName(self.module.types.internString("Context"))) |ty| return ty;
|
||||
}
|
||||
// Check global variables (e.g., `context : Context`)
|
||||
if (self.global_names.get(id.name)) |gi| {
|
||||
return gi.ty;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [5 x i8] c"noop\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [9 x i8] c"getCount\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [18 x i8] c"currentTimeMillis\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [9 x i8] c"getValue\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [8 x i8] c"isShown\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [10 x i8] c"getWindow\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [4 x i8] c"max\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [10 x i8] c"getWindow\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@g_should_call = internal global i1 false
|
||||
@__sx_default_context = internal global { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc, ptr @__thunk_CAllocator_Allocator_dealloc }, ptr null }
|
||||
@str = private unnamed_addr constant [5 x i8] c"noop\00", align 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@OS = internal global i64 0
|
||||
@ARCH = internal global i64 0
|
||||
@POINTER_SIZE = internal global i64 8
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
@context = internal global { { ptr, ptr, ptr }, ptr } zeroinitializer
|
||||
@OS = internal global i64 0
|
||||
@ARCH = internal global i64 0
|
||||
@POINTER_SIZE = internal global i64 8
|
||||
|
||||
Reference in New Issue
Block a user