Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- vm/jato.c | 28 +++++++++++++++++++++------- 1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/vm/jato.c b/vm/jato.c index e1fd13c..fc90c3d 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -100,24 +100,38 @@ static struct vm_object *native_vmstackwalker_getclasscontext(void) { struct stack_trace_elem st_elem; struct compilation_unit *cu; - struct vm_class *class; struct vm_object *res; + int depth; init_stack_trace_elem_current(&st_elem); + depth = get_java_stack_trace_depth(&st_elem); + /* Skip call to VMStackWalker.getClassContext() */ + depth--; if (stack_trace_elem_next_java(&st_elem)) return NULL; - cu = jit_lookup_cu(st_elem.addr); - if (!cu) { - NOT_IMPLEMENTED; + res = vm_object_alloc_array(vm_array_of_java_lang_Class, depth); + if (!res) { + signal_new_exception(vm_java_lang_OutOfMemoryError, NULL); return NULL; } - class = cu->method->class; + for (int i = 0; i < depth; i++) { + cu = jit_lookup_cu(st_elem.addr); + if (!cu) + error("no compilation_unit mapping for %lx", st_elem.addr); - res = vm_object_alloc_array(vm_java_lang_Class, 1); - array_set_field_object(res, 0, class->object); + struct vm_class *vmc = cu->method->class; + + if (vm_class_ensure_init(vmc)) + return NULL; + + /* XXX: We should remove Method.invoke() frames. */ + array_set_field_object(res, i, vmc->object); + + stack_trace_elem_next_java(&st_elem); + } return res; } -- 1.6.0.6 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel