From d0d7421d1d362eddd8f6b48dbedfa475be3b69b4 Mon Sep 17 00:00:00 2001 From: briantrice Date: Thu, 25 Feb 2010 16:44:00 -0800 Subject: [PATCH] Fixed remaining usage of MAX_OPTS/MAX_ARGS in the VM. --- src/vm/method.cpp | 4 ++-- src/vm/primitives.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/vm/method.cpp b/src/vm/method.cpp index 5b70610..8620f05 100644 --- a/src/vm/method.cpp +++ b/src/vm/method.cpp @@ -596,7 +596,7 @@ struct MethodDefinition* method_is_on_arity(struct object_heap* oh, struct Objec struct MethodDefinition* method_define(struct object_heap* oh, struct Object* method, struct Symbol* selector, struct Object* args[], word_t n) { word_t positions, i; - struct Object* argBuffer[16]; + struct Object* argBuffer[MAX_ARITY]; Pinned def(oh); Pinned oldDef(oh); @@ -611,7 +611,7 @@ struct MethodDefinition* method_define(struct object_heap* oh, struct Object* me /* any methods that call the same symbol must be decompiled because they might call an old version */ method_remove_optimized_sending(oh, selector); selector->cacheMask = smallint_to_object(object_to_smallint(selector->cacheMask) | positions); - assert(n<=16); + assert(n <= MAX_ARITY); copy_words_into(args, n, argBuffer); /* method_dispatch_on modifies its arguments (first argument)*/ oldDef = method_dispatch_on(oh, selector, argBuffer, n, NULL); diff --git a/src/vm/primitives.cpp b/src/vm/primitives.cpp index f0f464c..af29d98 100644 --- a/src/vm/primitives.cpp +++ b/src/vm/primitives.cpp @@ -215,13 +215,13 @@ void prim_applyto(struct object_heap* oh, struct Object* args[], word_t arity, s method = (struct Closure*)args[0]; argArray = (struct OopArray*) args[1]; - struct Object* optsArray[16]; + struct Object* optsArray[MAX_OPTS]; word_t optsArrayCount = 0, k = 0; if (optCount == 2 && opts[1] != oh->cached.nil) { /* {&optionals:. someOopArray} */ optsArrayCount = object_array_size(opts[1]); - assert(optsArrayCount <= 16); + assert(optsArrayCount <= MAX_OPTS); for (k = 0; k < optsArrayCount; k++) { optsArray[k] = ((struct OopArray*)opts[1])->elements[k]; heap_pin_object(oh, optsArray[k]); @@ -302,12 +302,12 @@ void prim_send_to(struct object_heap* oh, struct Object* args[], word_t n, struc Pinned selector(oh,(struct Symbol*)args[0]); Pinned arguments(oh, (struct OopArray*)args[1]); - struct Object* optsArray[16]; + struct Object* optsArray[MAX_OPTS]; word_t optsArrayCount = 0, k = 0; if (optCount == 2 && opts[1] != oh->cached.nil) {/* {&optionals:. someOopArray} */ optsArrayCount = object_array_size(opts[1]); - assert(optsArrayCount <= 16); + assert(optsArrayCount <= MAX_OPTS); for (k = 0; k < optsArrayCount; k++) { optsArray[k] = ((struct OopArray*)opts[1])->elements[k]; heap_pin_object(oh, optsArray[k]); @@ -326,12 +326,12 @@ void prim_send_to_through(struct object_heap* oh, struct Object* args[], word_t Pinned selector(oh, (struct Symbol*)args[0]); Pinned arguments(oh, (struct OopArray*)args[1]), dispatchers(oh, (struct OopArray*)args[2]); - struct Object* optsArray[16]; + struct Object* optsArray[MAX_OPTS]; word_t optsArrayCount = 0, k = 0; if (optCount == 2 && opts[1] != oh->cached.nil) { /* {&optionals:. someOopArray} */ optsArrayCount = object_array_size(opts[1]); - assert(optsArrayCount <= 16); + assert(optsArrayCount <= MAX_OPTS); for (k = 0; k < optsArrayCount; k++) { optsArray[k] = ((struct OopArray*)opts[1])->elements[k]; heap_pin_object(oh, optsArray[k]); -- 2.11.4.GIT