-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local GC: stop sharing GC globals between GC and write barrier #7069
Comments
With regards to SWW, the address of the write watch table can be communicated in the same manner as |
fixed by dotnet/coreclr#8605 and dotnet/coreclr#8568 |
:mips-interest
But MIPS64 recently begin to follow the UNIX AMD64 ABI, for example, "copy" the SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR to I am (preparing) changing to AMD64 way... Thanks, |
@xiangzhai it is not clear to me how passing struct in registers is related to GC write barriers. Can you please be more specific on that? Maybe I can help you to figure out a way without changing to the amd64 way of handling write barriers. |
Hi @janvorli We will open source ASAP :) https://github.com/gsvm
Sorry for my poor English! I just paste MIPS64 code about returning
We implemented And I persuaded myself not changed to AMD64 way because Loongson 3A3000 is weak memory model more likely ARM64. Thanks, |
It seems that for the twofloat / twodouble stuff you got it right. Floats and doubles cannot be ref nor byref. |
emm, let's wait our open source :) The testcase is XUnit:
Workaround:
Then xunit was able to work after commented the |
As part of the LocalGC project I’d like to stop sharing the GC globals between the GC code and the WB (Write Barrier) code. The globals are (note I am not including things that don’t run on customers machines by default like debug only code or GCShadow stuff):
g_card_table
g_lowest_address
g_highest_address
g_ephemeral_low
g_ephemeral_high
The last 2 are only changed when EE is suspended so there’s no significance in the order they are set wrt anything else – managed threads are not running at this point anyway. But it would still be good to not share them.
The first 3 are what causes all this intricacy. There is one invariant that we need to stick to which is
The WB code must see the updated g_card_table before they see updated g_lowest/highest
So the WB side just needs to make sure they are updated in that order.
On the GC side, since GC only uses these either when EE is stopped or when it’s under a global lock. As long as we are not stopped in the middle of setting these 3 values we are fine (the rare race that occurs today is due to the fact that we can be stopped in the middle).
So instead of declaring these on the GC side, we should have 2 sets of copies for these, one on GC side; the other on CLR side -
Remove the global declaration of them from gccommon.cpp and add them on the CLR side.
Rename them on the GC side so it’s clear they are separate. Replace g_ to g_gc_.
Pass them in the StompWriteBarrierResize and StompWriteBarrierEphemeral which will be part of the to GCToEEInterface/IGCToCLR interface.
// Consider creating a struct that includes all the globals so we don't need to pass in so many params
void StompWriteBarrierResize(bool isRuntimeSuspended, bool bReqUpperBoundsCheck, void* new_card_table, void* new_lowest_address, void new_highest_address);
// I would just get rid of the isRuntimeSuspesnded parameter as it's never called with false.
void WriteBarrierManager::UpdateEphemeralBounds(void* new_ephemeral_low, void* new_ephemeral_high);
In GC grow_brick_card_tables is where we might need to change the first 3 values. Right now it has this sequence:
g_card_table = new_card_table;
StompWriteBarrierResize();
GCToOSInterface::FlushProcessWriteBuffers();
g_lowest_address = new_lowest_address;
VolatileStore(&g_highest_address, new_highest_address);
This will be changed to:
g_gc_card_table = new_card_table;
g_gc_lowest_address = new_lowest_address;
g_gc_highest_address = new_highest_address;
StompWriteBarrierResize(param0, param1, g_gc_card_table, g_gc_lowest_address, g_gc_highest_address);
And in StompWriteBarrierResize,
Do what StompWriteBarrierResize currently does (ie, might suspend EE to change WB type; bash the g_card_table value) and then
g_card_table = new_card_table;
FlushProcessWriteBuffers();
g_lowest_address = new_lowest_address;
VolatileStore(&g_highest_address, new_highest_address);
@swgillespie Note I didn't include the software WW stuff... feel free to add that as we discussed.
The text was updated successfully, but these errors were encountered: