From e163621ebe80b7d03f2b92063bfc84f0fd289891 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Sun, 5 Jan 2025 22:03:51 -0600 Subject: [PATCH] =?UTF-8?q?new:=20allocate=201=C3=97fields=5Fcount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/execute.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/c/execute.c b/c/execute.c index ae6a122..d58f42b 100644 --- a/c/execute.c +++ b/c/execute.c @@ -1813,13 +1813,12 @@ void op_new(struct vm * vm, uint32_t index) reference to the instance, is pushed onto the operand stack. */ int fields_count = class_entry->instance_fields_count; - int32_t * objectref = memory_allocate(fields_count * 2 * 4 + 4); + int32_t * objectref = memory_allocate(fields_count * 4 + 4); assert(objectref != nullptr); objectref[0] = (int32_t)class_entry; int32_t * objectfields = &objectref[1]; for (int i = 0; i < fields_count; i++) { - objectfields[i * 2] = 0; - objectfields[i * 2 + 1] = 0; + objectfields[i] = 0; } operand_stack_push_u32(vm->current_frame, (uint32_t)objectref);