2009/6/26 Tomek Grabiec <tgrab...@gmail.com>:
>
> Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
> ---
>  vm/object.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/vm/object.c b/vm/object.c
> index bf75fed..8dfc504 100644
> --- a/vm/object.c
> +++ b/vm/object.c
> @@ -134,6 +134,8 @@ struct vm_object *vm_object_alloc_array(struct vm_class 
> *class, int count)
>        for (int i = 0; i < count; ++i)
>                elems[i] = NULL;
>
> +       res->class = class;
> +

I don't think this is right.

If we pass "Integer" as the class, this object's ->class should be the
"[Ljava/lang/Integer;" class.

There's a function in vm/classloader.c to do this, see:

struct vm_class *load_class_array_class(const char *array_class_name,
        unsigned int dimensions, const char *class_name)

What happens there is that it takes an array_class_name (which can be
"[Ljava/lang/Integer;") and class_name should then be
"java/lang/Integer".

So it seems that you need to put something like:

    res->class = classloader_load("[L" + class->name + ";");

It looks a bit ugly, but I think that's how it should be done (we
_need_ to create/know the [L...; name in either case).

Can you try that out?


Vegard

------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to