JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.77k stars 5.49k forks source link

Tracy asserts on macOS (apple silicon) when building with stacktrace support and trying to profile #49730

Open KristofferC opened 1 year ago

KristofferC commented 1 year ago

Almost immediately asserts with:

Assertion failed: (( ( ptr & 0x3000000000000000 ) << 2 ) == ( ptr & 0xC000000000000000 )), function PackPointer, file ../../../server/TracyWorker.cpp, line 3995.

after connecting the profiler.

I dont know if this is a bug in tracy or something with how we use it / build it so I'm filing it here first.

vtjnash commented 1 year ago

I am not certain I understand how a pointer can equal a shifted copy of itself. But that check seems possibly incompatible with user-space threading and might be incorrect in general with threads too?

pchintalapudi commented 1 year ago

I think they're using the upper bits of the pointer as payload (like alignment bits)

vtjnash commented 1 year ago

Ah, I see it is attempting to assert that the pointer high nibble has the form 0xabab. Which appears to contradict what the hardware expects (on intel x64, it would be 0xabbb, so that the value 0x7fff can be used as stack memory):

a canonical address must have bits 63 through 48 set to zeros or ones (depending on whether bit 47 is a zero or one)

gbaraldi commented 1 year ago

Is this intel or arm?

KristofferC commented 1 year ago

Apple silicon

wolfpld commented 1 year ago

See https://mastodon.gamedev.place/@aras/110289472336821115 for the possible explanation.

vtjnash commented 1 year ago

I didn't think we had enabled the function pointer signing, as I am not sure if the OrcJIT implements support for that yet?