Skip to content

Commit

Permalink
Adjust modified code to have the same overwrite behavior as the old g…
Browse files Browse the repository at this point in the history
…_hash_table
  • Loading branch information
kg committed Apr 4, 2024
1 parent 16bd574 commit 1881bb6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/mono/mono/metadata/metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -3319,7 +3319,7 @@ mono_metadata_get_inflated_signature (MonoMethodSignature *sig, MonoGenericConte
res->context.class_inst = context->class_inst;
res->context.method_inst = context->method_inst;
// FIXME: We're wasting memory and cpu by storing key and value redundantly for this table
dn_simdhash_ght_try_add (mm->gsignature_cache, res, res);
dn_simdhash_ght_insert (mm->gsignature_cache, res, res);
}

mono_mem_manager_unlock (mm);
Expand Down Expand Up @@ -3471,7 +3471,7 @@ mono_metadata_get_canonical_generic_inst (MonoGenericInst *candidate)
ginst->type_argv [i] = mono_metadata_type_dup (NULL, candidate->type_argv [i]);

// FIXME: We're wasting memory and cpu by storing ginst redundantly in this table
dn_simdhash_ght_try_add (mm->ginst_cache, ginst, ginst);
dn_simdhash_ght_insert (mm->ginst_cache, ginst, ginst);
}

mono_loader_unlock ();
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/aot-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -3397,7 +3397,7 @@ decode_exception_debug_info (MonoAotModule *amodule,
/* This could be set already since this function can be called more than once for the same method */
MonoSeqPointInfo *existing_seq_points = NULL;
if (!dn_simdhash_ght_try_get_value (jit_mm->seq_points, method, (void **)&existing_seq_points)) {
dn_simdhash_ght_try_add (jit_mm->seq_points, method, seq_points);
dn_simdhash_ght_insert (jit_mm->seq_points, method, seq_points);
} else {
mono_seq_point_info_free (seq_points);
seq_points = existing_seq_points;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -9388,7 +9388,7 @@ mono_interp_transform_method (InterpMethod *imethod, ThreadContext *context, Mon
gpointer seq_points = NULL;
dn_simdhash_ght_try_get_value (jit_mm->seq_points, imethod->method, (void **)&seq_points);
if (!seq_points || seq_points != imethod->jinfo->seq_points)
dn_simdhash_ght_insert_replace (jit_mm->seq_points, imethod->method, imethod->jinfo->seq_points, 0);
dn_simdhash_ght_replace (jit_mm->seq_points, imethod->method, imethod->jinfo->seq_points);
}
jit_mm_unlock (jit_mm);

Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/seq-points.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ mono_save_seq_point_info (MonoCompile *cfg, MonoJitInfo *jinfo)
// FIXME: The lookup can fail if the method is JITted recursively though a type cctor
MonoSeqPointInfo *existing_seq_points = NULL;
if (!dn_simdhash_ght_try_get_value (jit_mm->seq_points, cfg->method_to_register, (void **)&existing_seq_points)) {
dn_simdhash_ght_try_add (jit_mm->seq_points, cfg->method_to_register, cfg->seq_point_info);
dn_simdhash_ght_insert (jit_mm->seq_points, cfg->method_to_register, cfg->seq_point_info);
} else {
mono_seq_point_info_free (cfg->seq_point_info);
cfg->seq_point_info = existing_seq_points;
Expand Down

0 comments on commit 1881bb6

Please sign in to comment.