From: Jay Krell Date: Sat, 31 Aug 2019 07:38:12 +0000 (-0700) Subject: [coop] InternalGetHashCode (mono/mono#16583) X-Git-Tag: submit/tizen/20210909.063632~10331^2~5^2~630 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=06456c758c84aee2b04c390402c3813fd03abf59;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [coop] InternalGetHashCode (mono/mono#16583) Commit migrated from https://github.com/mono/mono/commit/cba94f28bed566e7a976842d016a7b2d4ef3f91a --- diff --git a/src/mono/mono/metadata/icall-def-netcore.h b/src/mono/mono/metadata/icall-def-netcore.h index 5a953db..b7e951f 100644 --- a/src/mono/mono/metadata/icall-def-netcore.h +++ b/src/mono/mono/metadata/icall-def-netcore.h @@ -323,7 +323,7 @@ ICALL_TYPE(RUNH, "System.Runtime.CompilerServices.RuntimeHelpers", RUNH_1) HANDLES(RUNH_1, "GetObjectValue", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue, MonoObject, 1, (MonoObject)) HANDLES(RUNH_2, "GetUninitializedObjectInternal", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetUninitializedObjectInternal, MonoObject, 1, (MonoType_ptr)) HANDLES(RUNH_3, "InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray, void, 2, (MonoArray, MonoClassField_ptr)) -ICALL(RUNH_7, "InternalGetHashCode", mono_object_hash_internal) +HANDLES(RUNH_7, "InternalGetHashCode", mono_object_hash_icall, int, 1, (MonoObject)) HANDLES(RUNH_3a, "PrepareMethod", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_PrepareMethod, void, 3, (MonoMethod_ptr, gpointer, int)) HANDLES(RUNH_4, "RunClassConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor, void, 1, (MonoType_ptr)) HANDLES(RUNH_5, "RunModuleConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunModuleConstructor, void, 1, (MonoImage_ptr)) diff --git a/src/mono/mono/metadata/icall-def.h b/src/mono/mono/metadata/icall-def.h index c50da32..ebb5b76 100644 --- a/src/mono/mono/metadata/icall-def.h +++ b/src/mono/mono/metadata/icall-def.h @@ -581,7 +581,7 @@ NOHANDLES(ICALL(NUMBER_FORMATTER_1, "GetFormatterTables", ves_icall_System_Numbe ICALL_TYPE(OBJ, "System.Object", OBJ_1) HANDLES(OBJ_1, "GetType", ves_icall_System_Object_GetType, MonoReflectionType, 1, (MonoObject)) -ICALL(OBJ_2, "InternalGetHashCode", mono_object_hash_internal) +HANDLES(OBJ_2, "InternalGetHashCode", mono_object_hash_icall, int, 1, (MonoObject)) HANDLES(OBJ_3, "MemberwiseClone", ves_icall_System_Object_MemberwiseClone, MonoObject, 1, (MonoObject)) ICALL_TYPE(ASSEM, "System.Reflection.Assembly", ASSEM_2) diff --git a/src/mono/mono/metadata/monitor.c b/src/mono/mono/metadata/monitor.c index 296b48b..146ecd7 100644 --- a/src/mono/mono/metadata/monitor.c +++ b/src/mono/mono/metadata/monitor.c @@ -34,6 +34,7 @@ #include #include #include "external-only.h" +#include "icall-decl.h" /* * Pull the list of opcodes @@ -561,6 +562,7 @@ int mono_object_hash_internal (MonoObject* obj) { #ifdef HAVE_MOVING_COLLECTOR + LockWord lw; unsigned int hash; if (!obj) @@ -619,13 +621,22 @@ mono_object_hash_internal (MonoObject* obj) mono_memory_write_barrier (); obj->synchronisation = lw.sync; return hash; + #else + /* * Wang's address-based hash function: * http://www.concentric.net/~Ttwang/tech/addrhash.htm */ return (GPOINTER_TO_UINT (obj) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u; #endif + +} + +int +mono_object_hash_icall (MonoObjectHandle obj, MonoError* error) +{ + return mono_object_hash_internal (MONO_HANDLE_RAW (obj)); } /* @@ -637,6 +648,7 @@ mono_object_hash_internal (MonoObject* obj) int mono_object_hash (MonoObject* obj) { + // FIXME slow? MONO_EXTERNAL_ONLY (int, mono_object_hash_internal (obj)); } @@ -1062,6 +1074,7 @@ mono_monitor_enter_internal (MonoObject *obj) gboolean mono_monitor_enter (MonoObject *obj) { + // FIXME slow? MONO_EXTERNAL_ONLY (gboolean, mono_monitor_enter_internal (obj)); } diff --git a/src/mono/mono/metadata/object-internals.h b/src/mono/mono/metadata/object-internals.h index 554f711..eb5bda7 100644 --- a/src/mono/mono/metadata/object-internals.h +++ b/src/mono/mono/metadata/object-internals.h @@ -2283,7 +2283,6 @@ mono_string_equal_internal (MonoString *s1, MonoString *s2); unsigned mono_string_hash_internal (MonoString *s); -ICALL_EXPORT int mono_object_hash_internal (MonoObject* obj);