Implementing native TLS on OS X in DMD

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Jan 8 07:32:21 PST 2016


On 8 Jan 2016, at 8:37, Jacob Carlborg via digitalmars-d-ldc wrote:
> I've been trying to debug this but I don't have much knowledge in this 
> area. What I have found out is that "_chars" is included in the range 
> returned by _d_dyld_getTLSRange [6]. I've been trying to debug the GC, 
> and it looks like "_chars" is marked twice, before crashing. Or at 
> least a range where "_chars" is included.

It's been a while since I initially looked into getting the TLS to work, 
but did you check that _chars is properly aligned (i.e. to 8 bytes on 
x86_64)? This would be one way how the GC could miss the pointer even 
though the global is contained in a root range.

If that's not it, I'd just continue trying to figure out which objects 
exactly are collected (not marked) and why.

> If I recall correctly, they looked like they were related to exception 
> handling.

There is currently a per-thread cache for exception handling metadata, 
yes. It contains a subtle bug, though (related to moving fibers between 
threads), and will probably go away.

  — David


More information about the digitalmars-d-ldc mailing list