moonjit / moonjit

Just-In-Time Compiler for the Lua Programming language. Fork of LuaJIT to continue development. This project does not have an active maintainer, see https://twitter.com/siddhesh_p/status/1308594269502885889?s=20 for more detail.
Other
510 stars 28 forks source link

a bug running moonjit on ppc64(big-endian) #99

Closed piaoxuebingfeng closed 2 years ago

piaoxuebingfeng commented 4 years ago

hi, i found a bug when i was running moonjit on ppc64(big-endian),who can help me ?

moonjit 2.2.0 -- Copyright (C) 2019-2020 moonjit developers. https://github.com/moonjit/moonjit JIT: OFF

a=2 =a 2 a=a+1 =a 2

siddhesh commented 4 years ago

Sorry for the delay in looking into this; can you please share more details about your build environment, etc? Also, does make check succeed with your build?

@seth-priya can you please take a look at this?

seth-priya commented 4 years ago

@siddhesh Issue seems to be reported for Big Endian, but will nevertheless check to see if it happens on LE as well

amitsadaphule commented 4 years ago

@siddhesh I tried the expressions mentioned by @piaoxuebingfeng with 2.2.0 tag as well as master (2.3.0-dev). The issue is not reproducible on either of those. The following result is seen with both:

[root@fe21f2de02ce moonjit]# ./src/luajit
moonjit 2.2.0 -- Copyright (C) 2019-2020 moonjit developers. https://github.com/moonjit/moonjit
JIT: OFF
> a=2
> =a
2
> a=a+1
> =a
3
siddhesh commented 4 years ago

Thanks, let's wait for the reporter to respond with more details in case they're still seeing this issue.

MaryWan1982 commented 3 years ago

@siddhesh

case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: |.if GPR64 |.macro addo32., y, a, b | // Need to check overflow for (a<<32) + (b<<32). | rldicr TMP0, a, 32, 31 | rldicr TMP3, b, 32, 31 -modified to----> rldicr TMP1, b, 32, 31 | addo. TMP0, TMP0, TMP3 -modified to----> addo. TMP0, TMP0, TMP1 | add y, a, b |.endmacro | ins_arith addo32., fadd, __adddf3 |.else | ins_arith addo., fadd, __adddf3 |.endif break;

TMP3 -----r6 CARG4 ----r6 // Overlaps TMP3.

0x00003fffb108f498: rldicr r0,r4,32,31 0x00003fffb108f49c: rldicr r6,r6,32,31 ------TMP3 cover GARG4 0x00003fffb108f4a0: addo. r0,r0,r6 0x00003fffb108f4a4: add r3,r4,r6 ------add result is wrong. => 0x00003fffb108f4a8: bso 0x3fffb1091bb0 0x00003fffb108f4ac: lwz r7,0(r16)

The same as: case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: image