Locations in the codegen where we assume pointers tagged with certain values?

Hi all, I'm trying to find all places in the code generator where we assume that a pointer is tagged with a certain value. A generated code for this looks like this: mov 0x6(%rbx),%rax This moves payload[0] of the closure in %rbx to %rax, but it assumes that %rbx is tagged with 2 so it does 0x6(%rbx) instead of 0x8(%rbx). Anyone know where I should be looking at? Context: I'm implementing shorting out indirections in the concurrent collector. The code is quite similar to the current collector, except we do a cas() when updating the IND/BLACKHOLE pointer with the pointer to the indirectee. The problem is this causes all kinds of problems, in our debugging mostly caused by pointer misalignment. One concrete example of where this happens is we do mov 0x6(%rbx),%rax but the pointer in %rbx is actually tagged 3 instead of 2. The reason is I think we're breaking some invariants in the generated code where we assume certain tags from pointers (2 in the example above), but I couldn't find where in the code generator we do this. Thanks, Ömer

Ömer Sinan Ağacan
Hi all,
I'm trying to find all places in the code generator where we assume that a pointer is tagged with a certain value. A generated code for this looks like this:
mov 0x6(%rbx),%rax
This moves payload[0] of the closure in %rbx to %rax, but it assumes that %rbx is tagged with 2 so it does 0x6(%rbx) instead of 0x8(%rbx).
Anyone know where I should be looking at?
I would start by looking at uses of tagForCon, lfDynTag and mkTaggedObjectLoad. Also, did you check that the tag we apply to the closure pointer matches the tag that the info table defines? Cheers, - Ben

Also, did you check that the tag we apply to the closure pointer matches the tag that the info table defines?
Yep, see my update in the Gitlab issue.
Ömer
Ben Gamari
Ömer Sinan Ağacan
writes: Hi all,
I'm trying to find all places in the code generator where we assume that a pointer is tagged with a certain value. A generated code for this looks like this:
mov 0x6(%rbx),%rax
This moves payload[0] of the closure in %rbx to %rax, but it assumes that %rbx is tagged with 2 so it does 0x6(%rbx) instead of 0x8(%rbx).
Anyone know where I should be looking at?
I would start by looking at uses of tagForCon, lfDynTag and mkTaggedObjectLoad.
Also, did you check that the tag we apply to the closure pointer matches the tag that the info table defines?
Cheers,
- Ben
participants (2)
-
Ben Gamari
-
Ömer Sinan Ağacan