Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15275,19 +15275,23 @@ bool GenTree::IsFieldAddr(Compiler* comp, GenTreePtr* pObj, GenTreePtr* pStatic,
baseAddr = gtOp.gtOp1;
}
}
// Check if "this" has a zero-offset annotation.
else if (comp->GetZeroOffsetFieldMap()->Lookup(this, &newFldSeq))
{
baseAddr = this;
mustBeStatic = true;
}
else if (OperGet() == GT_CNS_INT && gtIntCon.gtFieldSeq != nullptr)
{
// Address is a literal constant; must be a static field.
newFldSeq = gtIntCon.gtFieldSeq;
Copy link

@briansull briansull Aug 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a static field and isFieldStatic(newFldSeq->m_fieldHnd)) returns true then you
may need to set baseAddr to 'this' I think as returning both pObj and pStatic as nullptr could be a problem.

Look into this area I can't tell for sure.
The method comment says it isn't allowed, but valuenum 5822 looks like it handles this case.

But if returning both as nullptr is what you want here, then update the comment in the method declaration.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks, I think you're right and pStatic should be set in this case. Updated.

baseAddr = this;
mustBeStatic = true;
}
else
{
// Check if "this" has a zero-offset annotation.
if (!comp->GetZeroOffsetFieldMap()->Lookup(this, &newFldSeq))
{
// If not, this is not a field address.
return false;
}
else
{
baseAddr = this;
mustBeStatic = true;
}
// This is not a field address.
return false;
}

// If not we don't have a field seq, it's not a field address.
Expand Down
2 changes: 1 addition & 1 deletion tests/src/GC/Scenarios/FinalizeTimeout/FinalizeTimeout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private static void ThreadMain()

private class BlockingFinalizerOnShutdown
{
public static bool finalizerCompletedOnce = false;
public volatile static bool finalizerCompletedOnce = false;
public bool isLastObject = false;

~BlockingFinalizerOnShutdown()
Expand Down