From bbfca4c3fc551b2a6b63fba7978747dda4405514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trung=20L=C3=AA?= <8@tle.id.au> Date: Mon, 30 Nov 2026 10:08:17 +1100 Subject: [PATCH 1/3] ZJIT: Build inline string words in native byte order gen_string_copy packs the bytes of a short string into u64 words and stores each word into the new string with a 64-bit store. The words were built with from_le_bytes, so on a big-endian host every 8 bytes of the copy came out reversed. Use from_ne_bytes so the stored word has the same bytes in memory as the source. Nothing changes on little-endian hosts. --- zjit/src/codegen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zjit/src/codegen.rs b/zjit/src/codegen.rs index 4ceab8db30..b229c4fb53 100644 --- a/zjit/src/codegen.rs +++ b/zjit/src/codegen.rs @@ -2304,7 +2304,7 @@ fn gen_string_copy(jit: &mut JITState, asm: &mut Assembler, function: &Function, |asm, obj| { asm.store(Opnd::mem(VALUE_BITS, obj, RUBY_OFFSET_RSTRING_LEN), Opnd::Imm(len)); for (i, chunk) in string_bytes.chunks_exact(8).enumerate() { - let word = u64::from_le_bytes(chunk.try_into().unwrap()); + let word = u64::from_ne_bytes(chunk.try_into().unwrap()); let offset = RUBY_OFFSET_RSTRING_AS_ARY + (i as i32) * 8; asm.store(Opnd::mem(64, obj, offset), Opnd::UImm(word)); } -- 2.50.1 (Apple Git-155)