Skip to content

Commit

Permalink
2008-08-08 Zoltan Varga <vargaz@gmail.com>
Browse files Browse the repository at this point in the history
	* mini.c driver.c aot-compiler.c: Update after changes to 
	mono_marshal_get_native_wrapper () signature changes.

	* mini.c (mono_resolve_patch_target): Error out if an icall is not found.
	(mono_method_to_ir): Handle new CEE_MONO_ICALL_ADDR opcode.

svn path=/branches/mono-2-0/mono/; revision=109963
  • Loading branch information
vargaz committed Aug 8, 2008
1 parent e336bcc commit e4767b2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
8 changes: 8 additions & 0 deletions mono/mini/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2008-08-08 Zoltan Varga <vargaz@gmail.com>

* mini.c driver.c aot-compiler.c: Update after changes to
mono_marshal_get_native_wrapper () signature changes.

* mini.c (mono_resolve_patch_target): Error out if an icall is not found.
(mono_method_to_ir): Handle new CEE_MONO_ICALL_ADDR opcode.

2008-08-07 Zoltan Varga <vargaz@gmail.com>

* aot-runtime.c (load_named_code): Pass the sofile to find_symbol, not the
Expand Down
2 changes: 1 addition & 1 deletion mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4222,7 +4222,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
if (acfg->aot_opts.full_aot && method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
/* Compile the wrapper instead */
/* We do this here instead of add_wrappers () because it is easy to do it here */
MonoMethod *wrapper = mono_marshal_get_native_wrapper (method, check_for_pending_exc);
MonoMethod *wrapper = mono_marshal_get_native_wrapper (method, check_for_pending_exc, TRUE);
method = wrapper;
}

Expand Down
4 changes: 2 additions & 2 deletions mono/mini/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ mono_main (int argc, char* argv[])
if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
MonoMethod *nm;
nm = mono_marshal_get_native_wrapper (method, TRUE);
nm = mono_marshal_get_native_wrapper (method, TRUE, FALSE);
cfg = mini_method_compile (nm, opt, mono_get_root_domain (), FALSE, FALSE, part);
}
else
Expand Down Expand Up @@ -1640,7 +1640,7 @@ mono_main (int argc, char* argv[])
for (i = 0; i < count; ++i) {
if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
method = mono_marshal_get_native_wrapper (method, TRUE);
method = mono_marshal_get_native_wrapper (method, TRUE, FALSE);

cfg = mini_method_compile (method, opt, mono_get_root_domain (), FALSE, FALSE, 0);
mono_destroy_compile (cfg);
Expand Down
36 changes: 26 additions & 10 deletions mono/mini/mini.c
Original file line number Diff line number Diff line change
Expand Up @@ -5738,7 +5738,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}

if (mono_method_signature (cmethod)->pinvoke) {
MonoMethod *wrapper = mono_marshal_get_native_wrapper (cmethod, check_for_pending_exc);
MonoMethod *wrapper = mono_marshal_get_native_wrapper (cmethod, check_for_pending_exc, FALSE);
fsig = mono_method_signature (wrapper);
} else if (constrained_call) {
fsig = mono_method_signature (cmethod);
Expand Down Expand Up @@ -6067,7 +6067,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
(cmethod->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
/* Prevent inlining of methods that call wrappers */
INLINE_FAILURE;
cmethod = mono_marshal_get_native_wrapper (cmethod, check_for_pending_exc);
cmethod = mono_marshal_get_native_wrapper (cmethod, check_for_pending_exc, FALSE);
allways = TRUE;
}

Expand Down Expand Up @@ -8773,6 +8773,22 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
cfg->disable_aot = 1;
break;
}
case CEE_MONO_ICALL_ADDR: {
MonoMethod *cmethod;

CHECK_STACK_OVF (1);
CHECK_OPSIZE (6);
token = read32 (ip + 2);

cmethod = mono_method_get_wrapper_data (method, token);

g_assert (cfg->compile_aot);

NEW_AOTCONST (cfg, ins, MONO_PATCH_INFO_ICALL_ADDR, cmethod);
*sp++ = ins;
ip += 6;
break;
}
case CEE_MONO_VTADDR:
CHECK_STACK (1);
--sp;
Expand Down Expand Up @@ -10751,13 +10767,13 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
break;
case MONO_PATCH_INFO_ICALL_ADDR:
target = mono_lookup_internal_call (patch_info->data.method);
if (!target)
g_error ("Unregistered icall '%s'\n", mono_method_full_name (patch_info->data.method, TRUE));
break;
case MONO_PATCH_INFO_JIT_ICALL_ADDR: {
MonoJitICallInfo *mi = mono_find_jit_icall_by_name (patch_info->data.name);
if (!mi) {
g_warning ("unknown MONO_PATCH_INFO_JIT_ICALL_ADDR %s", patch_info->data.name);
g_assert_not_reached ();
}
if (!mi)
g_error ("unknown MONO_PATCH_INFO_JIT_ICALL_ADDR %s", patch_info->data.name);
target = mi->func;
break;
}
Expand Down Expand Up @@ -12781,11 +12797,11 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
else
mono_lookup_pinvoke_call (method, NULL, NULL);
}
nm = mono_marshal_get_native_wrapper (method, check_for_pending_exc);
return mono_get_addr_from_ftnptr (mono_compile_method (nm));
nm = mono_marshal_get_native_wrapper (method, check_for_pending_exc, FALSE);
return mono_get_addr_from_ftnptr (mono_compile_method (nm));

//if (mono_debug_format != MONO_DEBUG_FORMAT_NONE)
//mono_debug_add_wrapper (method, nm);
//if (mono_debug_format != MONO_DEBUG_FORMAT_NONE)
//mono_debug_add_wrapper (method, nm);
} else if ((method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
const char *name = method->name;
MonoMethod *nm;
Expand Down

0 comments on commit e4767b2

Please sign in to comment.