Skip to content
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

Support LLVM 15 #13164

Conversation

HertzDevil
Copy link
Contributor

🎊

Part of #12743. This PR removes the remaining explicit uses of typed pointers, and also adds a few other things that are not exactly related to opaque pointers.

The manual specs under spec/llvm-ir are not adjusted for LLVM 15's opaque pointers yet. This is not that important because those specs' focus was never about pointers.

Additional cleanup and refactoring is still needed before this could be merged into the main branch.

@HertzDevil
Copy link
Contributor Author

HertzDevil commented Mar 8, 2023

On my M2 and my ARM64 Alpine Linux VM, retrieving the call stack will sometimes fail:

def foo(x)
  y = x
  if y
    if y < 0
      p caller
    end
  else
    return 12
  end
end

foo(-1)
Invalid memory access (signal 10) at address 0x1008c58a0
[0x100848e84] *Exception::CallStack::print_backtrace:Nil +104 in /Users/quinton/.cache/crystal/crystal-run-small.tmp
[0x100834b10] ~procProc(Int32, Pointer(LibC::SiginfoT), Pointer(Void), Nil)@src/signal.cr:127 +320 in /Users/quinton/.cache/crystal/crystal-run-small.tmp
[0x18b9802a4] _sigtramp +56 in /usr/lib/system/libsystem_platform.dylib
[0x196fd3878] _ZN9libunwind12UnwindCursorINS_17LocalAddressSpaceENS_15Registers_arm64EE4stepEv +1152 in /usr/lib/system/libunwind.dylib
[0x196fd60f0] _Unwind_Backtrace +348 in /usr/lib/system/libunwind.dylib
[0x100835f20] *Exception::CallStack::unwind:Array(Pointer(Void)) +80 in /Users/quinton/.cache/crystal/crystal-run-small.tmp
[0x100835ebc] *Exception::CallStack#initialize:Array(Pointer(Void)) +20 in /Users/quinton/.cache/crystal/crystal-run-small.tmp
[0x100835e94] *Exception::CallStack::new:Exception::CallStack +48 in /Users/quinton/.cache/crystal/crystal-run-small.tmp
[0x100831964] *caller:Array(String) +16 in /Users/quinton/.cache/crystal/crystal-run-small.tmp

I have no idea what is going on. This was built using Homebrew's LLVM package because LLVM 15 is currently unavailable in any stable nixpkgs archive. The same crash isn't reproducible on x86-64 Linux.

EDIT: This is apparently fixed by changing the uwtable attribute argument to Sync.

@HertzDevil HertzDevil merged commit 0a5a25b into crystal-lang:feature/llvm-opaque-pointers Mar 9, 2023
@HertzDevil HertzDevil deleted the feature/llvm-15 branch March 9, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants