comparison 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
comparison
equal deleted inserted replaced
6780:8440414b0fd8 6782:5a98bf7d847b
23 */ 23 */
24 24
25 package sun.jvm.hotspot.runtime; 25 package sun.jvm.hotspot.runtime;
26 26
27 import sun.jvm.hotspot.debugger.*; 27 import sun.jvm.hotspot.debugger.*;
28 import sun.jvm.hotspot.utilities.PlatformInfo;
28 29
29 /** Encapsulates some byte-swapping operations defined in the VM */ 30 /** Encapsulates some byte-swapping operations defined in the VM */
30 31
31 public class Bytes { 32 public class Bytes {
33 // swap if client platform is different from server's.
32 private boolean swap; 34 private boolean swap;
33 35
34 public Bytes(MachineDescription machDesc) { 36 public Bytes(MachineDescription machDesc) {
35 swap = !machDesc.isBigEndian(); 37 String cpu = PlatformInfo.getCPU();
38 if (cpu.equals("sparc")) {
39 if (machDesc.isBigEndian()) {
40 swap = false;
41 } else {
42 swap = true;
43 }
44 } else { // intel
45 if (machDesc.isBigEndian()) {
46 swap = true;
47 } else {
48 swap = false;
49 }
50 }
36 } 51 }
37 52
38 /** Should only swap if the hardware's underlying byte order is 53 /** Should only swap if the hardware's underlying byte order is
39 different from Java's */ 54 different from Java's */
40 public short swapShort(short x) { 55 public short swapShort(short x) {