Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- vm/object.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/vm/object.c b/vm/object.c index 26b1f76..aaf4606 100644 --- a/vm/object.c +++ b/vm/object.c @@ -14,6 +14,7 @@ #include <vm/object.h> #include <vm/stdlib.h> #include <vm/string.h> +#include <vm/types.h> #include <vm/utf8.h> struct vm_object *vm_object_alloc(struct vm_class *class) @@ -42,9 +43,12 @@ struct vm_object *vm_object_alloc(struct vm_class *class) struct vm_object *vm_object_alloc_native_array(int type, int count) { struct vm_object *res; + int vm_type; - /* XXX: Use the right size... */ - res = zalloc(sizeof(*res) + 8 * count); + vm_type = bytecode_type_to_vmtype(type); + assert(vm_type != 0); + + res = zalloc(sizeof(*res) + get_vmtype_size(vm_type) * count); if (!res) { NOT_IMPLEMENTED; return NULL; -- 1.6.0.6 ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel