OutputTables();
- // Create a empty export table. This makes tools like symchk not think
- // that native images are resoure-only DLLs. It is important to NOT
- // be a resource-only DLL because those DLL's PDBS are not put up on the
- // symbol server and we want NEN PDBS to be placed there.
- ZapPEExports* exports = new(GetHeap()) ZapPEExports(wszOutputFileName);
- m_pDebugSection->Place(exports);
- SetDirectoryEntry(IMAGE_DIRECTORY_ENTRY_EXPORT, exports);
-
+ // Create a empty export table. This makes tools like symchk not think
+ // that native images are resoure-only DLLs. It is important to NOT
+ // be a resource-only DLL because those DLL's PDBS are not put up on the
+ // symbol server and we want NEN PDBS to be placed there.
+ ZapPEExports* exports = new(GetHeap()) ZapPEExports(wszOutputFileName);
+ m_pDebugSection->Place(exports);
+ SetDirectoryEntry(IMAGE_DIRECTORY_ENTRY_EXPORT, exports);
+
ComputeRVAs();
if (!IsReadyToRunCompilation())
// Hot methods can be marked to be excluded from the AOT native image.
// We also need to disable inlining of such methods.
//
- if ((methodProfilingDataFlags & (1 << ExcludeHotMethodCode)) != 0)
+ if ((methodProfilingDataFlags & (1 << DisableInlining)) != 0)
{
// Disable the inlining of this method
//
}
}
- // Update the 'flags' saved in the profileDataHashTable hash table.
+ // Update the 'flags' and 'compileResult' saved in the profileDataHashTable hash table.
//
hashBBUpdateFlagsAndCompileResult(token, methodProfilingDataFlags, compileResult);
}
//
if ((methodProfilingDataFlags & (1 << ExcludeHotMethodCode)) != 0)
{
- // returning COMPILE_EXCLUDED excludes this method from the AOT native image
- return COMPILE_EXCLUDED;
+ // returning COMPILE_HOT_EXCLUDED excludes this method from the AOT native image
+ return COMPILE_HOT_EXCLUDED;
}
// Cold methods can be marked to be excluded from the AOT native image.
//
if ((methodProfilingDataFlags & (1 << ExcludeColdMethodCode)) != 0)
{
- // returning COMPILE_EXCLUDED excludes this method from the AOT native image
- return COMPILE_EXCLUDED;
+ // returning COMPILE_COLD_EXCLUDED excludes this method from the AOT native image
+ return COMPILE_COLD_EXCLUDED;
}
// If the code was never executed based on the profile data
//
if (m_zapper->m_pOpt->m_fPartialNGen)
{
- // returning COMPILE_EXCLUDED excludes this method from the AOT native image
- return COMPILE_EXCLUDED;
+ // returning COMPILE_COLD_EXCLUDED excludes this method from the AOT native image
+ return COMPILE_COLD_EXCLUDED;
}
// Retrieve any information that we have about a previous compilation attempt of this method
const ProfileDataHashEntry* pEntry = profileDataHashTable.LookupPtr(md);
if (pEntry != nullptr)
- {
- if (pEntry->status == COMPILE_EXCLUDED)
+ {
+ if ((pEntry->status == COMPILE_HOT_EXCLUDED) || (pEntry->status == COMPILE_COLD_EXCLUDED))
{
- // returning COMPILE_EXCLUDED excludes this method from the AOT native image
- return COMPILE_EXCLUDED;
+ // returning COMPILE_HOT_EXCLUDED excludes this method from the AOT native image
+ return pEntry->status;
}
}
}
public:
enum CompileStatus {
- LOOKUP_FAILED = -2, COMPILE_FAILED = -1, // Failure
- NOT_COMPILED = 0, COMPILE_EXCLUDED = 1, // Info
- COMPILE_SUCCEED = 10, ALREADY_COMPILED = 11
- }; // Success
+ // Failure status values are negative
+ LOOKUP_FAILED = -2,
+ COMPILE_FAILED = -1,
+
+ // Info status values are [0..9]
+ NOT_COMPILED = 0,
+ COMPILE_EXCLUDED = 1,
+ COMPILE_HOT_EXCLUDED = 2,
+ COMPILE_COLD_EXCLUDED = 3,
+
+ // Successful status values are 10 or greater
+ COMPILE_SUCCEED = 10,
+ ALREADY_COMPILED = 11
+ };
private:
// A hash table entry that contains the profile infomation and the CompileStatus for a given method
return (count_t)k;
}
- static const element_t Null() { LIMITED_METHOD_CONTRACT; ProfileDataHashEntry e; e.pos = 0; e.size = 0; e.md = 0; return e; } // Assuming method profile data cannot start from position 0.
- static bool IsNull(const element_t &e) { LIMITED_METHOD_CONTRACT; return e.pos == 0; }
+ static const element_t Null()
+ {
+ LIMITED_METHOD_CONTRACT;
+ ProfileDataHashEntry e;
+ e.md = 0;
+ e.size = 0;
+ e.pos = 0;
+ e.flags = 0;
+ e.status = NOT_COMPILED;
+ return e;
+ }
+
+ static bool IsNull(const element_t &e)
+ {
+ LIMITED_METHOD_CONTRACT;
+ // returns true if both md and pos are zero
+ return (e.md == 0) && (e.pos == 0);
+ }
};
typedef SHash<ProfileDataHashTraits> ProfileDataHashTable;
}
// The md must match.
- _ASSERTE(foundEntry->md == md);
+ _ASSERTE(foundEntry->md == md);
+ if (foundEntry->pos == 0)
+ {
+ // We might not have profile data and instead only have CompileStatus and flags
+ assert(foundEntry->size == 0);
+ return E_FAIL;
+ }
+
+ //
//
// We found the md. Let's retrieve the profile data.
//
- _ASSERTE(foundEntry->pos > 0); // The target position cannot be 0.
_ASSERTE(foundEntry->size >= sizeof(CORBBTPROF_METHOD_HEADER)); // The size must at least this
ProfileReader profileReader(DataSection_MethodBlockCounts->pData, DataSection_MethodBlockCounts->dataSize);