Skip to content

Commit

Permalink
[mono][interp] Make sure containing klass has field offsets initializ…
Browse files Browse the repository at this point in the history
…ed (#73264)

* [mono][interp] Improve check for tiering enabled

* [mono][interp] Make sure containing klass has field offsets initialized
  • Loading branch information
BrzVlad authored Aug 3, 2022
1 parent 197ae4c commit bcdcaec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mono/mono/mini/interp/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ mono_interp_get_imethod (MonoMethod *method)
imethod->code_type = IMETHOD_CODE_UNKNOWN;
// always optimize code if tiering is disabled
// always optimize wrappers
if (!(mono_interp_opt & INTERP_OPT_TIERING) || method->wrapper_type != MONO_WRAPPER_NONE)
if (!mono_interp_tiering_enabled () || method->wrapper_type != MONO_WRAPPER_NONE)
imethod->optimized = TRUE;
if (imethod->method->string_ctor)
imethod->rtype = m_class_get_byval_arg (mono_defaults.string_class);
Expand Down
3 changes: 3 additions & 0 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -5900,6 +5900,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
MonoType *ftype = mono_field_get_type_internal (field);
gboolean is_static = !!(ftype->attrs & FIELD_ATTRIBUTE_STATIC);
mono_class_init_internal (klass);
mono_class_setup_fields (klass);
{
if (is_static) {
td->sp--;
Expand Down Expand Up @@ -5939,6 +5940,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
MonoType *ftype = mono_field_get_type_internal (field);
gboolean is_static = !!(ftype->attrs & FIELD_ATTRIBUTE_STATIC);
mono_class_init_internal (klass);
mono_class_setup_fields (klass);

MonoClass *field_klass = mono_class_from_mono_type_internal (ftype);
mt = mint_type (ftype);
Expand Down Expand Up @@ -6014,6 +6016,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
gboolean is_static = !!(ftype->attrs & FIELD_ATTRIBUTE_STATIC);
MonoClass *field_klass = mono_class_from_mono_type_internal (ftype);
mono_class_init_internal (klass);
mono_class_setup_fields (klass);
mt = mint_type (ftype);

BARRIER_IF_VOLATILE (td, MONO_MEMORY_BARRIER_REL);
Expand Down

0 comments on commit bcdcaec

Please sign in to comment.