Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT][mono][aot] Implementation of nollvm init method #89074

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ elseif(TARGET_ARCH STREQUAL "x86")
set(SIZEOF_REGISTER 4)
elseif(TARGET_ARCH STREQUAL "arm64")
set(TARGET_ARM64 1)
set(ENABLE_WIP_METHOD_NOLLVM_SELF_INIT 1)
set(MONO_ARCHITECTURE "\"arm64\"")
set(TARGET_SIZEOF_VOID_P 8)
set(SIZEOF_REGISTER 8)
Expand Down
3 changes: 3 additions & 0 deletions src/mono/cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,9 @@
/* define if clockgettime exists */
#cmakedefine HAVE_CLOCK_GETTIME 1

/* work in progress: nollvm method self initialization */
#cmakedefine ENABLE_WIP_METHOD_NOLLVM_SELF_INIT 1

#if defined(ENABLE_LLVM) && defined(HOST_WIN32) && defined(TARGET_WIN32) && (!defined(TARGET_AMD64) || !defined(_MSC_VER))
#error LLVM for host=Windows and target=Windows is only supported on x64 MSVC build.
#endif
Expand Down
1 change: 1 addition & 0 deletions src/mono/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ option (ENABLE_SIGALTSTACK "Enable support for using sigaltstack for SIGSEGV and
option (USE_MALLOC_FOR_MEMPOOLS "Use malloc for each single mempool allocation, so tools like Valgrind can run better")
option (STATIC_COMPONENTS "Compile mono runtime components as static (not dynamic) libraries")
option (ENABLE_WEBCIL "Enable the WebCIL loader")
option (ENABLE_WIP_METHOD_NOLLVM_SELF_INIT, "Enable work in progress nollvm method self initialization")

set (MONO_GC "sgen" CACHE STRING "Garbage collector implementation (sgen or boehm). Default: sgen")
set (GC_SUSPEND "default" CACHE STRING "GC suspend method (default, preemptive, coop, hybrid)")
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/cil/cil-opcodes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,5 @@
<opcode name="mono_methodconst" input="Pop0" output="PushI" args="InlineI" o1="0xF0" o2="0x21" flow="next" />
<opcode name="mono_pinvoke_addr_cache" input="Pop0" output="PushI" args="InlineI" o1="0xF0" o2="0x22" flow="next" />
<opcode name="mono_remap_ovf_exc" input="Pop0" output="Push0" args="InlineI" o1="0xF0" o2="0x23" flow="next" />
<opcode name="mono_aot_module" input="Pop0" output="PushI" args="InlineI" o1="0xEF" o2="0x00" flow="next" />
</opdesc>
1 change: 1 addition & 0 deletions src/mono/mono/cil/opcode.def
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ OPDEF(CEE_MONO_GET_SP, "mono_get_sp", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x20,
OPDEF(CEE_MONO_METHODCONST, "mono_methodconst", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x21, NEXT)
OPDEF(CEE_MONO_PINVOKE_ADDR_CACHE, "mono_pinvoke_addr_cache", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x22, NEXT)
OPDEF(CEE_MONO_REMAP_OVF_EXC, "mono_remap_ovf_exc", Pop0, Push0, InlineI, 0, 2, 0xF0, 0x23, NEXT)
OPDEF(CEE_MONO_AOT_MODULE, "mono_aot_module", Pop0, PushI, InlineI, 0, 2, 0xEF, 0x00, NEXT)
#ifndef OPALIAS
#define _MONO_CIL_OPALIAS_DEFINED_
#define OPALIAS(a,s,r)
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/metadata/jit-icall-reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ MONO_JIT_ICALL (cominterop_type_from_handle) \
MONO_JIT_ICALL (g_free) \
MONO_JIT_ICALL (interp_to_native_trampoline) \
MONO_JIT_ICALL (mini_llvm_init_method) \
MONO_JIT_ICALL (mini_nollvm_init_method) \
MONO_JIT_ICALL (mini_llvmonly_init_delegate) \
MONO_JIT_ICALL (mini_llvmonly_init_delegate_virtual) \
MONO_JIT_ICALL (mini_llvmonly_init_vtable_slot) \
Expand Down
12 changes: 12 additions & 0 deletions src/mono/mono/metadata/marshal-lightweight.c
Original file line number Diff line number Diff line change
Expand Up @@ -3361,6 +3361,17 @@ emit_return_ilgen (MonoMethodBuilder *mb)
mono_mb_emit_byte (mb, CEE_RET);
}

static void
emit_method_init_ilgen (MonoMethodBuilder *mb)
{
// load aot_module
mono_mb_emit_op (mb, CEE_MONO_AOT_MODULE, NULL);
// load method_index
mono_mb_emit_ldarg (mb, 0);

mono_mb_emit_icall_id (mb, MONO_JIT_ICALL_mini_nollvm_init_method);
}

void
mono_marshal_lightweight_init (void)
{
Expand Down Expand Up @@ -3391,6 +3402,7 @@ mono_marshal_lightweight_init (void)
cb.emit_native_icall_wrapper = emit_native_icall_wrapper_ilgen;
cb.emit_icall_wrapper = emit_icall_wrapper_ilgen;
cb.emit_return = emit_return_ilgen;
cb.emit_method_init_nollvm = emit_method_init_ilgen;
cb.emit_vtfixup_ftnptr = emit_vtfixup_ftnptr_ilgen;
cb.mb_skip_visibility = mb_skip_visibility_ilgen;
cb.mb_emit_exception = mb_emit_exception_ilgen;
Expand Down
8 changes: 7 additions & 1 deletion src/mono/mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2948,12 +2948,12 @@ MonoMethod *
mono_marshal_get_aot_init_wrapper (MonoAotInitSubtype subtype)
{
MonoMethodBuilder *mb;
const char *name = mono_marshal_get_aot_init_wrapper_name (subtype);
MonoMethod *res;
WrapperInfo *info;
MonoMethodSignature *csig = NULL;
MonoType *void_type = mono_get_void_type ();
MonoType *int_type = mono_get_int_type ();
const char *name = mono_marshal_get_aot_init_wrapper_name (subtype);

switch (subtype) {
case AOT_INIT_METHOD:
Expand All @@ -2977,6 +2977,12 @@ mono_marshal_get_aot_init_wrapper (MonoAotInitSubtype subtype)

mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_OTHER);

#ifdef ENABLE_WIP_METHOD_NOLLVM_SELF_INIT
if (subtype == AOT_INIT_METHOD) {
get_marshal_cb ()->emit_method_init_nollvm (mb);
}
#endif

// Just stub out the method with a "CEE_RET"
// Our codegen backend generates other code here
get_marshal_cb ()->emit_return (mb);
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/metadata/marshal.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ typedef struct {
void (*emit_native_icall_wrapper) (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *csig, gboolean check_exceptions, gboolean aot, MonoMethodPInvoke *pinfo);
void (*emit_icall_wrapper) (MonoMethodBuilder *mb, MonoJitICallInfo *callinfo, MonoMethodSignature *csig2, gboolean check_exceptions);
void (*emit_return) (MonoMethodBuilder *mb);
void (*emit_method_init_nollvm) (MonoMethodBuilder *mb);
void (*emit_vtfixup_ftnptr) (MonoMethodBuilder *mb, MonoMethod *method, int param_count, guint16 type);
void (*mb_skip_visibility) (MonoMethodBuilder *mb);
void (*mb_emit_exception) (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg);
Expand Down
25 changes: 19 additions & 6 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4466,17 +4466,13 @@ add_jit_icall_wrapper (MonoAotCompile *acfg, MonoJitICallInfo *callinfo)
add_method (acfg, mono_marshal_get_icall_wrapper (callinfo, TRUE));
}

#if ENABLE_LLVM

static void
add_lazy_init_wrappers (MonoAotCompile *acfg)
{
for (int i = 0; i < AOT_INIT_METHOD_NUM; ++i)
add_method (acfg, mono_marshal_get_aot_init_wrapper ((MonoAotInitSubtype)i));
}

#endif

static MonoMethod*
get_runtime_invoke_sig (MonoMethodSignature *sig)
{
Expand Down Expand Up @@ -6835,7 +6831,9 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
/*
* This is a call from a JITted method to the init wrapper emitted by LLVM.
*/
#ifndef ENABLE_WIP_METHOD_NOLLVM_SELF_INIT
g_assert (acfg->aot_opts.llvm && acfg->aot_opts.direct_extern_calls);
#endif

const char *init_name = mono_marshal_get_aot_init_wrapper_name (info->d.aot_init.subtype);
char *symbol = g_strdup_printf ("%s%s_%s", acfg->user_symbol_prefix, acfg->global_prefix, init_name);
Expand Down Expand Up @@ -7106,7 +7104,14 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg)
if (acfg->global_symbols && acfg->need_no_dead_strip)
fprintf (acfg->fp, " .no_dead_strip %s\n", cfg->asm_symbol);

emit_label (acfg, cfg->asm_symbol);
if (method->wrapper_type == MONO_WRAPPER_OTHER && mono_marshal_get_wrapper_info (method)->subtype == WRAPPER_SUBTYPE_AOT_INIT) {
WrapperInfo *info = mono_marshal_get_wrapper_info (method);
const char *init_name = mono_marshal_get_aot_init_wrapper_name (info->d.aot_init.subtype);
char *symbol = g_strdup_printf ("%s%s_%s", acfg->user_symbol_prefix, acfg->global_prefix, init_name);
emit_label (acfg, symbol);
} else {
emit_label (acfg, cfg->asm_symbol);
}

if (acfg->aot_opts.write_symbols && !acfg->global_symbols && !acfg->llvm) {
/*
Expand Down Expand Up @@ -7331,6 +7336,7 @@ encode_patch (MonoAotCompile *acfg, MonoJumpInfo *patch_info, guint8 *buf, guint
}
case MONO_PATCH_INFO_SEQ_POINT_INFO:
case MONO_PATCH_INFO_AOT_MODULE:
case MONO_PATCH_INFO_INIT_BITSET:
break;
case MONO_PATCH_INFO_SIGNATURE:
case MONO_PATCH_INFO_GSHAREDVT_IN_WRAPPER:
Expand Down Expand Up @@ -7492,7 +7498,8 @@ emit_method_info (MonoAotCompile *acfg, MonoCompile *cfg)
if (patch_info->type == MONO_PATCH_INFO_GC_CARD_TABLE_ADDR ||
patch_info->type == MONO_PATCH_INFO_GC_NURSERY_START ||
patch_info->type == MONO_PATCH_INFO_GC_NURSERY_BITS ||
patch_info->type == MONO_PATCH_INFO_AOT_MODULE) {
patch_info->type == MONO_PATCH_INFO_AOT_MODULE ||
patch_info->type == MONO_PATCH_INFO_INIT_BITSET) {
/* Stored in a GOT slot initialized at module load time */
patch_info->type = MONO_PATCH_INFO_NONE;
continue;
Expand Down Expand Up @@ -14519,6 +14526,7 @@ static void aot_dump (MonoAotCompile *acfg)

static const MonoJitICallId preinited_jit_icalls [] = {
MONO_JIT_ICALL_mini_llvm_init_method,
MONO_JIT_ICALL_mini_nollvm_init_method,
MONO_JIT_ICALL_mini_llvmonly_throw_nullref_exception,
MONO_JIT_ICALL_mini_llvmonly_throw_index_out_of_range_exception,
MONO_JIT_ICALL_mini_llvmonly_throw_invalid_cast_exception,
Expand Down Expand Up @@ -14569,6 +14577,10 @@ add_preinit_got_slots (MonoAotCompile *acfg)
ji->type = MONO_PATCH_INFO_AOT_MODULE;
add_preinit_slot (acfg, ji);

ji = (MonoJumpInfo *)mono_mempool_alloc0 (acfg->mempool, sizeof (MonoJumpInfo));
ji->type = MONO_PATCH_INFO_INIT_BITSET;
lambdageek marked this conversation as resolved.
Show resolved Hide resolved
add_preinit_slot (acfg, ji);

ji = (MonoJumpInfo *)mono_mempool_alloc0 (acfg->mempool, sizeof (MonoJumpInfo));
ji->type = MONO_PATCH_INFO_GC_NURSERY_BITS;
add_preinit_slot (acfg, ji);
Expand Down Expand Up @@ -15236,6 +15248,7 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)
add_method (acfg, mono_marshal_get_llvm_func_wrapper (LLVM_FUNC_WRAPPER_GC_POLL));
}
#endif
add_lazy_init_wrappers (acfg);

if (mono_aot_mode_is_interp (&acfg->aot_opts) && mono_is_corlib_image (acfg->image->assembly->image)) {
MonoMethod *wrapper = mini_get_interp_lmf_wrapper ("mono_interp_to_native_trampoline", (gpointer) mono_interp_to_native_trampoline);
Expand Down
34 changes: 34 additions & 0 deletions src/mono/mono/mini/aot-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ struct MonoAotModule {
guint8 *unwind_info;
/* Maps method index -> unbox tramp */
gpointer *unbox_tramp_per_method;
MonoBitSet *mono_inited;

/* Points to the mono EH data created by LLVM */
guint8 *mono_eh_frame;
Expand Down Expand Up @@ -2237,6 +2238,11 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer
mscorlib_aot_module = amodule;
}

/*
* Methods init bitset used for initialization during the runtime
*/
amodule->mono_inited = mono_bitset_new (amodule->info.nmethods, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed offline, would be good to think of memory leaks. Is it allocated within the mempool?


/* Compute method addresses */
amodule->methods = (void **)g_malloc0 (amodule->info.nmethods * sizeof (gpointer));
for (guint32 i = 0; i < amodule->info.nmethods; ++i) {
Expand Down Expand Up @@ -3546,6 +3552,12 @@ sort_methods (MonoAotModule *amodule)
g_free (method_indexes);
}

MonoBitSet*
mono_aot_get_mono_inited (MonoAotModule *amodule)
{
return amodule->mono_inited;
}

/*
* mono_aot_find_jit_info:
*
Expand Down Expand Up @@ -4013,6 +4025,10 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guin
case MONO_PATCH_INFO_AOT_MODULE:
case MONO_PATCH_INFO_MSCORLIB_GOT_ADDR:
break;
case MONO_PATCH_INFO_INIT_BITSET: {
ji->data.target = aot_module->mono_inited;
break;
}
case MONO_PATCH_INFO_SIGNATURE:
case MONO_PATCH_INFO_GSHAREDVT_IN_WRAPPER:
ji->data.target = decode_signature (aot_module, p, &p);
Expand Down Expand Up @@ -4372,6 +4388,10 @@ load_method (MonoAotModule *amodule, MonoImage *image, MonoMethod *method, guint
res = init_method (amodule, NULL, method_index, method, NULL, error);
if (!res)
goto cleanup;
#ifdef ENABLE_WIP_METHOD_NOLLVM_SELF_INIT
else
mono_bitset_set (mono_aot_get_mono_inited (amodule), method_index);
#endif
}
}

Expand Down Expand Up @@ -5932,6 +5952,20 @@ no_specific_trampoline (void)
g_assert_not_reached ();
}

void
mini_nollvm_init_method (MonoAotModule* amodule, guint32 method_index)
{
MonoBitSet *inited_bitset = mono_aot_get_mono_inited (amodule);

ERROR_DECL (error);
if (!mono_bitset_test (inited_bitset, method_index)) {
if (init_method (amodule, NULL, method_index, NULL, NULL, error)) {
mono_bitset_set (inited_bitset, method_index);
}
}
mono_error_assert_ok (error);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vargaz do we want to propagate this error?

}

/*
* Return a specific trampoline from the AOT file.
*/
Expand Down
3 changes: 3 additions & 0 deletions src/mono/mono/mini/aot-runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ guint32 mono_aot_get_plt_info_offset (gpointer aot_module, guint8 *plt_en
gboolean mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res);
gboolean mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const char *name, MonoClass **klass);
MonoJitInfo* mono_aot_find_jit_info (MonoImage *image, gpointer addr);
MonoBitSet* mono_aot_get_mono_inited (MonoAotModule *amodule);
gpointer mono_aot_plt_resolve (gpointer aot_module, host_mgreg_t *regs, guint8 *code, MonoError *error);
void mono_aot_patch_plt_entry (gpointer aot_module, guint8 *code, guint8 *plt_entry, gpointer *got, host_mgreg_t *regs, guint8 *addr);
gpointer mono_aot_get_method_from_vt_slot (MonoVTable *vtable, int slot, MonoError *error);
Expand All @@ -278,6 +279,8 @@ void mono_aot_set_make_unreadable (gboolean unreadable);
gboolean mono_aot_is_pagefault (void *ptr);
void mono_aot_handle_pagefault (void *ptr);

void mini_nollvm_init_method (MonoAotModule* amodule, guint32 method_index);

guint32 mono_aot_find_method_index (MonoMethod *method);
gboolean mono_aot_init_llvm_method (gpointer aot_module, gpointer method_info, MonoClass *init_class, MonoError *error);
GHashTable *mono_aot_get_weak_field_indexes (MonoImage *image);
Expand Down
6 changes: 6 additions & 0 deletions src/mono/mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -11380,6 +11380,12 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
*sp++ = ins;
break;
}
case MONO_CEE_MONO_AOT_MODULE: {
g_assert (cfg->compile_aot);
EMIT_NEW_AOTCONST (cfg, ins, MONO_PATCH_INFO_AOT_MODULE, NULL);
*sp++ = ins;
break;
}
case MONO_CEE_MONO_NOT_TAKEN:
g_assert (method->wrapper_type != MONO_WRAPPER_NONE);
cfg->cbb->out_of_line = TRUE;
Expand Down
9 changes: 9 additions & 0 deletions src/mono/mono/mini/mini-arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -5990,6 +5990,15 @@ mono_arch_emit_prolog (MonoCompile *cfg)
code = emit_addx_imm (code, cfg->arch.args_reg, ARMREG_FP, cfg->stack_offset);
}

/* Call the init wrapper which checks if the method needs to be initialised or not */
/* https://github.com/dotnet/runtime/pull/82711, https://github.com/dotnet/runtime/issues/83378, https://github.com/dotnet/runtime/issues/83379 */
#ifdef ENABLE_WIP_METHOD_NOLLVM_SELF_INIT
if (cfg->compile_aot && !COMPILE_LLVM (cfg)) {
code = emit_imm (code, ARMREG_R0, cfg->method_index);
code = emit_call (cfg, code, MONO_PATCH_INFO_METHOD, (gconstpointer) mono_marshal_get_aot_init_wrapper (AOT_INIT_METHOD));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is a correct way to invoke wrappers generated in:

add_method (acfg, mono_marshal_get_aot_init_wrapper ((MonoAotInitSubtype)i));

During the native linking, there is an undefined symbols for architecture arm64:

  "_mono_aot_HelloWorld_init_method", referenced from:
      HelloWorld_Program_Main_string__ in mono_aot_0nLeOF.o
      HelloWorld_Program__ctor in mono_aot_0nLeOF.o
      wrapper_other_object_init_method_intptr_intptr in mono_aot_0nLeOF.o
      wrapper_other_object_init_method_gshared_mrgctx_intptr_intptr_intptr in mono_aot_0nLeOF.o
      wrapper_other_object_init_method_gshared_this_intptr_intptr_intptr in mono_aot_0nLeOF.o
      wrapper_other_object_init_method_gshared_vtable_intptr_intptr_intptr in mono_aot_0nLeOF.o

I think it comes from method prolog trying to invoke the init wrapper, but I would expect invocation of wrapper_other_object_init_method_intptr_intptr instead of _mono_aot_HelloWorld_init_method. @vargaz What we are doing wrong?

Copy link
Member

@ivanpovazan ivanpovazan Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I am not 100% how this should work but I think the body of _mono_aot_HelloWorld_init_method is never generated, looking at the compiler output: https://gist.github.com/ivanpovazan/96542ae24088a4a5e735d414b92e4c9e
there are only jumps to that symbol bl _mono_aot_HelloWorld_init_method, but it is not generated anywhere.

}
#endif

/* Save return area addr received in R8 */
if (cfg->vret_addr) {
MonoInst *ins = cfg->vret_addr;
Expand Down
3 changes: 3 additions & 0 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ mono_patch_info_hash (gconstpointer data)
case MONO_PATCH_INFO_GOT_OFFSET:
case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
case MONO_PATCH_INFO_AOT_MODULE:
case MONO_PATCH_INFO_INIT_BITSET:
case MONO_PATCH_INFO_PROFILER_ALLOCATION_COUNT:
case MONO_PATCH_INFO_PROFILER_CLAUSE_COUNT:
case MONO_PATCH_INFO_SPECIFIC_TRAMPOLINES:
Expand Down Expand Up @@ -1536,6 +1537,7 @@ mono_resolve_patch_target_ext (MonoMemoryManager *mem_manager, MonoMethod *metho
case MONO_PATCH_INFO_FIELD:
case MONO_PATCH_INFO_SIGNATURE:
case MONO_PATCH_INFO_AOT_MODULE:
case MONO_PATCH_INFO_INIT_BITSET:
target = patch_info->data.target;
break;
case MONO_PATCH_INFO_IID:
Expand Down Expand Up @@ -5122,6 +5124,7 @@ register_icalls (void)
register_dyn_icall (mono_component_debugger ()->user_break, mono_debugger_agent_user_break, mono_icall_sig_void, FALSE);

register_icall (mini_llvm_init_method, mono_icall_sig_void_ptr_ptr_ptr_ptr, TRUE);
register_icall (mini_nollvm_init_method, mono_icall_sig_void_ptr_int, TRUE);
register_icall_no_wrapper (mini_llvmonly_resolve_iface_call_gsharedvt, mono_icall_sig_ptr_object_int_ptr_ptr);
register_icall_no_wrapper (mini_llvmonly_resolve_vcall_gsharedvt, mono_icall_sig_ptr_object_int_ptr_ptr);
register_icall_no_wrapper (mini_llvmonly_resolve_vcall_gsharedvt_fast, mono_icall_sig_ptr_object_int);
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/mini/patch-info.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ PATCH_INFO(VIRT_METHOD, "virt_method")
PATCH_INFO(GC_SAFE_POINT_FLAG, "gc_safe_point_flag")
PATCH_INFO(NONE, "none")
PATCH_INFO(AOT_MODULE, "aot_module")
PATCH_INFO(INIT_BITSET, "init_bitset")
PATCH_INFO(AOT_JIT_INFO, "aot_jit_info")
PATCH_INFO(GC_NURSERY_BITS, "gc_nursery_bits")
PATCH_INFO(GSHAREDVT_IN_WRAPPER, "gsharedvt_in_wrapper")
Expand Down
4 changes: 4 additions & 0 deletions src/mono/sample/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<SelfContained>true</SelfContained>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MyLib\MyLib.csproj" />
</ItemGroup>

<UsingTask TaskName="MonoAOTCompiler"
AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" />

Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/HelloWorld/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ run: publish
$(TOP)artifacts/bin/HelloWorld/$(MONO_ARCH)/$(MONO_CONFIG)/$(TARGET_OS)-$(MONO_ARCH)/publish/HelloWorld

clean:
rm -rf $(TOP)artifacts/bin/HelloWorld/
rm -rf $(TOP)artifacts/bin/HelloWorld/
8 changes: 3 additions & 5 deletions src/mono/sample/HelloWorld/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using MyLib;

namespace HelloWorld
{
internal class Program
{
private static void Main(string[] args)
{
bool isMono = typeof(object).Assembly.GetType("Mono.RuntimeStructs") != null;
Console.WriteLine($"Hello World {(isMono ? "from Mono!" : "from CoreCLR!")}");
Console.WriteLine(typeof(object).Assembly.FullName);
Console.WriteLine(System.Reflection.Assembly.GetEntryAssembly ());
Console.WriteLine(System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
Class1 c = new Class1();
c.getCat();
}
}
}
Loading
Loading