From fde9ca0937171b77542028ef433fddf979aa506b Mon Sep 17 00:00:00 2001 From: Roy Frostig Date: Mon, 19 Jul 2010 18:19:31 -0700 Subject: Autoderef objects when passing them as implicit (indirect) arg upon vtbl-dispatch. Add testcase and XFAIL it on LLVM. Closes #112. --- src/boot/me/trans.ml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/boot') diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index 6f496775..d1e707b7 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -3912,8 +3912,17 @@ let trans_visitor if cc = CALL_direct then zero else - let (pair_cell, _) = trans_lval pair_lval in - Il.Cell (get_element_ptr pair_cell Abi.fn_field_closure) + let (pair_cell, ty) = trans_lval pair_lval in + let (pair_cell, _) = + if cc = CALL_vtbl + (* |pair_lval| here is the obj to whose vtbl we're dispatching. + * Said obj might have been auto-deref'ed for the method call, + * so we have to be sure to do the same here. + *) + then deref_ty DEREF_all_boxes false pair_cell ty + else (pair_cell, ty) + in + Il.Cell (get_element_ptr pair_cell Abi.binding_field_bound_data) and call_ctrl flv : call_ctrl = if lval_is_static cx flv -- cgit v1.2.3