contextless fixes for js

This commit is contained in:
gingerBill
2025-08-08 13:29:49 +01:00
parent 7c93a5ae80
commit 804984ed35
4 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -3,8 +3,8 @@ package runtime
init_default_context_for_js: Context init_default_context_for_js: Context
@(init, private="file") @(init, private="file")
init_default_context :: proc() { init_default_context :: proc "contextless" () {
init_default_context_for_js = context __init_context(&init_default_context_for_js)
} }
@(export) @(export)
+2 -2
View File
@@ -10,8 +10,8 @@ g_ctx: runtime.Context
g_allocator: mem.Compat_Allocator g_allocator: mem.Compat_Allocator
@(init) @(init)
init_context :: proc() { init_context :: proc "contextless" () {
g_ctx = context g_ctx = runtime.default_context()
// Wrapping the allocator with the mem.Compat_Allocator so we can // Wrapping the allocator with the mem.Compat_Allocator so we can
// mimic the realloc semantics. // mimic the realloc semantics.
+1 -1
View File
@@ -169,7 +169,7 @@ exit :: proc "c" (exit_code: c.int) -> ! {
} }
@(private, fini) @(private, fini)
finish_atexit :: proc "c" () { finish_atexit :: proc "contextless" () {
n := intrinsics.atomic_exchange(&atexit_functions_count, 0) n := intrinsics.atomic_exchange(&atexit_functions_count, 0)
for function in atexit_functions[:n] { for function in atexit_functions[:n] {
function() function()
+1 -1
View File
@@ -5,7 +5,7 @@ import "base:runtime"
g_context: runtime.Context g_context: runtime.Context
@(private="file", init) @(private="file", init)
wgpu_init_allocator :: proc() { wgpu_init_allocator :: proc "contextless" () {
if g_context.allocator.procedure == nil { if g_context.allocator.procedure == nil {
g_context = runtime.default_context() g_context = runtime.default_context()
} }