diff --git a/mono/metadata/il2cpp-compat-metadata.h b/mono/metadata/il2cpp-compat-metadata.h index 62d1500e5d3b..14ef95b07d8b 100644 --- a/mono/metadata/il2cpp-compat-metadata.h +++ b/mono/metadata/il2cpp-compat-metadata.h @@ -25,6 +25,7 @@ SgenDescriptor il2cpp_mono_gc_make_root_descr_all_refs(int numbits); MonoGCDescriptor il2cpp_mono_gc_make_vector_descr (void); void* il2cpp_mono_gc_alloc_fixed (size_t size, void* descr, MonoGCRootSource source, void *key, const char *msg); gboolean il2cpp_mono_gc_is_moving(); +void il2cpp_mono_gc_deregister_root(char* addr); typedef void* (*MonoGCLockedCallbackFunc) (void *data); void* il2cpp_mono_gc_invoke_with_gc_lock (MonoGCLockedCallbackFunc func, void *data); diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h index dd10e13c65c6..7a3c0a565c1d 100644 --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@ -195,6 +195,9 @@ struct _MonoImage { /* If the raw data was allocated from a source such as mmap, the allocator may store resource tracking information here. */ void *raw_data_handle; char *raw_data; +#ifdef IL2CPP_ON_MONO + void* il2cpp_codegen_handle; +#endif guint32 raw_data_len; guint8 raw_buffer_used : 1; guint8 raw_data_allocated : 1; diff --git a/mono/metadata/mono-hash.c b/mono/metadata/mono-hash.c index bf099f653497..73d623d573e7 100644 --- a/mono/metadata/mono-hash.c +++ b/mono/metadata/mono-hash.c @@ -37,6 +37,8 @@ #include #include +void il2cpp_mono_gc_wbarrier_generic_store (void* ptr, MonoObject* value); + gint32 mono_g_hash_table_max_chain_length; struct _MonoGHashTable { diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 1b42c452463e..024896cec61f 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -122,7 +122,6 @@ #ifdef RUNTIME_IL2CPP extern Il2CppMonoDefaults il2cpp_mono_defaults; extern Il2CppMonoDebugOptions il2cpp_mono_debug_options; -const Il2CppDebuggerMetadataRegistration *g_il2cpp_metadata; #endif @@ -742,6 +741,8 @@ static SingleStepReq *ss_req; static int ss_count; #endif +gboolean g_unity_pause_point_active; + /* The protocol version of the client */ static int major_version, minor_version; @@ -1160,6 +1161,24 @@ void mono_debugger_install_runtime_callbacks(MonoDebuggerRuntimeCallbacks* cbs) callbacks = *cbs; } +gboolean unity_debugger_agent_is_global_breakpoint_active() +{ + if (!ss_req) + return FALSE; + else + return ss_req->global; +} + +int32_t unity_debugger_agent_is_single_stepping () +{ + return ss_count; +} + +#define UPDATE_PAUSE_STATE() do { g_unity_pause_point_active = unity_debugger_agent_is_global_breakpoint_active() || unity_debugger_agent_is_single_stepping(); } while (0) +#else + +#define UPDATE_PAUSE_STATE() + #endif // RUNTIME_IL2CPP /* @@ -2286,10 +2305,9 @@ static GPtrArray *ids [ID_NUM]; static GHashTable* s_jit_info_hashtable; -void mono_debugger_il2cpp_init (const Il2CppDebuggerMetadataRegistration *data) +void mono_debugger_il2cpp_init () { s_jit_info_hashtable = g_hash_table_new_full(mono_aligned_addr_hash, NULL, NULL, NULL); - g_il2cpp_metadata = data; debug_options.native_debugger_break = FALSE; } @@ -3868,7 +3886,7 @@ static void #ifndef RUNTIME_IL2CPP process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx, GSList *events, int suspend_policy) #else -process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx, GSList *events, int suspend_policy, uint64_t il2cpp_seqpoint_id) +process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx, GSList *events, int suspend_policy, Il2CppSequencePoint* sequencePoint) #endif { Buffer buf; @@ -3959,7 +3977,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx case EVENT_KIND_METHOD_EXIT: buffer_add_methodid (&buf, domain, (MonoMethod *)arg); #if defined(RUNTIME_IL2CPP) && defined(IL2CPP_DEBUGGER_TESTS) - buffer_add_long (&buf, il2cpp_seqpoint_id); + buffer_add_long (&buf, sequencePoint->id); #endif break; case EVENT_KIND_ASSEMBLY_LOAD: @@ -3984,7 +4002,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx buffer_add_methodid (&buf, domain, (MonoMethod *)arg); buffer_add_long (&buf, il_offset); #if defined(RUNTIME_IL2CPP) && defined(IL2CPP_DEBUGGER_TESTS) - buffer_add_long (&buf, il2cpp_seqpoint_id); + buffer_add_long (&buf, sequencePoint->id); #endif break; case EVENT_KIND_VM_START: @@ -3998,7 +4016,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx DebuggerEventInfo *ei = (DebuggerEventInfo *)arg; buffer_add_objid (&buf, ei->exc); #if defined(RUNTIME_IL2CPP) && defined(IL2CPP_DEBUGGER_TESTS) - buffer_add_long(&buf, il2cpp_seqpoint_id); + buffer_add_long(&buf, sequencePoint->id); #endif /* * We are not yet suspending, so get_objref () will not keep this object alive. So we need to do it @@ -4103,7 +4121,7 @@ process_profiler_event (EventKind event, gpointer arg) #ifndef RUNTIME_IL2CPP process_event (event, arg, 0, NULL, events, suspend_policy); #else - process_event (event, arg, 0, NULL, events, suspend_policy, 0); + process_event (event, arg, 0, NULL, events, suspend_policy, NULL); #endif } @@ -4178,11 +4196,9 @@ thread_startup (MonoProfiler *prof, uintptr_t tid) tls = g_new0 (DebuggerTlsData, 1); #endif MONO_GC_REGISTER_ROOT_SINGLE (tls->thread, MONO_ROOT_SOURCE_DEBUGGER, NULL, "Debugger Thread Reference"); + mono_gc_wbarrier_generic_store((void**)&tls->thread, thread); #ifdef RUNTIME_IL2CPP - il2cpp_gc_wbarrier_set_field(tls, (void**)&tls->thread, thread); tls->il2cpp_context = il2cpp_debugger_get_thread_context (); -#else - tls->thread = thread; #endif mono_native_tls_set_value (debugger_tls_id, tls); @@ -4220,11 +4236,7 @@ thread_end (MonoProfiler *prof, uintptr_t tid) #ifndef RUNTIME_IL2CPP MONO_GC_UNREGISTER_ROOT (tls->thread); #endif -#ifdef RUNTIME_IL2CPP - il2cpp_gc_wbarrier_set_field(tls, (void**)&tls->thread, NULL); -#else - tls->thread = NULL; -#endif + mono_gc_wbarrier_generic_store((void**)&tls->thread, NULL); } } mono_loader_unlock (); @@ -5391,7 +5403,7 @@ static MonoMethod* notify_debugger_of_wait_completion_method_cache = NULL; static MonoMethod* get_notify_debugger_of_wait_completion_method (void) { -#if UNITY_TINY +#if IL2CPP_TINY return NULL; #else if (notify_debugger_of_wait_completion_method_cache != NULL) @@ -5404,7 +5416,7 @@ get_notify_debugger_of_wait_completion_method (void) notify_debugger_of_wait_completion_method_cache = (MonoMethod *)g_ptr_array_index (array, 0); g_ptr_array_free (array, TRUE); return notify_debugger_of_wait_completion_method_cache; -#endif // UNITY_TINY +#endif // IL2CPP_TINY } #ifndef RUNTIME_IL2CPP @@ -5707,7 +5719,7 @@ mono_debugger_agent_user_break (void) #ifndef RUNTIME_IL2CPP process_event (EVENT_KIND_USER_BREAK, NULL, 0, &ctx, events, suspend_policy); #else - process_event (EVENT_KIND_USER_BREAK, NULL, 0, &ctx, events, suspend_policy, 0); + process_event (EVENT_KIND_USER_BREAK, NULL, 0, &ctx, events, suspend_policy, NULL); #endif } else if (debug_options.native_debugger_break) { G_BREAKPOINT (); @@ -5734,7 +5746,7 @@ static void #ifndef RUNTIME_IL2CPP process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal) #else -process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal, int sequencePointId) +process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal, Il2CppSequencePoint* sequencePoint) #endif { MonoJitInfo *ji; @@ -5850,7 +5862,7 @@ process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal, int seque #ifndef RUNTIME_IL2CPP events = create_event_list (EVENT_KIND_STEP, reqs, ji, NULL, &suspend_policy); #else - events = create_event_list(EVENT_KIND_STEP, reqs, il2cpp_get_sequence_point(sequencePointId), NULL, &suspend_policy); + events = create_event_list(EVENT_KIND_STEP, reqs, sequencePoint, NULL, &suspend_policy); #endif g_ptr_array_free (reqs, TRUE); @@ -5886,7 +5898,7 @@ process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal, int seque if(!ss_update_il2cpp(ss_req,tls,ctx,sequence_pt)) return; - process_event(EVENT_KIND_STEP, sp_method, sequence_pt->ilOffset, NULL, events, suspend_policy, sequencePointId); + process_event(EVENT_KIND_STEP, sp_method, sequence_pt->ilOffset, NULL, events, suspend_policy, sequencePoint); #endif } @@ -5931,7 +5943,7 @@ void #ifndef RUNTIME_IL2CPP debugger_agent_single_step_from_context (MonoContext *ctx) #else -debugger_agent_single_step_from_context (MonoContext *ctx, int sequencePointId) +debugger_agent_single_step_from_context (MonoContext *ctx, Il2CppSequencePoint* sequencePoint) #endif { DebuggerTlsData *tls; @@ -5960,7 +5972,7 @@ debugger_agent_single_step_from_context (MonoContext *ctx, int sequencePointId) #else save_thread_context(NULL); - process_single_step_inner(tls, FALSE, sequencePointId); + process_single_step_inner(tls, FALSE, sequencePoint); #endif } @@ -6004,6 +6016,7 @@ start_single_stepping (void) { #ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED int val = mono_atomic_inc_i32 (&ss_count); + UPDATE_PAUSE_STATE(); if (val == 1) { mono_arch_start_single_stepping (); @@ -6021,6 +6034,7 @@ stop_single_stepping (void) { #ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED int val = mono_atomic_dec_i32 (&ss_count); + UPDATE_PAUSE_STATE(); if (val == 0) { mono_arch_stop_single_stepping (); @@ -6056,6 +6070,7 @@ ss_stop (SingleStepReq *ss_req) if (ss_req->global) { stop_single_stepping (); ss_req->global = FALSE; + UPDATE_PAUSE_STATE(); } } @@ -6423,6 +6438,7 @@ ss_start (SingleStepReq *ss_req, MonoMethod *method, SeqPoint* sp, MonoSeqPointI } else { ss_req->global = FALSE; } + UPDATE_PAUSE_STATE(); if (ss_req_bp_cache) g_hash_table_destroy (ss_req_bp_cache); @@ -6496,6 +6512,7 @@ ss_start_il2cpp(SingleStepReq *ss_req, DebuggerTlsData *tls, Il2CppSequencePoint { ss_req->global = FALSE; } + UPDATE_PAUSE_STATE(); } #endif // RUNTIME_IL2CPP @@ -6729,7 +6746,7 @@ mono_debugger_agent_debug_log (int level, MonoString *category, MonoString *mess #ifndef RUNTIME_IL2CPP process_event (EVENT_KIND_USER_LOG, &ei, 0, NULL, events, suspend_policy); #else - process_event (EVENT_KIND_USER_LOG, &ei, 0, NULL, events, suspend_policy, 0); + process_event (EVENT_KIND_USER_LOG, &ei, 0, NULL, events, suspend_policy, NULL); #endif g_free (ei.category); @@ -6764,7 +6781,7 @@ mono_debugger_agent_unhandled_exception (MonoException *exc) #ifndef RUNTIME_IL2CPP process_event (EVENT_KIND_EXCEPTION, &ei, 0, NULL, events, suspend_policy); #else - process_event (EVENT_KIND_EXCEPTION, &ei, 0, NULL, events, suspend_policy, 0); + process_event (EVENT_KIND_EXCEPTION, &ei, 0, NULL, events, suspend_policy, NULL); #endif } #endif @@ -6914,7 +6931,7 @@ unity_debugger_agent_handle_exception(MonoException *exc, Il2CppSequencePoint *s } } - process_event(EVENT_KIND_EXCEPTION, &ei, 0, NULL, events, suspend_policy, sequencePoint ? sequencePoint->id : 0); + process_event(EVENT_KIND_EXCEPTION, &ei, 0, NULL, events, suspend_policy, sequencePoint); if (tls) tls->exception = NULL; @@ -6959,7 +6976,7 @@ mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx #ifndef RUNTIME_IL2CPP process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, SUSPEND_POLICY_ALL); #else - process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, SUSPEND_POLICY_ALL, 0); + process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, SUSPEND_POLICY_ALL, NULL); #endif return; } @@ -6988,7 +7005,7 @@ mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx #ifndef RUNTIME_IL2CPP process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, SUSPEND_POLICY_ALL); #else - process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, SUSPEND_POLICY_ALL, 0); + process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, SUSPEND_POLICY_ALL, NULL); #endif return; } @@ -7048,7 +7065,7 @@ mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx #ifndef RUNTIME_IL2CPP process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, suspend_policy); #else - process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, suspend_policy, 0); + process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, suspend_policy, NULL); #endif if (tls) @@ -7736,11 +7753,7 @@ decode_value_internal (MonoType *t, int type, MonoDomain *domain, guint8 *addr, g_free (vtype_buf); return err; } -#ifdef RUNTIME_IL2CPP - il2cpp_gc_wbarrier_set_field(NULL, (void**)addr, mono_value_box_checked (d, klass, vtype_buf, &error)); -#else - *(MonoObject**)addr = mono_value_box_checked (d, klass, vtype_buf, &error); -#endif + mono_gc_wbarrier_generic_store((void**)addr, mono_value_box_checked (d, klass, vtype_buf, &error)); mono_error_cleanup (&error); g_free (vtype_buf); } else { @@ -8743,12 +8756,20 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf) mono_environment_exitcode_set (exit_code); + /* + * We don't have a good way to suspend threads in IL2CPP, so just + * skip this code and call exit below. We will not shut down cleanly + * (e.g. run finalizers) but we don't care too much about that with + * IL2CPP. + */ +#ifndef RUNTIME_IL2CPP /* Suspend all managed threads since the runtime is going away */ DEBUG_PRINTF (1, "Suspending all threads...\n"); mono_thread_suspend_all_other_threads (); DEBUG_PRINTF (1, "Shutting down the runtime...\n"); mono_runtime_quit (); transport_close2 (); +#endif DEBUG_PRINTF (1, "Exiting...\n"); exit (exit_code); @@ -10392,15 +10413,17 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g buffer_add_int(buf, uniqueFileSequencePoints->len); for (i = 0; i < uniqueFileSequencePoints->len; ++i) { Il2CppSequencePoint* sequencePoint = g_ptr_array_index(uniqueFileSequencePoints, i); - buffer_add_string(buf, g_il2cpp_metadata->sequencePointSourceFiles[sequencePoint->sourceFileIndex].file); + Il2CppSequencePointSourceFile* sourceFile = il2cpp_debug_get_source_file (mono_class_get_image (mono_method_get_class (method)), sequencePoint->sourceFileIndex); + buffer_add_string(buf, sourceFile->file); if (CHECK_PROTOCOL_VERSION(2, 14)) { - buffer_add_data(buf, g_il2cpp_metadata->sequencePointSourceFiles[sequencePoint->sourceFileIndex].hash, 16); + buffer_add_data(buf, sourceFile->hash, 16); } } } else { if (uniqueFileSequencePoints->len > 0) { - buffer_add_string(buf, g_il2cpp_metadata->sequencePointSourceFiles[((Il2CppSequencePoint*)g_ptr_array_index(uniqueFileSequencePoints, 0))->sourceFileIndex].file); + Il2CppSequencePointSourceFile* sourceFile = il2cpp_debug_get_source_file (mono_class_get_image (mono_method_get_class (method)), ((Il2CppSequencePoint*)g_ptr_array_index(uniqueFileSequencePoints, 0))->sourceFileIndex); + buffer_add_string(buf, sourceFile->file); } else { buffer_add_string(buf, ""); } @@ -10424,7 +10447,7 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g if (sequencePoint->kind == kSequencePointKind_StepOut) continue; - DEBUG_PRINTF(10, "IL%x -> %s:%d %d %d %d\n", sequencePoint->ilOffset, g_il2cpp_metadata->sequencePointSourceFiles[sequencePoint->sourceFileIndex], + DEBUG_PRINTF(10, "IL%x -> %s:%d %d %d %d\n", sequencePoint->ilOffset, il2cpp_debug_get_source_file (mono_class_get_image (mono_method_get_class (method)), sequencePoint->sourceFileIndex)->file, sequencePoint->lineStart, sequencePoint->columnStart, sequencePoint->lineEnd, sequencePoint->columnEnd); buffer_add_int(buf, sequencePoint->ilOffset); buffer_add_int(buf, sequencePoint->lineStart); @@ -10576,12 +10599,13 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g buffer_add_typeid(buf, domain, mono_class_from_mono_type(il2cpp_type_inflate (il2cpp_get_type_from_index(executionContextInfo[i].typeIndex), il2cpp_mono_method_get_context(method)))); for (i = 0; i < executionInfoCount; i++) - buffer_add_string(buf, g_il2cpp_metadata->methodExecutionContextInfoStrings[executionContextInfo[i].nameIndex]); + buffer_add_string(buf, il2cpp_debug_get_local_name (mono_class_get_image (mono_method_get_class (method)), executionContextInfo[i].nameIndex)); for (i = 0; i < executionInfoCount; i++) { - buffer_add_int(buf, g_il2cpp_metadata->methodScopes[executionContextInfo[i].scopeIndex].startOffset); - buffer_add_int(buf, g_il2cpp_metadata->methodScopes[executionContextInfo[i].scopeIndex].endOffset); + Il2CppMethodScope* scope = il2cpp_debug_get_local_scope (mono_class_get_image (mono_method_get_class (method)), executionContextInfo[i].scopeIndex); + buffer_add_int(buf, scope->startOffset); + buffer_add_int(buf, scope->endOffset); } #endif // !RUNTIME_IL2CPP break; @@ -12296,11 +12320,11 @@ unity_process_breakpoint_inner(DebuggerTlsData *tls, gboolean from_signal, Il2Cp * resume. */ if (ss_events) - process_event(EVENT_KIND_STEP, method, 0, ctx, ss_events, suspend_policy, sequencePoint->id); + process_event(EVENT_KIND_STEP, method, 0, ctx, ss_events, suspend_policy, sequencePoint); if (bp_events) - process_event(kind, method, 0, ctx, bp_events, suspend_policy, sequencePoint->id); + process_event(kind, method, 0, ctx, bp_events, suspend_policy, sequencePoint); if (enter_leave_events) - process_event(kind, method, 0, ctx, enter_leave_events, suspend_policy, sequencePoint->id); + process_event(kind, method, 0, ctx, enter_leave_events, suspend_policy, sequencePoint); } void @@ -12321,35 +12345,48 @@ unity_debugger_agent_breakpoint(Il2CppSequencePoint* sequencePoint) unity_process_breakpoint_inner(tls, FALSE, sequencePoint); } -gboolean unity_debugger_agent_is_global_breakpoint_active() +void unity_debugger_agent_pausepoint() { - if (!ss_req) - return FALSE; - else - return ss_req->global; + if (is_debugger_thread()) + return; + + save_thread_context(NULL); + suspend_current(); } -int32_t unity_debugger_agent_is_single_stepping () +gboolean unity_pause_point_active() { - return ss_count; + return unity_debugger_agent_is_global_breakpoint_active() || unity_debugger_agent_is_single_stepping(); } -gboolean unity_sequence_point_active(Il2CppSequencePoint *seqPoint) +gboolean unity_sequence_point_active_entry(Il2CppSequencePoint *seqPoint) { - gboolean global = unity_debugger_agent_is_global_breakpoint_active(); + int i = 0; + while (i < event_requests->len) + { + EventRequest *req = (EventRequest *)g_ptr_array_index (event_requests, i); - if ((seqPoint->ilOffset != METHOD_ENTRY_IL_OFFSET) && (seqPoint->ilOffset != METHOD_EXIT_IL_OFFSET)) - return seqPoint->isActive || global || unity_debugger_agent_is_single_stepping (); + if (req->event_kind == EVENT_KIND_METHOD_ENTRY) + { + return seqPoint->isActive || g_unity_pause_point_active; + } + ++i; + } + + return FALSE; +} + +gboolean unity_sequence_point_active_exit(Il2CppSequencePoint *seqPoint) +{ int i = 0; while (i < event_requests->len) { EventRequest *req = (EventRequest *)g_ptr_array_index (event_requests, i); - if ((req->event_kind == EVENT_KIND_METHOD_ENTRY && seqPoint->ilOffset == METHOD_ENTRY_IL_OFFSET) || - (req->event_kind == EVENT_KIND_METHOD_EXIT && seqPoint->ilOffset == METHOD_EXIT_IL_OFFSET)) + if (req->event_kind == EVENT_KIND_METHOD_EXIT) { - return seqPoint->isActive || global || unity_debugger_agent_is_single_stepping (); + return seqPoint->isActive || g_unity_pause_point_active; } ++i; diff --git a/mono/mini/debugger-agent.h b/mono/mini/debugger-agent.h index 581579c21c82..587d5b7a7771 100644 --- a/mono/mini/debugger-agent.h +++ b/mono/mini/debugger-agent.h @@ -33,7 +33,7 @@ void #ifndef RUNTIME_IL2CPP debugger_agent_single_step_from_context (MonoContext *ctx); #else -debugger_agent_single_step_from_context (MonoContext *ctx, int sequencePointId); +debugger_agent_single_step_from_context (MonoContext *ctx, Il2CppSequencePoint* sequencePoint); #endif void diff --git a/mono/mini/il2cpp-compat.h b/mono/mini/il2cpp-compat.h index e034dd416c21..aeca88b5d8e7 100644 --- a/mono/mini/il2cpp-compat.h +++ b/mono/mini/il2cpp-compat.h @@ -446,7 +446,6 @@ void il2cpp_mono_error_cleanup (MonoError *oerror); MonoException* il2cpp_mono_error_convert_to_exception (MonoError *target_error); const char* il2cpp_mono_error_get_message (MonoError *oerror); void il2cpp_mono_error_assert_ok_pos (MonoError *error, const char* filename, int lineno); -Il2CppSequencePoint* il2cpp_get_sequence_points(void* *iter); Il2CppSequencePoint* il2cpp_get_method_sequence_points(MonoMethod* method, void* *iter); MonoClass* il2cpp_class_get_nested_types_accepts_generic(MonoClass *monoClass, void* *iter); MonoClass* il2cpp_defaults_object_class(); @@ -469,7 +468,7 @@ MonoGenericInst* il2cpp_method_get_generic_class_inst(MonoMethodInflated *imetho MonoClass* il2cpp_generic_class_get_container_class(MonoGenericClass *gclass); void il2cpp_mono_thread_detach(MonoThread* thread); MonoClass* il2cpp_mono_get_string_class (void); -Il2CppSequencePoint* il2cpp_get_sequence_point(int id); +Il2CppSequencePoint* il2cpp_get_sequence_point(MonoImage* image, int id); char* il2cpp_assembly_get_full_name(MonoAssembly *assembly); const MonoMethod* il2cpp_get_seq_point_method(Il2CppSequencePoint *seqPoint); const MonoClass* il2cpp_get_class_from_index(int index); @@ -485,4 +484,7 @@ MonoGenericClass* il2cpp_m_type_get_generic_class(MonoType* type); const MonoAssembly* il2cpp_m_method_get_assembly(MonoMethod* method); const MonoAssembly* il2cpp_m_domain_get_corlib (MonoDomain *domain); mono_bool il2cpp_m_class_is_initialized (MonoClass* klass); +Il2CppSequencePointSourceFile* il2cpp_debug_get_source_file(MonoImage* image, int index); +const char* il2cpp_debug_get_local_name(MonoImage* image, int index); +Il2CppMethodScope* il2cpp_debug_get_local_scope(MonoImage* image, int index); #endif // RUNTIME_IL2CPP diff --git a/mono/mini/il2cpp-stubs.cpp b/mono/mini/il2cpp-stubs.cpp index bccc70309921..fdeccced6c2f 100644 --- a/mono/mini/il2cpp-stubs.cpp +++ b/mono/mini/il2cpp-stubs.cpp @@ -6,12 +6,12 @@ #include "gc/GarbageCollector.h" #include "gc/WriteBarrier.h" #include "gc/gc_wrapper.h" -#if !UNITY_TINY #include "metadata/FieldLayout.h" #include "metadata/GenericMetadata.h" #include "vm/Assembly.h" #include "vm/AssemblyName.h" #include "vm/Class.h" +#include "vm/ClassInlines.h" #include "vm/Domain.h" #include "vm/Field.h" #include "vm/GenericContainer.h" @@ -24,10 +24,10 @@ #include "vm/Thread.h" #include "vm/ThreadPoolMs.h" #include "vm/Type.h" -#endif #include "vm/Runtime.h" #include "vm/String.h" #include "vm-utils/Debugger.h" +#include "os/Thread.h" #include #include @@ -53,30 +53,18 @@ Il2CppMonoDebugOptions il2cpp_mono_debug_options; static MonoGHashTable *method_signatures; -#if !UNITY_TINY static il2cpp::os::Mutex s_il2cpp_mono_loader_lock(false); -#endif static uint64_t s_il2cpp_mono_loader_lock_tid = 0; MonoMethod* il2cpp_mono_image_get_entry_point (MonoImage *image) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoMethod*)il2cpp::vm::Image::GetEntryPoint((Il2CppImage*)image); -#endif } const char* il2cpp_mono_image_get_filename (MonoImage *monoImage) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else Il2CppImage *image = (Il2CppImage*)monoImage; return image->name; -#endif } const char* il2cpp_mono_image_get_guid (MonoImage *image) @@ -86,32 +74,17 @@ const char* il2cpp_mono_image_get_guid (MonoImage *image) MonoClass* il2cpp_mono_type_get_class (MonoType *type) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClass*) il2cpp::vm::Type::GetClass((Il2CppType*)type); -#endif } mono_bool il2cpp_mono_type_is_struct (MonoType *type) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Type::IsStruct((Il2CppType*)type); -#endif } mono_bool il2cpp_mono_type_is_reference (MonoType *type) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Type::IsReference((Il2CppType*)type); -#endif } void il2cpp_mono_metadata_free_mh (MonoMethodHeader *mh) @@ -121,10 +94,6 @@ void il2cpp_mono_metadata_free_mh (MonoMethodHeader *mh) Il2CppMonoMethodSignature* il2cpp_mono_method_signature (MonoMethod *m) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else MethodInfo* method = (MethodInfo*)m; if (method_signatures == NULL) @@ -163,7 +132,6 @@ Il2CppMonoMethodSignature* il2cpp_mono_method_signature (MonoMethod *m) mono_g_hash_table_insert(method_signatures, method, sig); return sig; -#endif } static void il2cpp_mono_free_method_signature(gpointer unused1, gpointer value, gpointer unused2) @@ -185,27 +153,18 @@ void il2cpp_mono_free_method_signatures() void il2cpp_mono_method_get_param_names (MonoMethod *m, const char **names) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else MethodInfo* method = (MethodInfo*)m; uint32_t numberOfParameters = il2cpp::vm::Method::GetParamCount(method); for (int i = 0; i < numberOfParameters; ++i) names[i] = il2cpp::vm::Method::GetParamName(method, i); -#endif } mono_bool il2cpp_mono_type_generic_inst_is_valuetype (MonoType *monoType) { - #if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else static const int kBitIsValueType = 1; Il2CppType *type = (Il2CppType*)monoType; const Il2CppTypeDefinition *typeDef = il2cpp::vm::MetadataCache::GetTypeDefinitionFromIndex(type->data.generic_class->typeDefinitionIndex); return (typeDef->bitfield >> (kBitIsValueType - 1)) & 0x1; -#endif } MonoMethodHeader* il2cpp_mono_method_get_header_checked (MonoMethod *method, MonoError *error) @@ -221,12 +180,7 @@ gboolean il2cpp_mono_class_init (MonoClass *klass) MonoVTable* il2cpp_mono_class_vtable (MonoDomain *domain, MonoClass *klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoVTable*)((Il2CppClass*)klass)->vtable; -#endif } MonoClassField* il2cpp_mono_class_get_field_from_name (MonoClass *klass, const char *name) @@ -237,123 +191,64 @@ MonoClassField* il2cpp_mono_class_get_field_from_name (MonoClass *klass, const c int32_t il2cpp_mono_array_element_size (MonoClass *monoClass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else Il2CppClass *klass = (Il2CppClass*)monoClass; return klass->element_size; -#endif } int32_t il2cpp_mono_class_instance_size (MonoClass *klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else + il2cpp::vm::Class::Init(klass); return il2cpp::vm::Class::GetInstanceSize((Il2CppClass*)klass); -#endif } int32_t il2cpp_mono_class_value_size (MonoClass *klass, uint32_t *align) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Class::GetValueSize((Il2CppClass*)klass, align); -#endif } gboolean il2cpp_mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Class::IsAssignableFrom((Il2CppClass*)klass, (Il2CppClass*)oklass); -#endif } MonoClass* il2cpp_mono_class_from_mono_type (MonoType *type) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClass*)il2cpp::vm::Class::FromIl2CppType((Il2CppType*)type); -#endif } int il2cpp_mono_class_num_fields (MonoClass *klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Class::GetNumFields((Il2CppClass*)klass); -#endif } int il2cpp_mono_class_num_methods (MonoClass *klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Class::GetNumMethods((Il2CppClass*)klass); -#endif } int il2cpp_mono_class_num_properties (MonoClass *klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Class::GetNumProperties((Il2CppClass*)klass); -#endif } MonoClassField* il2cpp_mono_class_get_fields (MonoClass* klass, gpointer *iter) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClassField*)il2cpp::vm::Class::GetFields((Il2CppClass*)klass, iter); -#endif } MonoMethod* il2cpp_mono_class_get_methods (MonoClass* klass, gpointer *iter) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoMethod*)il2cpp::vm::Class::GetMethods((Il2CppClass*)klass, iter); -#endif } MonoProperty* il2cpp_mono_class_get_properties (MonoClass* klass, gpointer *iter) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoProperty*)il2cpp::vm::Class::GetProperties((Il2CppClass*)klass, iter); -#endif } const char* il2cpp_mono_field_get_name (MonoClassField *field) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return il2cpp::vm::Field::GetName((FieldInfo*)field); -#endif } mono_unichar2* il2cpp_mono_string_chars (MonoString *monoStr) @@ -382,12 +277,7 @@ uintptr_t il2cpp_mono_array_length (MonoArray *array) MonoString* il2cpp_mono_string_new (MonoDomain *domain, const char *text) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoString*)il2cpp::vm::String::New(text); -#endif } @@ -399,15 +289,10 @@ MonoString* il2cpp_mono_string_new_checked (MonoDomain *domain, const char *text char* il2cpp_mono_string_to_utf8_checked (MonoString *string_obj, MonoError *error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else error_init(error); Il2CppString *str = (Il2CppString*)string_obj; std::string s = il2cpp::utils::StringUtils::Utf16ToUtf8(str->chars, str->length); return g_strdup(s.c_str()); -#endif } int il2cpp_mono_object_hash (MonoObject* obj) @@ -417,13 +302,8 @@ int il2cpp_mono_object_hash (MonoObject* obj) void* il2cpp_mono_object_unbox (MonoObject *monoObj) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else Il2CppObject *obj = (Il2CppObject*)monoObj; return il2cpp::vm::Object::Unbox(obj); -#endif } void il2cpp_mono_field_set_value (MonoObject *obj, MonoClassField *field, void *value) @@ -433,20 +313,12 @@ void il2cpp_mono_field_set_value (MonoObject *obj, MonoClassField *field, void * void il2cpp_mono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::vm::Field::StaticSetValue((FieldInfo*)field, value); -#endif } uint32_t il2cpp_mono_gchandle_new_weakref (MonoObject *obj, mono_bool track_resurrection) { -#if UNITY_TINY - return il2cpp::gc::GCHandle::NewWeakref((Il2CppObject*)obj); -#else return il2cpp::gc::GCHandle::NewWeakref((Il2CppObject*)obj, track_resurrection == 0 ? false : true); -#endif } MonoObject* il2cpp_mono_gchandle_get_target (uint32_t gchandle) @@ -466,10 +338,6 @@ void il2cpp_mono_gc_wbarrier_generic_store (void* ptr, MonoObject* value) int il2cpp_mono_reflection_parse_type_checked (char *name, Il2CppMonoTypeNameParse *monoInfo, MonoError *error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else error_init(error); il2cpp::vm::TypeNameParseInfo *pInfo = new il2cpp::vm::TypeNameParseInfo(); std::string nameStr = name; @@ -478,41 +346,26 @@ int il2cpp_mono_reflection_parse_type_checked (char *name, Il2CppMonoTypeNamePar monoInfo->assembly.name = NULL; monoInfo->il2cppTypeNameParseInfo = pInfo; return parser.Parse(); -#endif } void il2cpp_mono_reflection_free_type_info (Il2CppMonoTypeNameParse *info) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else delete (il2cpp::vm::TypeNameParseInfo*)info->il2cppTypeNameParseInfo; -#endif } MonoDomain* il2cpp_mono_get_root_domain (void) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoDomain*)il2cpp::vm::Domain::GetCurrent(); -#endif } void il2cpp_mono_runtime_quit (void) { - IL2CPP_ASSERT(0 && "This method is not yet implemented"); + il2cpp::vm::Runtime::Shutdown(); } gboolean il2cpp_mono_runtime_is_shutting_down (void) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Runtime::IsShuttingDown() ? TRUE : FALSE; -#endif } MonoDomain* il2cpp_mono_domain_get (void) @@ -558,13 +411,8 @@ void il2cpp_mono_set_is_debugger_attached(gboolean attached) char* il2cpp_mono_type_full_name(MonoType* type) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else std::string name = il2cpp::vm::Type::GetName((Il2CppType*)type, IL2CPP_TYPE_NAME_FORMAT_FULL_NAME); return g_strdup(name.c_str()); -#endif } char* il2cpp_mono_method_full_name(MonoMethod* method, gboolean signature) @@ -574,41 +422,22 @@ char* il2cpp_mono_method_full_name(MonoMethod* method, gboolean signature) MonoThread* il2cpp_mono_thread_current() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoThread*)il2cpp::vm::Thread::Current(); -#endif } MonoThread* il2cpp_mono_thread_get_main() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoThread*)il2cpp::vm::Thread::Main(); -#endif } MonoThread* il2cpp_mono_thread_attach(MonoDomain* domain) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoThread*)il2cpp::vm::Thread::Attach((Il2CppDomain*)domain); -#endif } void il2cpp_mono_thread_detach(MonoThread* thread) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::vm::Thread::Detach((Il2CppThread*)thread); -#endif } void il2cpp_mono_domain_lock(MonoDomain* domain) @@ -632,12 +461,7 @@ guint il2cpp_mono_aligned_addr_hash(gconstpointer ptr) MonoGenericInst* il2cpp_mono_metadata_get_generic_inst(int type_argc, MonoType** type_argv) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoGenericInst*)il2cpp::vm::MetadataCache::GetGenericInst((Il2CppType**)type_argv, type_argc); -#endif } MonoMethod* il2cpp_mono_get_method_checked(MonoImage* image, guint32 token, MonoClass* klass, MonoGenericContext* context, MonoError* error) @@ -653,13 +477,8 @@ SgenDescriptor il2cpp_mono_gc_make_root_descr_all_refs(int numbits) int il2cpp_mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else il2cpp::gc::GarbageCollector::RegisterRoot(start, size); return 1; -#endif } MonoGCDescriptor il2cpp_mono_gc_make_vector_descr (void) @@ -680,30 +499,17 @@ void il2cpp_mono_class_setup_supertypes(MonoClass* klass) void il2cpp_mono_class_setup_vtable(MonoClass* klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::vm::Class::Init((Il2CppClass*)klass); -#endif } void il2cpp_mono_class_setup_methods(MonoClass* klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::vm::Class::SetupMethods((Il2CppClass*)klass); -#endif } gboolean il2cpp_mono_class_field_is_special_static(MonoClassField* field) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Field::IsNormalStatic((FieldInfo*)field) ? FALSE : TRUE; -#endif } guint32 il2cpp_mono_class_field_get_special_static_type(MonoClassField* field) @@ -714,84 +520,51 @@ guint32 il2cpp_mono_class_field_get_special_static_type(MonoClassField* field) MonoGenericContext* il2cpp_mono_class_get_context(MonoClass* klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoGenericContext*)&((Il2CppClass*)klass)->generic_class->context; -#endif } MonoGenericContext* il2cpp_mono_method_get_context(MonoMethod* monoMethod) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else MethodInfo * method = (MethodInfo*)monoMethod; if (!method->is_inflated || method->is_generic) return NULL; return (MonoGenericContext*) &((MethodInfo*)method)->genericMethod->context; -#endif } MonoGenericContainer* il2cpp_mono_method_get_generic_container(MonoMethod* monoMethod) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else MethodInfo * method = (MethodInfo*)monoMethod; if (method->is_inflated || !method->is_generic) return NULL; return (MonoGenericContainer*) method->genericContainer; -#endif } MonoMethod* il2cpp_mono_class_inflate_generic_method_full_checked(MonoMethod* method, MonoClass* klass_hint, MonoGenericContext* context, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else error_init(error); return (MonoMethod*) il2cpp::metadata::GenericMetadata::Inflate((MethodInfo*)method, (Il2CppClass*)klass_hint, (Il2CppGenericContext*)context); -#endif } MonoMethod* il2cpp_mono_class_inflate_generic_method_checked(MonoMethod* method, MonoGenericContext* context, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else error_init(error); return (MonoMethod*)il2cpp::metadata::GenericMetadata::Inflate((MethodInfo*)method, NULL, (Il2CppGenericContext*)context); -#endif } void il2cpp_mono_loader_lock() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else s_il2cpp_mono_loader_lock.Lock(); s_il2cpp_mono_loader_lock_tid = il2cpp::os::Thread::CurrentThreadId(); -#endif } void il2cpp_mono_loader_unlock() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else s_il2cpp_mono_loader_lock_tid = 0; s_il2cpp_mono_loader_lock.Unlock(); -#endif } void il2cpp_mono_loader_lock_track_ownership(gboolean track) @@ -800,12 +573,7 @@ void il2cpp_mono_loader_lock_track_ownership(gboolean track) gboolean il2cpp_mono_loader_lock_is_owned_by_self() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return s_il2cpp_mono_loader_lock_tid == il2cpp::os::Thread::CurrentThreadId(); -#endif } gpointer il2cpp_mono_method_get_wrapper_data(MonoMethod* method, guint32 id) @@ -816,43 +584,24 @@ gpointer il2cpp_mono_method_get_wrapper_data(MonoMethod* method, guint32 id) char* il2cpp_mono_type_get_name_full(MonoType* type, MonoTypeNameFormat format) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else std::string name = il2cpp::vm::Type::GetName((Il2CppType*)type, (Il2CppTypeNameFormat)format); return g_strdup(name.c_str()); -#endif } gboolean il2cpp_mono_class_is_nullable(MonoClass* klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Class::IsNullable((Il2CppClass*)klass); -#endif } MonoGenericContainer* il2cpp_mono_class_get_generic_container(MonoClass* klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoGenericContainer*)il2cpp::vm::Class::GetGenericContainer((Il2CppClass*)klass); -#endif } void il2cpp_mono_class_setup_interfaces(MonoClass* klass, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else error_init(error); il2cpp::vm::Class::SetupInterfaces((Il2CppClass*)klass); -#endif } enum { @@ -877,10 +626,6 @@ enum { static gboolean method_nonpublic (MethodInfo* method, gboolean start_klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else switch (method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) { case METHOD_ATTRIBUTE_ASSEM: return (start_klass || il2cpp_defaults.generic_ilist_class); @@ -891,15 +636,10 @@ method_nonpublic (MethodInfo* method, gboolean start_klass) default: return TRUE; } -#endif } GPtrArray* il2cpp_mono_class_get_methods_by_name(MonoClass* il2cppMonoKlass, const char* name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else GPtrArray *array; Il2CppClass *klass = (Il2CppClass*)il2cppMonoKlass; Il2CppClass *startklass; @@ -983,7 +723,6 @@ GPtrArray* il2cpp_mono_class_get_methods_by_name(MonoClass* il2cppMonoKlass, con g_free (method_slots);*/ return array; -#endif } gpointer il2cpp_mono_ldtoken_checked(MonoImage* image, guint32 token, MonoClass** handle_class, MonoGenericContext* context, MonoError* error) @@ -994,12 +733,7 @@ gpointer il2cpp_mono_ldtoken_checked(MonoImage* image, guint32 token, MonoClass* MonoClass* il2cpp_mono_class_from_generic_parameter_internal(MonoGenericParam* param) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClass*)il2cpp::vm::Class::FromGenericParameter((Il2CppGenericParameter*)param); -#endif } MonoClass* il2cpp_mono_class_load_from_name(MonoImage* image, const char* name_space, const char* name) @@ -1010,13 +744,8 @@ MonoClass* il2cpp_mono_class_load_from_name(MonoImage* image, const char* name_s MonoGenericClass* il2cpp_mono_class_get_generic_class(MonoClass* monoClass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else Il2CppClass *klass = (Il2CppClass*)monoClass; return (MonoGenericClass*)klass->generic_class; -#endif } MonoInternalThread* il2cpp_mono_thread_internal_current() @@ -1031,28 +760,16 @@ gboolean il2cpp_mono_thread_internal_is_current(MonoInternalThread* thread) void il2cpp_mono_thread_internal_abort(MonoInternalThread* thread, gboolean appdomain_unload) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::vm::Thread::RequestAbort((Il2CppInternalThread*)thread); -#endif } void il2cpp_mono_thread_internal_reset_abort(MonoInternalThread* thread) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::vm::Thread::ResetAbort((Il2CppInternalThread*)thread); -#endif } gunichar2* il2cpp_mono_thread_get_name(MonoInternalThread* this_obj, guint32* name_len) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else std::string name = il2cpp::vm::Thread::GetName((Il2CppInternalThread*)this_obj); if (name_len != NULL) @@ -1061,22 +778,16 @@ gunichar2* il2cpp_mono_thread_get_name(MonoInternalThread* this_obj, guint32* na if (name.empty()) return NULL; return g_utf8_to_utf16(name.c_str(), name.size(), NULL, NULL, NULL); -#endif } void il2cpp_mono_thread_set_name_internal(MonoInternalThread* this_obj, MonoString* name, gboolean permanent, gboolean reset, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::vm::Thread::SetName((Il2CppInternalThread*)this_obj, (Il2CppString*)name); error_init(error); -#endif } void il2cpp_mono_thread_suspend_all_other_threads() { - IL2CPP_ASSERT(0 && "This method is not yet implemented"); } void il2cpp_mono_stack_mark_record_size(MonoThreadInfo* info, HandleStackMark* stackmark, const char* func_name) @@ -1092,42 +803,25 @@ Il2CppMonoRuntimeExceptionHandlingCallbacks* il2cpp_mono_get_eh_callbacks() void il2cpp_mono_nullable_init(guint8* buf, MonoObject* value, MonoClass* klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::vm::Object::NullableInit(buf, (Il2CppObject*)value, (Il2CppClass*)klass); -#endif } MonoObject* il2cpp_mono_value_box_checked(MonoDomain* domain, MonoClass* klass, gpointer value, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else error_init(error); return (MonoObject*)il2cpp::vm::Object::Box((Il2CppClass*)klass, value); -#endif } void il2cpp_mono_field_static_get_value_checked(MonoVTable* vt, MonoClassField* field, void* value, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else error_init(error); il2cpp::vm::Field::StaticGetValue((FieldInfo*)field, value); -#endif } void il2cpp_mono_field_static_get_value_for_thread(MonoInternalThread* thread, MonoVTable* vt, MonoClassField* field, void* value, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else error_init(error); il2cpp::vm::Field::StaticGetValueForThread((FieldInfo*)field, value, (Il2CppInternalThread*)thread); -#endif } MonoObject* il2cpp_mono_field_get_value_object_checked(MonoDomain* domain, MonoClassField* field, MonoObject* obj, MonoError* error) @@ -1138,13 +832,8 @@ MonoObject* il2cpp_mono_field_get_value_object_checked(MonoDomain* domain, MonoC MonoObject* il2cpp_mono_object_new_checked(MonoDomain* domain, MonoClass* klass, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else error_init(error); return (MonoObject*)il2cpp::vm::Object::New((Il2CppClass*)klass); -#endif } MonoString* il2cpp_mono_ldstr_checked(MonoDomain* domain, MonoImage* image, guint32 idx, MonoError* error) @@ -1155,17 +844,12 @@ MonoString* il2cpp_mono_ldstr_checked(MonoDomain* domain, MonoImage* image, guin MonoObject* il2cpp_mono_runtime_try_invoke(MonoMethod* method, void* obj, void** params, MonoObject** exc, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else error_init(error); if (((MethodInfo*)method)->klass->valuetype) obj = static_cast(obj) - 1; return (MonoObject*)il2cpp::vm::Runtime::Invoke((MethodInfo*)method, obj, params, (Il2CppException**)exc); -#endif } MonoObject* il2cpp_mono_runtime_invoke_checked(MonoMethod* method, void* obj, void** params, MonoError* error) @@ -1178,28 +862,17 @@ void il2cpp_mono_gc_base_init() { } -#if !UNITY_TINY static il2cpp::os::Mutex s_il2cpp_gc_root_lock(false); -#endif int il2cpp_mono_gc_register_root(char* start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char* msg) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else il2cpp::gc::GarbageCollector::RegisterRoot(start, size); return 1; -#endif } void il2cpp_mono_gc_deregister_root(char* addr) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::gc::GarbageCollector::UnregisterRoot(addr); -#endif } #ifndef HOST_WIN32 @@ -1217,68 +890,40 @@ gboolean il2cpp_mono_gc_is_moving() gint32 il2cpp_mono_environment_exitcode_get() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Runtime::GetExitCode(); -#endif } void il2cpp_mono_environment_exitcode_set(gint32 value) { - IL2CPP_ASSERT(0 && "This method is not yet implemented"); + il2cpp::vm::Runtime::SetExitCode(value); } void il2cpp_mono_threadpool_suspend() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else #if NET_4_0 il2cpp::vm::ThreadPoolMs::Suspend(); #endif // NET_4_0 -#endif } void il2cpp_mono_threadpool_resume() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else #if NET_4_0 il2cpp::vm::ThreadPoolMs::Resume(); #endif // NET_4_0 -#endif } MonoImage* il2cpp_mono_assembly_get_image(MonoAssembly* assembly) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoImage*)il2cpp::vm::Assembly::GetImage((Il2CppAssembly*)assembly); -#endif } gboolean il2cpp_mono_runtime_try_shutdown() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else - il2cpp::vm::Runtime::Shutdown(); - return TRUE; -#endif + return TRUE; } gboolean il2cpp_mono_verifier_is_method_valid_generic_instantiation(MonoMethod* method) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else if (!method) return FALSE; @@ -1286,15 +931,10 @@ gboolean il2cpp_mono_verifier_is_method_valid_generic_instantiation(MonoMethod* return TRUE; return FALSE; -#endif } MonoType* il2cpp_mono_reflection_get_type_checked(MonoImage* rootimage, MonoImage* image, Il2CppMonoTypeNameParse* info, gboolean ignorecase, gboolean* type_resolve, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else error_init(error); Il2CppClass *klass = il2cpp::vm::Image::FromTypeNameParseInfo((Il2CppImage*)image, *((il2cpp::vm::TypeNameParseInfo*)info->il2cppTypeNameParseInfo), ignorecase); @@ -1302,28 +942,17 @@ MonoType* il2cpp_mono_reflection_get_type_checked(MonoImage* rootimage, MonoImag return NULL; return (MonoType*)il2cpp::vm::Class::GetType(klass); -#endif } MonoReflectionAssemblyHandle il2cpp_mono_assembly_get_object_handle(MonoDomain* domain, MonoAssembly* assembly, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoReflectionAssemblyHandle)il2cpp::vm::Reflection::GetAssemblyObject((const Il2CppAssembly *)assembly); -#endif } MonoReflectionType* il2cpp_mono_type_get_object_checked(MonoDomain* domain, MonoType* type, MonoError* error) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else error_init(error); return (MonoReflectionType*)il2cpp::vm::Reflection::GetTypeObject((const Il2CppType*)type); -#endif } void il2cpp_mono_network_init() @@ -1508,12 +1137,7 @@ gboolean il2cpp_mono_class_has_parent (MonoClass *klass, MonoClass *parent) MonoGenericParam* il2cpp_mono_generic_container_get_param (MonoGenericContainer *gc, int i) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoGenericParam*)il2cpp::vm::GenericContainer::GetGenericParameter((Il2CppGenericContainer*)gc, i); -#endif } gboolean il2cpp_mono_find_seq_point (MonoDomain *domain, MonoMethod *method, gint32 il_offset, MonoSeqPointInfo **info, SeqPoint *seq_point) @@ -1582,12 +1206,7 @@ void* il2cpp_mono_gc_alloc_fixed (size_t size, void* descr, MonoGCRootSource sou typedef void* (*Il2CppMonoGCLockedCallbackFunc) (void *data); void* il2cpp_mono_gc_invoke_with_gc_lock (Il2CppMonoGCLockedCallbackFunc func, void *data) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return il2cpp::gc::GarbageCollector::CallWithAllocLockHeld (func, data); -#endif } // These functions expose the IL2CPP VM C++ API to C @@ -1607,11 +1226,6 @@ MonoAssembly* il2cpp_domain_get_assemblies_iter(MonoAppDomain *domain, void* *it if (!iter) return NULL; -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else - il2cpp::vm::AssemblyVector* assemblies = il2cpp::vm::Assembly::GetAllAssemblies(); if (!*iter) @@ -1635,7 +1249,6 @@ MonoAssembly* il2cpp_domain_get_assemblies_iter(MonoAppDomain *domain, void* *it } return NULL; -#endif } void il2cpp_start_debugger_thread() @@ -1660,22 +1273,13 @@ const char* il2cpp_domain_get_name(MonoDomain* domain) return ((Il2CppDomain*)domain)->friendly_name; } -Il2CppSequencePoint* il2cpp_get_sequence_points(void* *iter) -{ -#if IL2CPP_MONO_DEBUGGER - return (Il2CppSequencePoint*)il2cpp::utils::Debugger::GetSequencePoints(iter); -#else - return NULL; -#endif -} - Il2CppSequencePoint* il2cpp_get_method_sequence_points(MonoMethod* method, void* *iter) { #if IL2CPP_MONO_DEBUGGER - if (!method) - return (Il2CppSequencePoint*)il2cpp::utils::Debugger::GetSequencePoints(iter); - else - return (Il2CppSequencePoint*)il2cpp::utils::Debugger::GetSequencePoints((const MethodInfo*)method, iter); + if (method == NULL) + return il2cpp::utils::Debugger::GetAllSequencePoints (iter); + else + return (Il2CppSequencePoint*)il2cpp::utils::Debugger::GetSequencePoints((const MethodInfo*)method, iter); #else return NULL; #endif @@ -1698,150 +1302,85 @@ gboolean il2cpp_mono_methods_match(MonoMethod* left, MonoMethod* right) MonoClass* il2cpp_class_get_nested_types_accepts_generic(MonoClass *monoClass, void* *iter) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else Il2CppClass *klass = (Il2CppClass*)monoClass; if (klass->generic_class) return NULL; return (MonoClass*)il2cpp::vm::Class::GetNestedTypes(klass, iter); -#endif } MonoClass* il2cpp_defaults_object_class() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClass*)il2cpp_defaults.object_class; -#endif } guint8 il2cpp_array_rank(MonoArray *monoArr) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else Il2CppArray *arr = (Il2CppArray*)monoArr; return arr->klass->rank; -#endif } const char* il2cpp_image_name(MonoImage *monoImage) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else Il2CppImage *image = (Il2CppImage*)monoImage; return image->name; -#endif } guint8* il2cpp_field_get_address(MonoObject *obj, MonoClassField *monoField) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else FieldInfo *field = (FieldInfo*)monoField; return (guint8*)obj + field->offset; -#endif } MonoType* il2cpp_mono_object_get_type(MonoObject* object) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoType*)&(((Il2CppObject*)object)->klass->byval_arg); -#endif } MonoClass* il2cpp_defaults_exception_class() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClass*)il2cpp_defaults.exception_class; -#endif } MonoImage* il2cpp_defaults_corlib_image() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoImage*)il2cpp_defaults.corlib; -#endif } bool il2cpp_method_is_string_ctor(const MonoMethod * method) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else MethodInfo* methodInfo = (MethodInfo*)method; return methodInfo->klass == il2cpp_defaults.string_class && !strcmp (methodInfo->name, ".ctor"); -#endif } MonoClass* il2cpp_defaults_void_class() { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClass*)il2cpp_defaults.void_class; -#endif } void il2cpp_set_var(guint8* newValue, void *value, MonoType *localVariableTypeMono) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); -#else il2cpp::metadata::SizeAndAlignment sa = il2cpp::metadata::FieldLayout::GetTypeSizeAndAlignment((const Il2CppType*)localVariableTypeMono); if (((Il2CppType*)localVariableTypeMono)->byref) memcpy(*(void**)value, newValue, sa.size); else memcpy(value, newValue, sa.size); -#endif } MonoMethod* il2cpp_get_interface_method(MonoClass* klass, MonoClass* itf, int slot) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else - const VirtualInvokeData* data = il2cpp::vm::Class::GetInterfaceInvokeDataFromVTable((Il2CppClass*)klass, (Il2CppClass*)itf, slot); + const VirtualInvokeData* data = il2cpp::vm::ClassInlines::GetInterfaceInvokeDataFromVTable((Il2CppClass*)klass, (Il2CppClass*)itf, slot); if (!data) return NULL; return (MonoMethod*)data->method; -#endif } gboolean il2cpp_field_is_deleted(MonoClassField *field) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return 0; -#else return il2cpp::vm::Field::IsDeleted((FieldInfo*)field); -#endif } -#if !UNITY_TINY struct TypeIterState { il2cpp::vm::AssemblyVector* assemblies; @@ -1850,17 +1389,12 @@ struct TypeIterState il2cpp::vm::TypeVector types; il2cpp::vm::TypeVector::iterator type; }; -#endif MonoClass* il2cpp_iterate_loaded_classes(void* *iter) { if (!iter) return NULL; -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else if (!*iter) { TypeIterState *state = new TypeIterState(); @@ -1892,7 +1426,6 @@ MonoClass* il2cpp_iterate_loaded_classes(void* *iter) } return (MonoClass*)*state->type; -#endif } const char** il2cpp_get_source_files_for_type(MonoClass *klass, int *count) @@ -1906,60 +1439,40 @@ const char** il2cpp_get_source_files_for_type(MonoClass *klass, int *count) MonoMethod* il2cpp_method_get_generic_definition(MonoMethodInflated *imethod) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else MethodInfo *method = (MethodInfo*)imethod; if (!method->is_inflated || method->is_generic) return NULL; return (MonoMethod*)((MethodInfo*)imethod)->genericMethod->methodDefinition; -#endif } MonoGenericInst* il2cpp_method_get_generic_class_inst(MonoMethodInflated *imethod) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else MethodInfo *method = (MethodInfo*)imethod; if (!method->is_inflated || method->is_generic) return NULL; return (MonoGenericInst*)method->genericMethod->context.class_inst; -#endif } MonoClass* il2cpp_generic_class_get_container_class(MonoGenericClass *gclass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClass*)il2cpp::vm::GenericClass::GetTypeDefinition((Il2CppGenericClass*)gclass); -#endif } MonoClass* il2cpp_mono_get_string_class (void) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoClass*)il2cpp_defaults.string_class; -#endif } -Il2CppSequencePoint* il2cpp_get_sequence_point(int id) +Il2CppSequencePoint* il2cpp_get_sequence_point(MonoImage* image, int id) { #if IL2CPP_MONO_DEBUGGER - return il2cpp::utils::Debugger::GetSequencePoint(id); + return il2cpp::utils::Debugger::GetSequencePoint(image, id); #else return NULL; #endif @@ -1967,13 +1480,8 @@ Il2CppSequencePoint* il2cpp_get_sequence_point(int id) char* il2cpp_assembly_get_full_name(MonoAssembly *assembly) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else std::string s = il2cpp::vm::AssemblyName::AssemblyNameToString(assembly->aname); return g_strdup(s.c_str()); -#endif } const MonoMethod* il2cpp_get_seq_point_method(Il2CppSequencePoint *seqPoint) @@ -1987,35 +1495,20 @@ const MonoMethod* il2cpp_get_seq_point_method(Il2CppSequencePoint *seqPoint) const MonoClass* il2cpp_get_class_from_index(int index) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else if (index < 0) return NULL; return il2cpp::vm::MetadataCache::GetTypeInfoFromTypeIndex(index); -#endif } const MonoType* il2cpp_get_type_from_index(int index) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return il2cpp::vm::MetadataCache::GetIl2CppTypeFromIndex(index); -#endif } const MonoType* il2cpp_type_inflate(MonoType* type, const MonoGenericContext* context) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return il2cpp::metadata::GenericMetadata::InflateIfNeeded(type, context, true); -#endif } void il2cpp_debugger_get_method_execution_context_and_header_Info(const MonoMethod* method, uint32_t* executionContextInfoCount, const Il2CppMethodExecutionContextInfo **executionContextInfo, const Il2CppMethodHeaderInfo **headerInfo, const Il2CppMethodScope **scopes) @@ -2036,12 +1529,7 @@ Il2CppThreadUnwindState* il2cpp_debugger_get_thread_context () MonoGenericClass* il2cpp_m_type_get_generic_class(MonoType* type) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoGenericClass*)((Il2CppType*)type)->data.generic_class; -#endif } mono_bool il2cpp_mono_image_is_dynamic(MonoImage *image) @@ -2051,42 +1539,37 @@ mono_bool il2cpp_mono_image_is_dynamic(MonoImage *image) const MonoAssembly* il2cpp_m_domain_get_corlib (MonoDomain *domain) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return il2cpp::vm::Image::GetAssembly(il2cpp_defaults_corlib_image()); -#endif } MonoGenericContext* il2cpp_mono_generic_class_get_context (MonoGenericClass *gclass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return il2cpp::vm::GenericClass::GetContext((Il2CppGenericClass*)gclass); -#endif } mono_bool il2cpp_m_class_is_initialized (MonoClass* klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return false; -#else return ((Il2CppClass*)klass)->initialized; -#endif } MonoType* il2cpp_mono_class_get_byref_type (MonoClass *klass) { -#if UNITY_TINY - IL2CPP_ASSERT(0 && "Not implemented yet for tiny"); - return NULL; -#else return (MonoType*)il2cpp::vm::Class::GetByrefType((Il2CppClass*)klass); -#endif +} + +Il2CppSequencePointSourceFile* il2cpp_debug_get_source_file(MonoImage* image, int index) +{ + return ((Il2CppImage*)image)->codeGenModule->debuggerMetadata->sequencePointSourceFiles + index; +} + +const char* il2cpp_debug_get_local_name(MonoImage* image, int index) +{ + return ((Il2CppImage*)image)->codeGenModule->debuggerMetadata->methodExecutionContextInfoStrings[index]; +} + +Il2CppMethodScope* il2cpp_debug_get_local_scope(MonoImage* image, int index) +{ + return ((Il2CppImage*)image)->codeGenModule->debuggerMetadata->methodScopes + index; } }