@@ -13137,6 +13137,20 @@ add_profile_method (MonoAotCompile *acfg, MonoMethod *m)
13137
13137
add_extra_method (acfg , m );
13138
13138
}
13139
13139
13140
+ //---------------------------------------------------------------------------------------
13141
+ //
13142
+ // add_single_profile_method filters MonoMethods to be added for AOT compilation.
13143
+ // The filter logic is extracted from add_profile_instances and comments are retained
13144
+ // from there.
13145
+ //
13146
+ // Arguments:
13147
+ // * acfg - MonoAotCompiler instance
13148
+ // * method - MonoMethod to attempt to add for AOT compilation
13149
+ //
13150
+ // Return Value:
13151
+ // int pertaining whether or not the method was added to be AOT'd
13152
+ //
13153
+
13140
13154
static int
13141
13155
add_single_profile_method (MonoAotCompile * acfg , MonoMethod * method )
13142
13156
{
@@ -13212,6 +13226,38 @@ typedef enum {
13212
13226
FIND_METHOD_TYPE_ENTRY_END ,
13213
13227
} MibcGroupMethodEntryState ;
13214
13228
13229
+ //---------------------------------------------------------------------------------------
13230
+ //
13231
+ // add_mibc_group_method_methods iterates over a mibcGroupMethod MonoMethod to obtain
13232
+ // each method/type entry in that group. Each entry begins with LDTOKEN opcode, followed
13233
+ // by a series of instructions including another LDTOKEN opcode but excluding a POP opcode
13234
+ // ending with a POP opcode to denote the end of the entry. To iterate over entries,
13235
+ // a MibcGroupMethodEntryState state is tracked, identifying whether we are looking for
13236
+ // an entry starting LDTOKEN opcode or entry ending POP opcode. Each LDTOKEN opcode's
13237
+ // argument denotes a methodref or methodspec. Before ultimately adding the entry's method
13238
+ // for AOT compilation, checks for the method's class and image are used to skip methods
13239
+ // whose class and images cannot be resolved.
13240
+ //
13241
+ // Sample mibcGroupMethod format
13242
+ //
13243
+ // Method 'Assemblies_HelloWorld;_1' (#11b) (0x06000001)
13244
+ // {
13245
+ // IL_0000: ldtoken 0x0A0002B5 // Method/Type Entry token
13246
+ // IL_0005: pop
13247
+ // }
13248
+ //
13249
+ // Arguments:
13250
+ // * acfg - MonoAotCompiler instance
13251
+ // * mibcGroupMethod - MonoMethod representing the group of assemblies that
13252
+ // describes each Method/Type entry with the .mibc file
13253
+ // * image - MonoImage representing the .mibc file
13254
+ // * mibcModuleClass - MonoClass containing the AssemblyDictionary
13255
+ // * context - MonoGenericContext of the AssemblyDictionary MonoMethod
13256
+ //
13257
+ // Return Value:
13258
+ // int pertaining to the number of methods added within the mibcGroupMethod
13259
+ //
13260
+
13215
13261
static int
13216
13262
add_mibc_group_method_methods (MonoAotCompile * acfg , MonoMethod * mibcGroupMethod , MonoImage * image , MonoClass * mibcModuleClass , MonoGenericContext * context )
13217
13263
{
@@ -13257,6 +13303,30 @@ add_mibc_group_method_methods (MonoAotCompile *acfg, MonoMethod *mibcGroupMethod
13257
13303
return count ;
13258
13304
}
13259
13305
13306
+ //---------------------------------------------------------------------------------------
13307
+ //
13308
+ // add_mibc_profile_methods is the overarching method that adds methods within a .mibc
13309
+ // profile file to be compiled ahead of time. .mibc is a portable executable with
13310
+ // methods grouped under mibcGroupMethods, which are summarized within the global
13311
+ // function AssemblyDictionary. This method obtains the AssemblyDictionary and iterates
13312
+ // over il opcodes and arguments to retrieve mibcGroupMethods and thereafter calls
13313
+ // add_mibc_group_method_methods.
13314
+ //
13315
+ // Sample AssemblyDictionary format
13316
+ //
13317
+ // Method 'AssemblyDictionary' (#2f67) (0x06000006)
13318
+ // {
13319
+ // IL_0000: ldstr 0x70000001
13320
+ // IL_0005: ldtoken 0x06000001 // mibcGroupMethod
13321
+ // IL_000a: pop
13322
+ // ...
13323
+ // }
13324
+ //
13325
+ // Arguments:
13326
+ // * acfg - MonoAotCompiler instance
13327
+ // * filename - the .mibc profile file containing the methods to AOT compile
13328
+ //
13329
+
13260
13330
static void
13261
13331
add_mibc_profile_methods (MonoAotCompile * acfg , char * filename )
13262
13332
{
0 commit comments