terralang / terra

Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.
terralang.org
Other
2.71k stars 197 forks source link

vecobj.t exposes Moonjit bugs on PPC64le #581

Open elliottslaughter opened 2 years ago

elliottslaughter commented 2 years ago

The vecobj.t test appears to expose multiple bugs in the Moonjit support for the C calling convention. I'm reasonably certain that these are Moonjit bugs rather than Terra bugs because we have extremely comprehensive tests against Clang, which Terra passes with flying colors.

  1. Callbacks: the printfloat callback into Lua ({float}->{}) results in a segfault.
  2. Calling a C/Terra function with a struct (containing arrays) results in garbage.

I'm going to patch the test to work around this since there isn't much we can do about Moonjit limitations.

elliottslaughter commented 2 years ago

The second of these two issues (disagreement in the calling convention for arrays) applies to AArch64 as well. Since I'm pretty sure we're doing this correctly (thanks to cconv_more.t and cconv_array.t) I'm going to apply the workaround here as well.