Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@pgavlin
Copy link

@pgavlin pgavlin commented Jun 26, 2016

Move the four debug-only GenTree flags into their own field. This frees
up two bits across both the RyuJIT and the legacy backend.

Move the four debug-only GenTree flags into their own field. This frees
up two bits across both the RyuJIT and the legacy backend.
@pgavlin
Copy link
Author

pgavlin commented Jun 26, 2016

@dotnet/jit-contrib @mikedn PTAL

This is part of #5999.

#define GTF_NODE_SMALL 0x00020000

// Property of the node itself, not the gtOper
#define GTF_NODE_MASK (GTF_COLON_COND | GTF_MORPHED | GTF_NODE_SMALL | GTF_NODE_LARGE )
Copy link

Choose a reason for hiding this comment

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

Something bugs me about this. GTF_NODE_MASK is used to prevent copying these flags to other nodes but it contains only 3 of the 4 moved flags. I suspect that some places that deal with flag copying might need to be updated. For example, at the end of gtClone there is:

copy->gtFlags |= tree->gtFlags & ~GTF_NODE_MASK;

Shouldn't the following line be added

copy->gtDebugFlags |= tree->gtDebugFlags & ~(GTF_DEBUG_MORPHED | GTF_DEBUG_NODE_SMALL | GTF_DEBUG_NODE_LARGE);

to copy GTF_DEBUG_VAR_CSE_REF?

Though it's not clear why GTFD_VAR_CSE_REF would be copied in this case, maybe the existing code is wrong to begin with.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I think you're correct. I'll run through the uses of GTF_NODE_MASK.

Copy link

@briansull briansull Jun 26, 2016

Choose a reason for hiding this comment

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

I believe that we should get rid of the GTF_MORPHED flag as it isn't really very useful or even consistently set. It mostly hit us when you try to morph a node a second time in the global morph phase and that is something that we often need to do.

This is an orthononal issue, so feel free to commit this change without addressing this.

Choose a reason for hiding this comment

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

I agree with @briansull about the GTF_MORPHED flag - I supposed it prevents some small amount of unintended throughput loss from accidentally re-morphing nodes, but is a huge hassle if that's what you really want to do.
I also agree that it is orthogonal to this.

Copy link
Author

Choose a reason for hiding this comment

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

@mikedn
Copy link

mikedn commented Jun 26, 2016

I'm not sure about the GTF_NODE_MASK thing but GTF_DEBUG_VAR_CSE_REF seems to be used only in dumps so it's not much of an issue. LGTM

This also renames `GTF_DEBUG_MORPHED` to `GTF_DEBUG_NODE_MORPHED` for
consitency with the other node-specific debug flags.
// Print the tree so we can see it in the log.
printf("Missing flags on tree [%X]: ", tree);
GenTree::gtDispFlags(chkFlags & ~treeFlags);
GenTree::gtDispFlags(chkFlags & ~treeFlags, 0);

Choose a reason for hiding this comment

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

Just a suggestion - it might be nice to have a GTF_NONE and/or a GTF_DEBUG_NONE for cases like this, just to make it clearer from the caller's side what this is.

Copy link
Author

Choose a reason for hiding this comment

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

Good suggestion. Done.

@CarolEidt
Copy link

LGTM

This is a marker that is used to indicate the absence of debug GenTree
flags.
@briansull
Copy link

LGTM

@pgavlin pgavlin merged commit 7081a2b into dotnet:master Jun 27, 2016
@pgavlin pgavlin deleted the GenTreeDebugFlags branch June 27, 2016 18:00
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Refactor debug-only GenTree flags.

Commit migrated from dotnet/coreclr@7081a2b
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants