It's needed to get the class of array elements. Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- include/vm/object.h | 1 + vm/object.c | 9 +++++++++ 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/vm/object.h b/include/vm/object.h index 587b6bb..29eeb24 100644 --- a/include/vm/object.h +++ b/include/vm/object.h @@ -26,6 +26,7 @@ struct vm_object *vm_object_alloc_native_array(int type, int count); struct vm_object *vm_object_alloc_multi_array(struct vm_class *class, int nr_dimensions, int *count); struct vm_object *vm_object_alloc_array(struct vm_class *class, int count); +struct vm_class *vm_object_get_array_element_class(struct vm_object *array); struct vm_object * vm_object_alloc_string(const uint8_t bytes[], unsigned int length); diff --git a/vm/object.c b/vm/object.c index 8dfc504..e5951a3 100644 --- a/vm/object.c +++ b/vm/object.c @@ -139,6 +139,15 @@ struct vm_object *vm_object_alloc_array(struct vm_class *class, int count) return res; } +struct vm_class *vm_object_get_array_element_class(struct vm_object *array) +{ + /* + * Skip the '[' prefix of array class name to get elements' + * class name. + */ + return classloader_load(array->class->name + 1); +} + void vm_object_lock(struct vm_object *obj) { if (pthread_mutex_lock(&obj->mutex)) -- 1.6.0.6 ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel