Skip to content

Commit 3216324

Browse files
[interp] Reorder InterpMethod to reduce padding (#32657)
for alignment. Size goes from 192 to 184. Co-authored-by: Jay Krell <[email protected]>
1 parent 489ffcd commit 3216324

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

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

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,32 +130,23 @@ typedef enum {
130130
* Structure representing a method transformed for the interpreter
131131
* This is domain specific
132132
*/
133-
typedef struct _InterpMethod
134-
{
133+
typedef struct InterpMethod InterpMethod;
134+
struct InterpMethod {
135135
/* NOTE: These first two elements (method and
136136
next_jit_code_hash) must be in the same order and at the
137137
same offset as in MonoJitInfo, because of the jit_code_hash
138138
internal hash table in MonoDomain. */
139139
MonoMethod *method;
140-
struct _InterpMethod *next_jit_code_hash;
141-
guint32 locals_size;
142-
guint32 total_locals_size;
143-
guint32 stack_size;
144-
guint32 vt_stack_size;
145-
guint32 alloca_size;
146-
unsigned int init_locals : 1;
147-
unsigned int vararg : 1;
148-
unsigned int needs_thread_attach : 1;
140+
InterpMethod *next_jit_code_hash;
141+
142+
// Sort pointers ahead of integers to minimize padding for alignment.
143+
149144
unsigned short *code;
150145
MonoPIFunc func;
151-
int num_clauses;
152-
MonoExceptionClause *clauses;
146+
MonoExceptionClause *clauses; // num_clauses
153147
void **data_items;
154-
int transformed;
155148
guint32 *local_offsets;
156149
guint32 *exvar_offsets;
157-
unsigned int param_count;
158-
unsigned int hasthis;
159150
gpointer jit_wrapper;
160151
gpointer jit_addr;
161152
MonoMethodSignature *jit_sig;
@@ -165,12 +156,25 @@ typedef struct _InterpMethod
165156
MonoType **param_types;
166157
MonoJitInfo *jinfo;
167158
MonoDomain *domain;
159+
160+
guint32 locals_size;
161+
guint32 total_locals_size;
162+
guint32 stack_size;
163+
guint32 vt_stack_size;
164+
guint32 alloca_size;
165+
int num_clauses; // clauses
166+
int transformed; // boolean
167+
unsigned int param_count;
168+
unsigned int hasthis; // boolean
168169
MonoProfilerCallInstrumentationFlags prof_flags;
169170
InterpMethodCodeType code_type;
170171
#ifdef ENABLE_EXPERIMENT_TIERED
171172
MiniTieredCounter tiered_counter;
172173
#endif
173-
} InterpMethod;
174+
unsigned int init_locals : 1;
175+
unsigned int vararg : 1;
176+
unsigned int needs_thread_attach : 1;
177+
};
174178

175179
typedef struct _StackFragment StackFragment;
176180
struct _StackFragment {

0 commit comments

Comments
 (0)