From 3612608eb90b09b8f61edc5eec29c95ac5d45d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ibrahim=20Numanagic=CC=81?= Date: Fri, 12 Jan 2024 10:48:02 -0800 Subject: [PATCH] Fix #487 --- stdlib/internal/internal.codon | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/internal/internal.codon b/stdlib/internal/internal.codon index a40cf100..a8980857 100644 --- a/stdlib/internal/internal.codon +++ b/stdlib/internal/internal.codon @@ -69,7 +69,8 @@ class __internal__: """ global __vtables__ sz = __vtable_size__ + 1 - __vtables__ = Ptr[Ptr[cobj]](alloc_atomic_uncollectable(sz * sizeof(Ptr[cobj]))) + p = alloc_atomic_uncollectable(sz * sizeof(Ptr[cobj])) + __vtables__ = Ptr[Ptr[cobj]](p) __internal__.class_populate_vtables() def class_populate_vtables() -> None: @@ -95,7 +96,8 @@ class __internal__: def class_set_rtti_vtable(id: int, sz: int, T: type): if not __has_rtti__(T): compile_error("class is not polymorphic") - __vtables__[id] = Ptr[cobj](sz + 1) + p = alloc_atomic_uncollectable((sz + 1) * sizeof(cobj)) + __vtables__[id] = Ptr[cobj](p) __internal__.class_set_typeinfo(__vtables__[id], id) def class_set_rtti_vtable_fn(id: int, fid: int, f: cobj, T: type):