From 8c235999446dfb8810c2a1b6a046452b392c2617 Mon Sep 17 00:00:00 2001 From: minqi Date: Fri, 19 Oct 2012 08:58:14 -0700 Subject: [PATCH] 8001055: Bytes.swap should follow big endian Summary: This is a mistake change in 6879063 about Bytes.swap. Java byte code order always follows big endian, but in that change, assume they follow native platform order that is not right. Reviewed-by: coleenp, sspitsyn, dholmes Contributed-by: yumin.qi@oracle.com --- .../classes/sun/jvm/hotspot/runtime/Bytes.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java index a8df44184..b0cc278b8 100644 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java @@ -30,24 +30,10 @@ import sun.jvm.hotspot.utilities.PlatformInfo; /** Encapsulates some byte-swapping operations defined in the VM */ public class Bytes { - // swap if client platform is different from server's. private boolean swap; public Bytes(MachineDescription machDesc) { - String cpu = PlatformInfo.getCPU(); - if (cpu.equals("sparc")) { - if (machDesc.isBigEndian()) { - swap = false; - } else { - swap = true; - } - } else { // intel - if (machDesc.isBigEndian()) { - swap = true; - } else { - swap = false; - } - } + swap = !machDesc.isBigEndian(); } /** Should only swap if the hardware's underlying byte order is -- GitLab