Repository navigation
Conversation
|
Can you give an example of before and after codegen, showing the fix? |
|
@BruceForstall added |
|
@rartemev In the "after" code it looks like it thinks the very first two pointer slots of the struct are GC pointers, and the padding is after that. Is that correct? Shouldn't the padding be between the two pointer copies (via helper)? |
|
Also, you've eliminated the fast-pass (optimization) to avoid calling the write barrier for stack destinations. It seems like that's the wrong fix. It seems like perhaps the real problem was that the "str" instruction (in the stack destination case, at least), when writing a EA_GCREF/EA_BYREF type, was not creating a GC info record. Thus, the stack slot we just wrote was becoming live (holding a GC ref), but the GC info didn't say that. The interesting thing to show is not the raw generated code, but the generated code in the "Instructions as they come out of the scheduler " phase that shows GC info changes (or, raw instructions plus appropriate GC info). |
|
@BruceForstall yes, it is.
As far as I know we shouldn't rely on how the struct is defined in the source code. The actual layout is up to execution runtime and I think since we have 4 byte pointers and 8-byte aligned padding it is good idea to put both pointers together because we have an empty 4-byte hole between first pointer and first double. |
|
No, the actual problem was that when we receive GC signal, the |
Sure; if the VM arranged them that way, then it is correct.
So the GC info is wrong, not the codegen. |
|
If I am correct the situation is like when within a single node |
|
GC info is on a per-instruction basis, based on the EA_GCREF/EA_BYREF type given when the instruction is generated. GC info is not on a per-IR-node basis. |
|
@rartemev What test are you looking at? |
|
Updated here #14601 |
Issue #14383.
Fixed code generation for
GT_STORE_OBJnode containing gcref. In case we have struct with both gcref non-gcref we may receive GC signal during copy code when temporary register holds non-ref value, but marked as gcref. So such situation obviously leds to gc hole.We have a struct S
And the which copies it
Before:
After:
So you can see that 2
CORINFO_HELP_ASSIGN_BYREFwas added which correspond to 2 references in the original struct.