Skip to content

Add ppc64 little-endian support for luajit2 - #77

Closed
siddhesh wants to merge 1 commit into
openresty:v2.1-agentzhfrom
siddhesh:siddhesh-luajit2-ppc64le
Closed

Add ppc64 little-endian support for luajit2#77
siddhesh wants to merge 1 commit into
openresty:v2.1-agentzhfrom
siddhesh:siddhesh-luajit2-ppc64le

Conversation

@siddhesh

Copy link
Copy Markdown
Collaborator

This set of patches adds ppc64le support for luajit2 with all known bugs fixed and stabilised in my LuaJIT tree.

@seth-priya

Copy link
Copy Markdown

do we have any outlook on getting to the review and/or merger of these changes? Thank you!!

@seth-priya

Copy link
Copy Markdown

can the community please help in reviewing these changes? thank you!

@dominic-nguyen

Copy link
Copy Markdown

@seth-priya All checks have passed but there there are 2 conflicting files:
src/host/buildvm_asm.c
src/lj_arch.h
Can you please help to take a look? Thanks.

@seth-priya

Copy link
Copy Markdown

@dominic-nguyen yes I will take a look at these ASAP

@seth-priya

Copy link
Copy Markdown

@dominic-nguyen conflict is handled now, code is sync'd to the latest, thanks!

@dominic-nguyen

Copy link
Copy Markdown

@seth-priya Great. Thanks.

@edmondsw edmondsw mentioned this pull request Apr 22, 2020
@agentzh

agentzh commented Apr 22, 2020

Copy link
Copy Markdown
Member

@siddhesh Does this branch passes all the tests in our openresty/luajit2-test-suite? Thanks! And sorry for the slow response.

@siddhesh

siddhesh commented Apr 23, 2020 via email

Copy link
Copy Markdown
Collaborator Author

@seth-priya

seth-priya commented Apr 23, 2020

Copy link
Copy Markdown

@agentzh @siddhesh thanks for your response!
Yes, I can confirm that all the tests from luajit2-test-suite passed, these are the console logs from the last execution when I bumped up this branch

./run-tests /usr/local/
=== test/ffi/ffi_arith_ptr.lua
=== test/ffi/ffi_bit64.lua
=== test/ffi/ffi_bitfield.lua
=== test/ffi/ffi_call.lua
=== test/ffi/ffi_callback.lua
=== test/ffi/ffi_const.lua
=== test/ffi/ffi_convert.lua
=== test/ffi/ffi_copy_fill.lua
=== test/ffi/ffi_enum.lua
=== test/ffi/ffi_err.lua
=== test/ffi/ffi_gcstep_recursive.lua
=== test/ffi/ffi_istype.lua
=== test/ffi/ffi_jit_arith.lua
=== test/ffi/ffi_jit_array.lua
=== test/ffi/ffi_jit_call.lua
=== test/ffi/ffi_jit_complex.lua
=== test/ffi/ffi_jit_conv.lua
=== test/ffi/ffi_jit_misc.lua
=== test/ffi/ffi_jit_struct.lua
=== test/ffi/ffi_lex_number.lua
=== test/ffi/ffi_meta_tostring.lua
=== test/ffi/ffi_metatype.lua
=== test/ffi/ffi_new.lua
=== test/ffi/ffi_nosink.lua
=== test/ffi/ffi_parse_array.lua
=== test/ffi/ffi_parse_basic.lua
=== test/ffi/ffi_parse_cdef.lua
=== test/ffi/ffi_parse_struct.lua
=== test/ffi/ffi_redir.lua
=== test/ffi/ffi_sink.lua
=== test/ffi/ffi_tabov.lua
=== test/ffi/ffi_type_punning.lua
=== test/ffi/unsink_64_kptr.lua
=== test/misc/ack.lua
Ack(3,1): 13
=== test/misc/ack_notail.lua
Ack(3,1): 13
=== test/misc/alias_alloc.lua
=== test/misc/api_call.lua
=== test/misc/argcheck.lua
=== test/misc/assign_tset_prevnil.lua
=== test/misc/assign_tset_tmp.lua
=== test/misc/bit_op.lua
=== test/misc/cat_jit.lua
=== test/misc/catch_wrap.lua
=== test/misc/compare.lua
=== test/misc/constov.lua
=== test/misc/coro_traceback.lua
=== test/misc/coro_yield.lua
=== test/misc/debug_gc.lua
=== test/misc/debug_meta.lua
=== test/misc/dse_array.lua
=== test/misc/dse_field.lua
=== test/misc/dualnum.lua
=== test/misc/exit_frame.lua
=== test/misc/exit_growstack.lua
=== test/misc/exit_jfuncf.lua
=== test/misc/fac.lua
1
=== test/misc/fastfib.lua
Fib(1): 1
=== test/misc/fib.lua
Fib(1): 1
=== test/misc/for_dir.lua
=== test/misc/fori_coerce.lua
=== test/misc/fuse.lua
=== test/misc/fwd_hrefk_rollback.lua
=== test/misc/fwd_tnew_tdup.lua
=== test/misc/fwd_upval.lua
=== test/misc/gc_rechain.lua
=== test/misc/gc_trace.lua
=== test/misc/gcstep.lua
=== test/misc/getfenv.lua
=== test/misc/goto.lua
=== test/misc/hook_active.lua
=== test/misc/hook_line.lua
=== test/misc/hook_norecord.lua
=== test/misc/hook_record.lua
=== test/misc/hook_top.lua
=== test/misc/iter.lua
=== test/misc/jit_flush.lua
=== test/misc/kfold.lua
=== test/misc/libfuncs.lua
=== test/misc/lightud.lua
=== test/misc/loop_unroll.lua
=== test/misc/math_random.lua
=== test/misc/meta_arith.lua
=== test/misc/meta_arith_jit.lua
=== test/misc/meta_call.lua
=== test/misc/meta_cat.lua
=== test/misc/meta_comp.lua
=== test/misc/meta_comp_jit.lua
=== test/misc/meta_eq.lua
=== test/misc/meta_eq_jit.lua
=== test/misc/meta_framegap.lua
=== test/misc/meta_getset.lua
=== test/misc/meta_len.lua
=== test/misc/meta_nomm.lua
=== test/misc/meta_pairs.lua
=== test/misc/meta_tget.lua
=== test/misc/meta_tget_nontab.lua
=== test/misc/meta_tset.lua
=== test/misc/meta_tset_nilget.lua
=== test/misc/meta_tset_resize.lua
=== test/misc/meta_tset_str.lua
=== test/misc/modulo.lua
=== test/misc/nsieve.lua
Primes up to 1 0
=== test/misc/parse_andor.lua
=== test/misc/parse_comp.lua
=== test/misc/parse_esc.lua
=== test/misc/parse_hex.lua
=== test/misc/parse_misc.lua
=== test/misc/pcall_jit.lua
=== test/misc/phi_conv.lua
=== test/misc/phi_copyspill.lua
=== test/misc/phi_ref.lua
=== test/misc/phi_rot18.lua
=== test/misc/phi_rot8.lua
=== test/misc/phi_rot9.lua
=== test/misc/phi_rotx.lua
=== test/misc/recsum.lua
=== test/misc/recsump.lua
=== test/misc/recurse_deep.lua
=== test/misc/recurse_tail.lua
=== test/misc/select.lua
=== test/misc/self.lua
=== test/misc/sink_alloc.lua
=== test/misc/sink_nosink.lua
=== test/misc/snap_gcexit.lua
=== test/misc/snap_top.lua
=== test/misc/snap_top2.lua
=== test/misc/sort.lua
=== test/misc/stack_gc.lua
=== test/misc/stack_purge.lua
=== test/misc/stackov.lua
=== test/misc/stackovc.lua
=== test/misc/stitch.lua
=== test/misc/strcmp.lua
=== test/misc/string_byte.lua
=== test/misc/string_char.lua
=== test/misc/string_dump.lua
=== test/misc/string_op.lua
=== test/misc/string_sub.lua
=== test/misc/string_sub_opt.lua
=== test/misc/table_chain_bug_LuaJIT_494.lua
=== test/misc/table_insert.lua
=== test/misc/table_misc.lua
=== test/misc/table_remove.lua
=== test/misc/tak.lua
2
=== test/misc/tcall_base.lua
=== test/misc/tcall_loop.lua
=== test/misc/tlen_loop.lua
=== test/misc/tnew_tdup.lua
=== test/misc/tonumber_scan.lua
=== test/misc/tonumber_tostring.lua
=== test/misc/uclo.lua
=== test/misc/unordered.lua
=== test/misc/unordered_jit.lua
=== test/misc/vararg_jit.lua
=== test/misc/wbarrier.lua
=== test/misc/wbarrier_jit.lua
=== test/misc/wbarrier_obar.lua
=== test/misc/xpcall_jit.lua
=== test/sysdep/catch_cpp.lua
=== test/sysdep/ffi_include_gtk.lua
=== test/sysdep/ffi_include_std.lua
=== test/sysdep/ffi_lib_c.lua
=== test/sysdep/ffi_lib_z.lua
=== test/unportable/math_special.lua
All tests successful.

@seth-priya

Copy link
Copy Markdown

and I will just re-confirm once more with the latest code and post here

@seth-priya

Copy link
Copy Markdown

luajit2-ppc64le-logs.txt
all good ...

@agentzh

agentzh commented Apr 28, 2020

Copy link
Copy Markdown
Member

Awesome! @siddhesh Please squash, rebase and merge to the v2.1-agentzh branch yourself. Thank you!

 Create a patch for PPC64 support based on
LuaJIT/LuaJIT#140.
https://bugzilla.redhat.com/show_bug.cgi?id=1591701
 This patch has been rebased to match FPU support

Author: Guy Menanteau <menantea@fr.ibm.com>

Signed-Off-By: Marcin Kościelnicki <koriakin@0x04.net
Signed-Off-By: Siddhesh Poyarekar <siddhesh@gotplt.org>

[ppc] Fix access beyond list in ipairs

The load into TMP2 was incorrectly put into ENDIAN_LE, which made the
subsequent check invalid.

[ppc] Fix typo

[ppc]  Load BASEP4 as much as possible

BASEP4 doesn't seem to get initialized all the time, especially when
BASE is updated because of which programs can crash at random on
ppc32.  Err on the conservative side and set BASEP4 every time BASE_LO
(or BASE_HI for LE) are accessed.

This eventually needs to be tuned optimally.

[ppc] Revert LE code for assert

[ppc] Fix off by one in assert

It ended up reading the first argument twice.

Fix BC_POW on ppc64le
@seth-priya

Copy link
Copy Markdown

@siddhesh - rebased and squashed, build and all tests pass on ppc64le
build-test-4-29-2020.txt

please review and let me know if anything else is needed, thank you!!

@siddhesh

siddhesh commented Apr 29, 2020 via email

Copy link
Copy Markdown
Collaborator Author

@siddhesh

siddhesh commented May 3, 2020

Copy link
Copy Markdown
Collaborator Author

Pushed manually as 2763a42

@siddhesh siddhesh closed this May 3, 2020
@BKPepe

BKPepe commented Aug 15, 2026

Copy link
Copy Markdown

The PPC64 work that landed here as 2763a42 introduced two bugs in the soft-float PPC interpreter, which only show up on 32-bit big-endian soft-float targets such as NXP e500v2. ipairs() returns the itype instead of the value and pairs() yields a spurious (nil, nil) over tables with an empty hash part.

Both are fixed in #270. Details and reproducers are in that PR. Flagging it here since this is where the change was discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants