'This' pointer must be added to args manually. vm_call_method_this_a() expects that it is already in args to avoid unnecessary copying.
Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- vm/call.c | 6 +++++- vm/reflection.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vm/call.c b/vm/call.c index eaf2b4f..a33e6a7 100644 --- a/vm/call.c +++ b/vm/call.c @@ -80,7 +80,11 @@ unsigned long vm_call_method_this_a(struct vm_method *method, struct vm_object *this, unsigned long *args) { - void *target = this->class->vtable.native_ptr[method->virtual_index]; + void *target; + + target = this->class->vtable.native_ptr[method->virtual_index]; + assert(args[0] == (unsigned long) this); + return call_method_a(method, target, args); } diff --git a/vm/reflection.c b/vm/reflection.c index 80db700..5ce258d 100644 --- a/vm/reflection.c +++ b/vm/reflection.c @@ -736,7 +736,8 @@ call_virtual_method(struct vm_method *vmm, struct vm_object *o, { unsigned long args[vmm->args_count]; - if (marshall_call_arguments(vmm, args, args_array)) + args[0] = (unsigned long) o; + if (marshall_call_arguments(vmm, args + 1, args_array)) return NULL; return (struct vm_object *) vm_call_method_this_a(vmm, o, args); -- 1.6.0.4 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel