@@ -228,22 +228,22 @@ auto TypeMapper::managed_to_java_release (const char *typeName, const uint8_t *m
228
228
log_debug (LOG_ASSEMBLY, " typemap: found module matching MVID [{}]" sv, MonoGuidString (mvid).c_str ());
229
229
hash_t name_hash = xxhash::hash (typeName, strlen (typeName));
230
230
231
- const TypeMapModuleEntry *entry = find_managed_to_java_map_entry (name_hash, match->map , match->entry_count );
231
+ // We implicitly trust the build process that the indexes are correct. This is by design, the libxamarin-app.so built
232
+ // with the application is immutable and the build process made sure that the data in it matches the application.
233
+ const TypeMapModuleEntry *const map = &modules_map_data[match->map_index ];
234
+ const TypeMapModuleEntry *entry = find_managed_to_java_map_entry (name_hash, map, match->entry_count );
232
235
if (entry == nullptr ) [[unlikely]] {
233
- if (match->map == nullptr ) [[unlikely]] {
234
- log_warn (LOG_ASSEMBLY, " typemap: module with MVID [{}] has no associated type map." sv, MonoGuidString (mvid).c_str ());
235
- return nullptr ;
236
- }
237
-
238
- if (match->duplicate_count > 0 && match->duplicate_map != nullptr ) {
236
+ if (match->duplicate_count > 0 && match->duplicate_map_index < std::numeric_limits<decltype (match->duplicate_map_index )>::max ()) {
239
237
log_debug (
240
238
LOG_ASSEMBLY,
241
239
" typemap: searching module [{}] duplicate map for type '{}' (hash {:x})" sv,
242
240
MonoGuidString (mvid).c_str (),
243
241
optional_string (typeName),
244
242
name_hash
245
243
);
246
- entry = find_managed_to_java_map_entry (name_hash, match->duplicate_map , match->duplicate_count );
244
+
245
+ const TypeMapModuleEntry *const duplicate_map = &modules_duplicates_data[match->duplicate_map_index ];
246
+ entry = find_managed_to_java_map_entry (name_hash, duplicate_map, match->duplicate_count );
247
247
}
248
248
249
249
if (entry == nullptr ) {
0 commit comments