Skip to content

Commit d8569ab

Browse files
BrzVladtmds
authored andcommitted
[mono][interp] Small code refactoring for SSA (dotnet#97249)
* [mono][interp] Move optimization related code out of transform.c Use interp_ prefix for non-static methods within interpreter (mono_interp seems rather long) Use interp_ prefix, instead of .._interp_..., for consistency. Use ins everywhere in method names for consistency, instead of inst. * [mono][interp] Pass ref to var storage in interp inst In order to facilitate overwritting of sregs/dreg during instruction iterations. Also enable iterating only on sregs. * [mono][interp] Print invalid il offset in aligned fashion * [mono][interp] Remove irrelevant stats * [mono][interp] Renaming of local to var Local can have multiple meanings. Use it to refer to IL locals from now. All IL locals are vars. Vars can be local (single bblock use) or global. * [mono][interp] Remove flags and use bit fields instead Makes the code clearer and it is easier to maintain.
1 parent 5d8969a commit d8569ab

File tree

8 files changed

+3105
-3049
lines changed

8 files changed

+3105
-3049
lines changed

src/mono/mono/mini/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ set(interp_sources
314314
interp/mintops.h
315315
interp/mintops.c
316316
interp/transform.c
317+
interp/transform-opt.c
317318
interp/tiering.h
318319
interp/tiering.c
319320
interp/jiterpreter.c

src/mono/mono/mini/interp/interp-internals.h

-8
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,7 @@ typedef struct {
277277
gint64 methods_transformed;
278278
gint64 cprop_time;
279279
gint64 super_instructions_time;
280-
gint32 stloc_nps;
281-
gint32 movlocs;
282-
gint32 copy_propagations;
283-
gint32 constant_folds;
284-
gint32 ldlocas_removed;
285-
gint32 killed_instructions;
286280
gint32 emitted_instructions;
287-
gint32 super_instructions;
288-
gint32 added_pop_count;
289281
gint32 inlined_methods;
290282
gint32 inline_failures;
291283
} MonoInterpStats;

src/mono/mono/mini/interp/interp.c

-8
Original file line numberDiff line numberDiff line change
@@ -8690,14 +8690,6 @@ register_interp_stats (void)
86908690
mono_counters_register ("Methods transformed", MONO_COUNTER_INTERP | MONO_COUNTER_LONG, &mono_interp_stats.methods_transformed);
86918691
mono_counters_register ("Total cprop time", MONO_COUNTER_INTERP | MONO_COUNTER_LONG | MONO_COUNTER_TIME, &mono_interp_stats.cprop_time);
86928692
mono_counters_register ("Total super instructions time", MONO_COUNTER_INTERP | MONO_COUNTER_LONG | MONO_COUNTER_TIME, &mono_interp_stats.super_instructions_time);
8693-
mono_counters_register ("STLOC_NP count", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.stloc_nps);
8694-
mono_counters_register ("MOVLOC count", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.movlocs);
8695-
mono_counters_register ("Copy propagations", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.copy_propagations);
8696-
mono_counters_register ("Added pop count", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.added_pop_count);
8697-
mono_counters_register ("Constant folds", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.constant_folds);
8698-
mono_counters_register ("Ldlocas removed", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.ldlocas_removed);
8699-
mono_counters_register ("Super instructions", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.super_instructions);
8700-
mono_counters_register ("Killed instructions", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.killed_instructions);
87018693
mono_counters_register ("Emitted instructions", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.emitted_instructions);
87028694
mono_counters_register ("Methods inlined", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.inlined_methods);
87038695
mono_counters_register ("Inline failures", MONO_COUNTER_INTERP | MONO_COUNTER_INT, &mono_interp_stats.inline_failures);

src/mono/mono/mini/interp/jiterpreter.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ build_address_taken_bitset (TransformData *td, InterpBasicBlock *bb, guint32 bit
773773
for (InterpInst *ins = bb->first_ins; ins != NULL; ins = ins->next) {
774774
if (ins->opcode == MINT_LDLOCA_S) {
775775
InterpMethod *imethod = td->rtm;
776-
InterpLocal *loc = &td->locals[ins->sregs[0]];
776+
InterpVar *loc = &td->vars [ins->sregs[0]];
777777

778778
// Allocate on demand so if a method contains no ldlocas we don't allocate the bitset
779779
if (!imethod->address_taken_bits)

0 commit comments

Comments
 (0)