Comments (6)
My patch (for an old version of mono adds this to GC_push_all_stacks:
if (thread -> id == thread_id) {
#if defined(X86_64)
CONTEXT context;
RtlCaptureContext(&context);
// push non-volatile registers only (excl. rsp)
PUSH4(Rbx, Rbp, Rdi, Rsi), PUSH4(R12, R13, R14, R15);
#endif
sp = (ptr_t) &dummy;
It would probably better to write an asm proc to do this, but this was my quick and dirty solution. I believe something similar should be done in the pthread implementation (probably with another separate asm proc for the linux/bsd ABI.) It looks like this problem theoretically exists on x86 as well, but the lack of registers probably makes it impossible to reproduce in a test.
from bdwgc.
After digging a bit more, I found GC_generic_push_regs, which is clearly where the registers are meant to be marked. The problem is that it's only adding them to the mark stack and then returning, which causes the stack to be wiped (either by debug code or overwritten by other calls) before it gets marked. It ends up having no effect.
from bdwgc.
So, I see GC_generic_push_regs cause registers to be pushed onto the thread stack; on Win32 this is done by calling setjmp with a stack allocated jmp_buf, causing the register contents to then be on the stack. It then calls the callback function of GC_push_current_stack. In the case of THREADS being defined it should then call GC_push_all_eager.
https://github.com/Unity-Technologies/mono/blob/unity-staging/libgc/mark_rts.c#L497
GC_push_all_eager should push/copy the potential pointer values from the thread stack onto the mark stack immediately.
from bdwgc.
I'm hitting the non eager push right above there (stack growing down.)
On Sep 9, 2014, at 12:35 AM, "Jonathan Chambers" [email protected] wrote:
So, I see GC_generic_push_regs cause registers to be pushed onto the thread stack; on Win32 this is done by calling setjmp with a stack allocated jmp_buf, causing the register contents to then be on the stack. It then calls the callback function of GC_push_current_stack. In the case of THREADS being defined it should then call GC_push_all_eager.
https://github.com/Unity-Technologies/mono/blob/unity-staging/libgc/mark_rts.c#L497
GC_push_all_eager should push/copy the potential pointer values from the thread stack onto the mark stack immediately.
—
Reply to this email directly or view it on GitHub.
from bdwgc.
Okay, so that at least explains the behavior. Upstream has GC_push_all_eager for both cases,
https://github.com/ivmai/bdwgc/blob/master/mark_rts.c#L664
Our version changed this for some reason. I'll track down why and revert the change. This issue can be closed as it doesn't apply to upstream IMO.
from bdwgc.
I'll revert Unity-Technologies/mono@0ded310 locally to fix this.
Thanks
from bdwgc.
Related Issues (20)
- Race between GC_clear_block and GC_generic_malloc_aligned called by GC_memalign HOT 2
- Unexpected heap growth in gctest single-threaded incremental mode with checksums on Linux/x64
- SEGFAULT in gctest on Win64
- gctest sometimes hang on Linux/x64 when compiled with DONT_ADD_BYTE_AT_END HOT 2
- gc-8.2.2 gctest fail on linux/aarch64 (qemu) HOT 5
- initfromthreadtest fail on Ubuntu 22 x64 HOT 4
- Signals delivery fails in gctest on Ubuntu Jammy if compiled with TSan HOT 10
- Incremental GC collecting referenced objects (gctest fails with soft vdb if shared build by zig) HOT 13
- Best practice on parallel + incremental / generational ? HOT 8
- Design question, concurent GC + free? HOT 4
- Provide global aligned allocators in gccpp library HOT 1
- Bad complex descriptor occurs rarely in find-leak mode HOT 3
- Assertion violation in cpptest about nFreed/nAllocated with ASan on E2K HOT 1
- SIGSEGV in gctest, disclaimtest, weakmaptest if compiled with TSan and MPROTECT_VDB mode active on Linux HOT 2
- SIGPWR signal on Debian HOT 3
- Inconsistent soft-dirty against mprotect dirty bits HOT 3
- Downstream libgc releases (May 2023) HOT 30
- Initial support of Embox OS HOT 8
- config doesn't recognize riscv on netbsd HOT 3
- Provide build.zig for building libgc? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bdwgc.