Skip to content

Commit

Permalink
Use unknown placeholder for collectible class typehandle
Browse files Browse the repository at this point in the history
instead of null, so that we won't over-estimate likelihood of other types at a
call site where we see both collectible and non-collectible types.

Addresses part of dotnet#48549.
  • Loading branch information
AndyAyersMS committed Feb 24, 2021
1 parent 8f0f819 commit e15ff13
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/coreclr/vm/jithelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "castcache.h"
#include "onstackreplacement.h"
#include "pgo.h"
#include "pgo_formatprocessing.h"

#ifndef FEATURE_EH_FUNCLETS
#include "excep.h"
Expand Down Expand Up @@ -5260,12 +5261,13 @@ HCIMPL2(void, JIT_ClassProfile, Object *obj, void* tableAddress)

MethodTable* pMT = objRef->GetMethodTable();

// If the object class is collectible, record NULL
// for the class handle.
// If the object class is collectible, record an unknown typehandle.
// We do this instead of recording NULL so that we won't over-estimate
// the likelihood of known type handles.
//
if (pMT->GetLoaderAllocator()->IsCollectible())
{
pMT = NULL;
pMT = (MethodTable*)DEFAULT_UNKNOWN_TYPEHANDLE;
}

#ifdef _DEBUG
Expand Down

0 comments on commit e15ff13

Please sign in to comment.