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

Add type-specialized vectorized hash table container #100386

Merged
merged 113 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
6df2ffc
Checkpoint dn_simdhash
kg Mar 27, 2024
2f41984
Checkpoint
kg Mar 27, 2024
059705b
Checkpoint
kg Mar 27, 2024
0017d53
Checkpoint
kg Mar 28, 2024
2cc6a91
Checkpoint
kg Mar 28, 2024
6cf488d
Checkpoint
kg Mar 28, 2024
368c076
Checkpoint
kg Mar 28, 2024
ebc7b97
Checkpoint
kg Mar 28, 2024
335b32e
Checkpoint
kg Mar 28, 2024
12487c8
Checkpoint
kg Mar 28, 2024
9bfc7b6
Add missing files
kg Mar 28, 2024
5b8fec5
Checkpoint
kg Mar 28, 2024
5408f27
Add missing header
kg Mar 28, 2024
8cbf1db
Cleanups and more comments
kg Mar 28, 2024
a3d8622
Checkpoint
kg Mar 28, 2024
53ef795
Fix insertion
kg Mar 28, 2024
0d57f12
Remove generic add and get, they complicate everything for no reason
kg Mar 28, 2024
4a194da
Build fix
kg Mar 28, 2024
e6e29ef
Build fixes
kg Mar 28, 2024
406614b
Cleanup
kg Mar 28, 2024
9c1ed15
When cascading, wrap around to the first bucket when we reach the end…
kg Mar 28, 2024
69cd351
Simplify declaring specializations
kg Mar 28, 2024
58045c1
Cleanup
kg Mar 28, 2024
f354798
Convert spaces to tabs
kg Mar 28, 2024
4fa00c8
Rearrange things so that find_first_matching_suffix gets inlined
kg Mar 28, 2024
48faef8
Basic removal implementation
kg Mar 28, 2024
ab63d5f
Expand tests
kg Mar 28, 2024
ee87e52
Build fixes
kg Mar 28, 2024
bcf8be0
Cleanup
kg Mar 28, 2024
f9db166
MSVC doesn't support warning preprocessor command so use pragma message
kg Mar 28, 2024
8c3efe5
Fix build
kg Mar 28, 2024
ece1efe
Fix build
kg Mar 28, 2024
65862c1
Fix linker problem by defining string comparison and hasher inline
kg Mar 28, 2024
0aaffc2
Match semantics of ghashtable better
kg Mar 28, 2024
24cf824
Checkpoint
kg Mar 28, 2024
5a1af2e
dn_allocator allocations aren't zeroed :)
kg Mar 28, 2024
ff3678a
Cleanup
kg Mar 28, 2024
66b8a19
Use dn_simdhash_string_ptr for namespace lookup cache
kg Mar 28, 2024
9f15f25
Fix build
kg Mar 28, 2024
5011da6
Allow hiding the default specializations of a simdhash so you can wra…
kg Mar 28, 2024
0eb125e
Cache the hashcode of keys in string_ptr since it makes natural cache…
kg Mar 28, 2024
fde9544
Rearrange things to fix C4505
kg Mar 28, 2024
4949c53
Prohibit declaring multiple specializations in one .c file since it w…
kg Mar 28, 2024
c5ce9b2
Maybe fix duplicate include
kg Mar 28, 2024
f99f2cc
Fix use of base foreach for string_ptr hashtable
kg Mar 28, 2024
c848322
Annotate fallthrough in murmurhash for clang
kg Mar 28, 2024
c1a8001
Manually unroll the murmurhash3 duff's device to satisfy clang
kg Mar 28, 2024
d4031a1
Oops
kg Mar 28, 2024
b00cd4a
Fix leaked dn_simdhash_t instance
kg Mar 28, 2024
24d4b84
Cleanup
kg Mar 28, 2024
df8d8f4
Fix truncation warning with 64-bit strlen
kg Mar 29, 2024
e13f48e
Workaround linux x64 linker problem
kg Mar 29, 2024
cb2eb95
Fix GCC build parse error
kg Mar 29, 2024
ef9a132
Cleanup & rearrange things; attempt to fix GCC build
kg Mar 29, 2024
5923050
Updates so test suite works again; verified on linux x64 gcc
kg Mar 29, 2024
099a953
Fix indentation
kg Mar 29, 2024
d6f2bb7
Cleanup
kg Mar 29, 2024
6504f19
Fix foreaches
kg Mar 29, 2024
a47fea2
Split architecture-specific stuff into its own header
kg Mar 29, 2024
8fb0a5a
Specializing foreach means key_is_pointer/value_is_pointer aren't needed
kg Mar 29, 2024
e86c5c4
Cleanup
kg Mar 29, 2024
7b2c15d
Simplify preprocessor token gluing
kg Mar 29, 2024
c22b3d7
Cleanup and improve comments
kg Mar 29, 2024
9708bfa
Align the address of the first bucket
kg Mar 29, 2024
e11fa7d
Comment out neon for now
kg Mar 29, 2024
5525995
Cleanup
kg Mar 29, 2024
3f84231
Alignment and arch-specific pointer size fixes
kg Mar 29, 2024
441079a
Fix ARM clang/gcc build
kg Mar 29, 2024
480432f
Maybe fix CI-specific build issue
kg Mar 29, 2024
ffbfd0f
MSVC docs were wrong :(
kg Mar 29, 2024
1ca0206
Cleanup
kg Mar 29, 2024
4685237
Silence MSVC warnings again
kg Mar 29, 2024
6548031
Rework string_ptr to avoid pre-computing string length, and use a str…
kg Mar 30, 2024
14155c8
Cleanup
kg Mar 30, 2024
dbad5d6
Add dn_simdhash_u32_ptr and use it in mono_image_init_name_cache
kg Mar 30, 2024
6ffe793
Add missing file
kg Mar 30, 2024
c3ea833
Fix type mismatch
kg Apr 1, 2024
4169252
No need to eagerly load the suffixes, and doing so makes scalar fallb…
kg Apr 2, 2024
338b23c
Optimize scalar fallback
kg Apr 2, 2024
f17bd49
Migrate all simdhash fixes and changes from simdhash-2 into simdhash …
kg Apr 3, 2024
d62c7c2
Enable ARM NEON support in simdhash since we have system headers now
kg Apr 4, 2024
31eb0ba
Update utils header from successor branch
kg Apr 8, 2024
4d0150f
Dedupe + improve 64-bit pointer hash
kg Apr 8, 2024
18806f3
Fix windows build
kg Apr 8, 2024
27ac09f
Address PR feedback
kg Apr 10, 2024
39747d0
Broken attempt at configurable assertions
kg Apr 11, 2024
c11823d
Migrate updates from simdhash-2 to simdhash-1
kg Apr 11, 2024
e08be1b
Refactor search vectors
kg Apr 11, 2024
391a5d8
Update assertions
kg Apr 11, 2024
0a1936e
Optimize out unaligned 16-byte copy in scalar wasm find_value
kg Apr 11, 2024
e388a1d
Workaround for weird msimd128 codegen
kg Apr 11, 2024
b4d07d7
Update comments
kg Apr 11, 2024
703a607
Simplify assertions
kg Apr 12, 2024
73c505d
Benchmark harness
kg Apr 12, 2024
97a3b25
Checkpoint
kg Apr 12, 2024
391fdeb
Checkpoint
kg Apr 12, 2024
ae69695
Better missing key measurement
kg Apr 12, 2024
f543c20
Fix sequential/random measurements being meaningfully different
kg Apr 12, 2024
07c398b
Adjustment based on benchmarking
kg Apr 12, 2024
44a7bd3
Add a baseline measurement
kg Apr 12, 2024
9572863
Basic ghashtable comparison measurements
kg Apr 12, 2024
bf03cca
Update makefile
kg Apr 12, 2024
57e6aa2
Check in missing changes; fix mono link error
kg Apr 12, 2024
9107045
Add missing license headers
kg Apr 12, 2024
3d066cc
Partially unroll scalar search for better wasm performance
kg Apr 12, 2024
06efeeb
Fully unroll
kg Apr 13, 2024
8d798f8
Cleanup whitespace / add comment
kg Apr 13, 2024
253d920
Only type-check simdhash instances in debug builds
kg Apr 13, 2024
d90828a
Update makefile switches
kg Apr 13, 2024
5f49036
Fix and add comments
kg Apr 15, 2024
1f2b89f
Make test support windows
kg Apr 15, 2024
5083f40
Make it possible to build benchmark suite using MSVC
kg Apr 15, 2024
af63c5c
Improve MSVC codegen
kg Apr 15, 2024
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
7 changes: 6 additions & 1 deletion src/mono/mono/metadata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ else()
set(metadata_platform_sources ${metadata_unix_sources})
endif()

set(imported_native_sources
Copy link
Member

Choose a reason for hiding this comment

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

Blocked on getting SIMD enabled for mono/metadata on WASM.

@kg I /think/ just using set_source_file_properties to set compile flags would work:

set_source_file_properites(${imported_native_sources} PROPERTIES COMPILE_FLAGS -msimd128)

under the appropriate if()/endif().

It's possible this won't work if we're doing something weird with paths.

Copy link
Member Author

Choose a reason for hiding this comment

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

The thing is we need to conditionally build with/without simd based on the msbuild property. Right now that's handled by building simd and non simd modules that get linked in dynamically at the end.

Copy link
Member

Choose a reason for hiding this comment

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

oh, sorry, I misunderstood what you're doing. I thought this was predicated on requiring simd support in all wasm builds.

If you need conditional builds, you will need to create two separate .a files for the whole runtime (or maybe just two different .a files for anything that depends on the hash containers) and then letting the logic in src/mono/wasm/build select which one to link in.

conceptually our build here is:

  1. build src/mono/mono.proj. That invokes cmake to compile src/mono/mono/mini (this also compiles metadata/ utils/, eglib/ etc)
  2. build src/mono/browser/browser.proj once to create a kind of default build of dotnet.native.wasm for users who don't need to do native compilation on their dev machines
  3. for people who do native compilation on their dev machines, instead distribute '.a' files of the src/mono/mono bits and allow them to do the final compilation/linking on their own (this is the job of src/mono/browser/build/ .targets files)

If you need step 3 or step 2 to do different things based on msbuild properties, but you need to choose different outputs from step 1, then step 1 needs to produce multiple artifacts

Copy link
Member Author

Choose a reason for hiding this comment

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

do you think we could move the hash containers and stuff into their own object that gets linked late? i tried putting these things in our existing simd/no-simd objects, but i got link errors earlier in the build because it seems like we have a linking tree, i.e.

ab = a + b
cd = c + d
mono-sgen = ab + cd

Copy link
Member

Choose a reason for hiding this comment

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

I think it should be possible to build the hash containers in their own object library (modulo anything inlined in headers). I suspect it wouldn't work if you just do it in src/native/containers but src/mono/mono could probably do something.

../../../native/containers/dn-simdhash.c
../../../native/containers/dn-simdhash-string-ptr.c
../../../native/containers/dn-simdhash-u32-ptr.c)

set(metadata_common_sources
appdomain.c
domain.c
Expand Down Expand Up @@ -195,7 +200,7 @@ elseif(MONO_GC STREQUAL "boehm")
set(metadata_compile_definitions "HAVE_BOEHM_GC")
endif()

set(metadata_sources "${metadata_platform_sources};${metadata_common_sources};${metadata_gc_dependent_sources};${metadata_gc_sources};${ilgen_sources}")
set(metadata_sources "${metadata_platform_sources};${metadata_common_sources};${metadata_gc_dependent_sources};${metadata_gc_sources};${ilgen_sources};${imported_native_sources}")

if(HOST_WIN32 AND NOT DISABLE_SHARED_LIBS)
add_library(metadata_objects_shared OBJECT ${metadata_sources})
Expand Down
81 changes: 39 additions & 42 deletions src/mono/mono/metadata/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -3037,18 +3037,22 @@ mono_image_init_name_cache (MonoImage *image)
const char *name;
const char *nspace;
guint32 visib, nspace_index;
GHashTable *name_cache2, *nspace_table, *the_name_cache;
dn_simdhash_u32_ptr_t *name_cache2;
dn_simdhash_string_ptr_t *nspace_table, *the_name_cache;

if (image->name_cache)
return;

the_name_cache = g_hash_table_new (g_str_hash, g_str_equal);
// TODO: Figure out a good initial capacity for this table by doing a scan,
Copy link
Member

@lambdageek lambdageek Apr 1, 2024

Choose a reason for hiding this comment

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

I think we can estimate a very good guess for corelib (by the time this is first called, I think mono_defaults.corlib will be set already) and just set some kind of default for everything else.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense. I suspect the current default (11-12 items) might be right for smaller images

// or just pre-reserve a reasonable amount of space based on how many nspaces
// an image typically has
the_name_cache = dn_simdhash_string_ptr_new (0, NULL);

if (image_is_dynamic (image)) {
mono_image_lock (image);
if (image->name_cache) {
/* Somebody initialized it before us */
g_hash_table_destroy (the_name_cache);
dn_simdhash_free (the_name_cache);
} else {
mono_atomic_store_release (&image->name_cache, the_name_cache);
}
Expand All @@ -3057,7 +3061,7 @@ mono_image_init_name_cache (MonoImage *image)
}

/* Temporary hash table to avoid lookups in the nspace_table */
name_cache2 = g_hash_table_new (NULL, NULL);
name_cache2 = dn_simdhash_u32_ptr_new (0, NULL);

/* FIXME: metadata-update */
int rows = table_info_get_rows (t);
Expand All @@ -3074,14 +3078,13 @@ mono_image_init_name_cache (MonoImage *image)
nspace = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAMESPACE]);

nspace_index = cols [MONO_TYPEDEF_NAMESPACE];
nspace_table = (GHashTable *)g_hash_table_lookup (name_cache2, GUINT_TO_POINTER (nspace_index));
if (!nspace_table) {
nspace_table = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (the_name_cache, (char*)nspace, nspace_table);
g_hash_table_insert (name_cache2, GUINT_TO_POINTER (nspace_index),
nspace_table);
if (!dn_simdhash_u32_ptr_try_get_value (name_cache2, nspace_index, (void **)&nspace_table)) {
// FIXME: Compute an appropriate capacity for this table to avoid growing it
nspace_table = dn_simdhash_string_ptr_new (0, NULL);
dn_simdhash_string_ptr_try_add (the_name_cache, nspace, nspace_table);
dn_simdhash_u32_ptr_try_add (name_cache2, nspace_index, nspace_table);
}
g_hash_table_insert (nspace_table, (char *) name, GUINT_TO_POINTER (i));
dn_simdhash_string_ptr_try_add (nspace_table, name, GUINT_TO_POINTER (i));
}

/* Load type names from EXPORTEDTYPES table */
Expand All @@ -3102,23 +3105,22 @@ mono_image_init_name_cache (MonoImage *image)
nspace = mono_metadata_string_heap (image, exptype_cols [MONO_EXP_TYPE_NAMESPACE]);

nspace_index = exptype_cols [MONO_EXP_TYPE_NAMESPACE];
nspace_table = (GHashTable *)g_hash_table_lookup (name_cache2, GUINT_TO_POINTER (nspace_index));
if (!nspace_table) {
nspace_table = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (the_name_cache, (char*)nspace, nspace_table);
g_hash_table_insert (name_cache2, GUINT_TO_POINTER (nspace_index),
nspace_table);
if (!dn_simdhash_u32_ptr_try_get_value (name_cache2, nspace_index, (void **)&nspace_table)) {
// FIXME: Compute an appropriate capacity for this table to avoid growing it
nspace_table = dn_simdhash_string_ptr_new (0, NULL);
dn_simdhash_string_ptr_try_add (the_name_cache, nspace, nspace_table);
dn_simdhash_u32_ptr_try_add (name_cache2, nspace_index, nspace_table);
}
g_hash_table_insert (nspace_table, (char *) name, GUINT_TO_POINTER (mono_metadata_make_token (MONO_TABLE_EXPORTEDTYPE, i + 1)));
dn_simdhash_string_ptr_try_add (nspace_table, name, GUINT_TO_POINTER (mono_metadata_make_token (MONO_TABLE_EXPORTEDTYPE, i + 1)));
}
}

g_hash_table_destroy (name_cache2);
dn_simdhash_free (name_cache2);

mono_image_lock (image);
if (image->name_cache) {
/* Somebody initialized it before us */
g_hash_table_destroy (the_name_cache);
dn_simdhash_free (the_name_cache);
} else {
mono_atomic_store_release (&image->name_cache, the_name_cache);
}
Expand All @@ -3133,23 +3135,19 @@ void
mono_image_add_to_name_cache (MonoImage *image, const char *nspace,
const char *name, guint32 index)
{
GHashTable *nspace_table;
GHashTable *name_cache;
guint32 old_index;
dn_simdhash_string_ptr_t *nspace_table, *name_cache;

mono_image_init_name_cache (image);
mono_image_lock (image);

name_cache = image->name_cache;
if (!(nspace_table = (GHashTable *)g_hash_table_lookup (name_cache, nspace))) {
nspace_table = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (name_cache, (char *)nspace, (char *)nspace_table);
if (!dn_simdhash_string_ptr_try_get_value (name_cache, nspace, (void **)&nspace_table)) {
nspace_table = dn_simdhash_string_ptr_new (0, NULL);
dn_simdhash_string_ptr_try_add (name_cache, nspace, nspace_table);
}

if ((old_index = GPOINTER_TO_UINT (g_hash_table_lookup (nspace_table, (char*) name))))
g_error ("overrwritting old token %x on image %s for type %s::%s", old_index, image->name, nspace, name);

g_hash_table_insert (nspace_table, (char *) name, GUINT_TO_POINTER (index));
if (!dn_simdhash_string_ptr_try_add (nspace_table, name, GUINT_TO_POINTER (index)))
g_error ("overrwritting old token ? on image %s for type %s::%s", image->name, nspace, name);

mono_image_unlock (image);
}
Expand All @@ -3160,9 +3158,8 @@ typedef struct {
} FindAllUserData;

static void
find_all_nocase (gpointer key, gpointer value, gpointer user_data)
find_all_nocase (const char *name, gpointer value, gpointer user_data)
{
char *name = (char*)key;
FindAllUserData *data = (FindAllUserData*)user_data;
if (mono_utf8_strcasecmp (name, (char*)data->key) == 0)
data->values = g_slist_prepend (data->values, value);
Expand All @@ -3174,9 +3171,8 @@ typedef struct {
} FindUserData;

static void
find_nocase (gpointer key, gpointer value, gpointer user_data)
find_nocase (const char *name, gpointer value, gpointer user_data)
{
char *name = (char*)key;
FindUserData *data = (FindUserData*)user_data;

if (!data->value && (mono_utf8_strcasecmp (name, (char*)data->key) == 0))
Expand Down Expand Up @@ -3303,7 +3299,7 @@ search_modules (MonoImage *image, const char *name_space, const char *name, gboo
static MonoClass *
mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, const char *name, GHashTable* visited_images, gboolean case_sensitive, MonoError *error)
{
GHashTable *nspace_table = NULL;
dn_simdhash_string_ptr_t *nspace_table = NULL;
MonoImage *loaded_image = NULL;
guint32 token = 0;
MonoClass *klass;
Expand Down Expand Up @@ -3350,23 +3346,24 @@ mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, cons
mono_image_lock (image);

if (case_sensitive) {
nspace_table = (GHashTable *)g_hash_table_lookup (image->name_cache, name_space);

if (nspace_table)
token = GPOINTER_TO_UINT (g_hash_table_lookup (nspace_table, name));
if (dn_simdhash_string_ptr_try_get_value (image->name_cache, name_space, (void **)&nspace_table)) {
void * temp;
if (dn_simdhash_string_ptr_try_get_value (nspace_table, name, &temp))
token = GPOINTER_TO_UINT(temp);
}
} else {
FindAllUserData all_user_data = { name_space, NULL };
FindUserData user_data = { name, NULL };
GSList *values;

// We're forced to check all matching namespaces, not just the first one found,
// because our desired type could be in any of the ones that match case-insensitively.
g_hash_table_foreach (image->name_cache, find_all_nocase, &all_user_data);
dn_simdhash_string_ptr_foreach (image->name_cache, find_all_nocase, &all_user_data);

values = all_user_data.values;
while (values && !user_data.value) {
nspace_table = (GHashTable*)values->data;
g_hash_table_foreach (nspace_table, find_nocase, &user_data);
nspace_table = (dn_simdhash_string_ptr_t *)values->data;
dn_simdhash_string_ptr_foreach (nspace_table, find_nocase, &user_data);
values = values->next;
}

Expand Down
10 changes: 8 additions & 2 deletions src/mono/mono/metadata/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,12 @@ free_hash_table (gpointer key, gpointer val, gpointer user_data)
g_hash_table_destroy ((GHashTable*)val);
}

static void
free_simdhash_table (const char *key, gpointer val, gpointer user_data)
{
dn_simdhash_free ((dn_simdhash_t*)val);
}

/*
static void
free_mr_signatures (gpointer key, gpointer val, gpointer user_data)
Expand Down Expand Up @@ -2128,8 +2134,8 @@ mono_image_close_except_pools (MonoImage *image)
if (image->ptr_cache)
g_hash_table_destroy (image->ptr_cache);
if (image->name_cache) {
g_hash_table_foreach (image->name_cache, free_hash_table, NULL);
g_hash_table_destroy (image->name_cache);
dn_simdhash_string_ptr_foreach (image->name_cache, free_simdhash_table, NULL);
dn_simdhash_free (image->name_cache);
}

free_hash (image->icall_wrapper_cache);
Expand Down
4 changes: 3 additions & 1 deletion src/mono/mono/metadata/metadata-internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <mono/utils/mono-error.h>
#include "mono/utils/mono-conc-hashtable.h"
#include "mono/utils/refcount.h"
// for dn_simdhash_string_ptr_t and dn_simdhash_u32_ptr_t
#include "../native/containers/dn-simdhash-specializations.h"

struct _MonoType {
union {
Expand Down Expand Up @@ -438,7 +440,7 @@ struct _MonoImage {
/*
* Indexes namespaces to hash tables that map class name to typedef token.
*/
GHashTable *name_cache; /*protected by the image lock*/
dn_simdhash_string_ptr_t *name_cache; /*protected by the image lock*/

/*
* Indexed by MonoClass
Expand Down
49 changes: 29 additions & 20 deletions src/mono/mono/metadata/metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,10 +997,10 @@ mono_metadata_table_bounds_check_slow (MonoImage *image, int table_index, int to
if (G_LIKELY (GINT_TO_UINT32(token_index) <= table_info_get_rows (&image->tables [table_index])))
return FALSE;

if (G_LIKELY (!image->has_updates))
return TRUE;
if (G_LIKELY (!image->has_updates))
return TRUE;

return mono_metadata_update_table_bounds_check (image, table_index, token_index);
return mono_metadata_update_table_bounds_check (image, table_index, token_index);
}

void
Expand Down Expand Up @@ -1094,7 +1094,7 @@ get_blob_heap (MonoImage *image)
static gboolean
mono_delta_heap_lookup (MonoImage *base_image, MetadataHeapGetterFunc get_heap, guint32 orig_index, MonoImage **image_out, guint32 *index_out)
{
return mono_metadata_update_delta_heap_lookup (base_image, get_heap, orig_index, image_out, index_out);
return mono_metadata_update_delta_heap_lookup (base_image, get_heap, orig_index, image_out, index_out);
}

/**
Expand Down Expand Up @@ -6451,12 +6451,12 @@ mono_metadata_events_from_typedef (MonoImage *meta, guint32 index, guint *end_id
}

start = mono_metadata_decode_row_col (tdef, loc.result, MONO_EVENT_MAP_EVENTLIST);
/*
* metadata-update: note this next line needs block needs to look at the number of rows in
* EventMap and Event of the base image. Updates will add rows for new properties,
* but they won't be contiguous. if we set end to the number of rows in the updated
* Property table, the range will include properties from some other class
*/
/*
* metadata-update: note this next line needs block needs to look at the number of rows in
* EventMap and Event of the base image. Updates will add rows for new properties,
* but they won't be contiguous. if we set end to the number of rows in the updated
* Property table, the range will include properties from some other class
*/
if (loc.result + 1 < table_info_get_rows (tdef)) {
end = mono_metadata_decode_row_col (tdef, loc.result + 1, MONO_EVENT_MAP_EVENTLIST) - 1;
} else {
Expand Down Expand Up @@ -6569,12 +6569,12 @@ mono_metadata_properties_from_typedef (MonoImage *meta, guint32 index, guint *en
}

start = mono_metadata_decode_row_col (tdef, loc.result, MONO_PROPERTY_MAP_PROPERTY_LIST);
/*
* metadata-update: note this next line needs block needs to look at the number of rows in
* PropertyMap and Property of the base image. Updates will add rows for new properties,
* but they won't be contiguous. if we set end to the number of rows in the updated
* Property table, the range will include properties from some other class
*/
/*
* metadata-update: note this next line needs block needs to look at the number of rows in
* PropertyMap and Property of the base image. Updates will add rows for new properties,
* but they won't be contiguous. if we set end to the number of rows in the updated
* Property table, the range will include properties from some other class
*/
if (loc.result + 1 < table_info_get_rows (&meta->tables [MONO_TABLE_PROPERTYMAP])) {
end = mono_metadata_decode_row_col (tdef, loc.result + 1, MONO_PROPERTY_MAP_PROPERTY_LIST) - 1;
} else {
Expand Down Expand Up @@ -7088,10 +7088,10 @@ mono_metadata_get_marshal_info (MonoImage *meta, guint32 idx, gboolean is_field)

gboolean found = tdef->base && mono_binary_search (&loc, tdef->base, table_info_get_rows (tdef), tdef->row_size, table_locator);

if (G_UNLIKELY (meta->has_updates)) {
if (!found && !mono_metadata_update_metadata_linear_search (meta, tdef, &loc, table_locator))
return NULL;
}
if (G_UNLIKELY (meta->has_updates)) {
if (!found && !mono_metadata_update_metadata_linear_search (meta, tdef, &loc, table_locator))
return NULL;
}

return mono_metadata_blob_heap (meta, mono_metadata_decode_row_col (tdef, loc.result, MONO_FIELD_MARSHAL_NATIVE_TYPE));
}
Expand Down Expand Up @@ -8055,3 +8055,12 @@ mono_metadata_get_method_params (MonoImage *image, uint32_t method_idx, uint32_t

return param_index;
}

// Required by dn_simdhash
void
dn_simdhash_assert_fail (const char *file, int line, const char *condition);

void
dn_simdhash_assert_fail (const char *file, int line, const char *condition) {
mono_assertion_message (file, line, condition);
}
10 changes: 5 additions & 5 deletions src/mono/mono/utils/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ mono_atomic_cas_i64 (volatile gint64 *dest, gint64 exch, gint64 comp)
(void)atomic_compare_exchange_strong ((volatile atomic_llong *)dest, (long long*)&comp, exch);
return comp;
#else
#error gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC
#error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC"
#endif
}

Expand Down Expand Up @@ -188,7 +188,7 @@ mono_atomic_xchg_i64 (volatile gint64 *dest, gint64 exch)
g_static_assert (sizeof (atomic_llong) == sizeof (*dest) && ATOMIC_LLONG_LOCK_FREE == 2);
return atomic_exchange ((volatile atomic_llong *)dest, exch);
#else
#error gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC
#error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC"
#endif
}

Expand Down Expand Up @@ -216,7 +216,7 @@ mono_atomic_fetch_add_i64 (volatile gint64 *dest, gint64 add)
g_static_assert (sizeof (atomic_llong) == sizeof (*dest) && ATOMIC_LLONG_LOCK_FREE == 2);
return atomic_fetch_add ((volatile atomic_llong *)dest, add);
#else
#error gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC
#error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC"
#endif
}

Expand Down Expand Up @@ -250,7 +250,7 @@ mono_atomic_load_i64 (volatile gint64 *src)
g_static_assert (sizeof (atomic_llong) == sizeof (*src) && ATOMIC_LLONG_LOCK_FREE == 2);
return atomic_load ((volatile atomic_llong *)src);
#else
#error gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC
#error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC"
#endif
}

Expand Down Expand Up @@ -292,7 +292,7 @@ mono_atomic_store_i64 (volatile gint64 *dst, gint64 val)
g_static_assert (sizeof (atomic_llong) == sizeof (*dst) && ATOMIC_LLONG_LOCK_FREE == 2);
atomic_store ((volatile atomic_llong *)dst, val);
#else
#error gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC
#error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC"
#endif
}

Expand Down
Loading
Loading