diff agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java @ 6782:5a98bf7d847b

6879063: SA should use hsdis for disassembly Summary: We should in SA to use hsdis for it like the JVM does to replace the current java based disassembler. Reviewed-by: twisti, jrose, sla Contributed-by: yumin.qi@oracle.com
author minqi
date Mon, 24 Sep 2012 12:44:00 -0700
parents c18cbe5936b8
children b9a9ed0f8eeb
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java	Thu Sep 20 03:49:15 2012 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java	Mon Sep 24 12:44:00 2012 -0700
@@ -25,14 +25,29 @@
 package sun.jvm.hotspot.runtime;
 
 import sun.jvm.hotspot.debugger.*;
+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) {
-    swap = !machDesc.isBigEndian();
+    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;
+      }
+    }
   }
 
   /** Should only swap if the hardware's underlying byte order is