57 this.startPc = startPc;
58 this.code = code;
59
60 // Lazily load hsdis
61 if (decode_function == 0) {
62 StringBuilder path = new StringBuilder(System.getProperty("java.home"));
63 String sep = System.getProperty("file.separator");
64 String os = System.getProperty("os.name");
65 String libname = "hsdis";
66 String arch = System.getProperty("os.arch");
67 if (os.lastIndexOf("Windows", 0) != -1) {
68 if (arch.equals("x86")) {
69 libname += "-i386";
70 } else if (arch.equals("amd64")) {
71 libname += "-amd64";
72 } else {
73 libname += "-" + arch;
74 }
75 path.append(sep + "bin" + sep);
76 libname += ".dll";
77 } else if (os.lastIndexOf("SunOS", 0) != -1) {
78 if (arch.equals("x86") || arch.equals("i386")) {
79 path.append(sep + "lib" + sep + "i386" + sep);
80 libname += "-i386" + ".so";
81 } else if (arch.equals("amd64")) {
82 path.append(sep + "lib" + sep + "amd64" + sep);
83 libname += "-amd64" + ".so";
84 } else {
85 path.append(sep + "lib" + sep + arch + sep);
86 libname += "-" + arch + ".so";
87 }
88 } else if (os.lastIndexOf("Linux", 0) != -1) {
89 if (arch.equals("x86") || arch.equals("i386")) {
90 path.append(sep + "lib" + sep + "i386" + sep);
91 libname += "-i386.so";
92 } else if (arch.equals("amd64") || arch.equals("x86_64")) {
93 path.append(sep + "lib" + sep + "amd64" + sep);
94 libname += "-amd64.so";
95 } else {
96 path.append(sep + "lib" + sep + arch + sep);
97 libname += "-" + arch + ".so";
98 }
99 } else if (os.lastIndexOf("Mac OS X", 0) != -1) {
100 path.append(sep + "lib" + sep);
101 libname += "-amd64" + ".dylib"; // x86_64 => amd64
102 } else {
103 path.append(sep + "lib" + sep + "arch" + sep);
104 libname += "-" + arch + ".so";
105 }
106 decode_function = load_library(path.toString(), libname);
107 }
|
57 this.startPc = startPc;
58 this.code = code;
59
60 // Lazily load hsdis
61 if (decode_function == 0) {
62 StringBuilder path = new StringBuilder(System.getProperty("java.home"));
63 String sep = System.getProperty("file.separator");
64 String os = System.getProperty("os.name");
65 String libname = "hsdis";
66 String arch = System.getProperty("os.arch");
67 if (os.lastIndexOf("Windows", 0) != -1) {
68 if (arch.equals("x86")) {
69 libname += "-i386";
70 } else if (arch.equals("amd64")) {
71 libname += "-amd64";
72 } else {
73 libname += "-" + arch;
74 }
75 path.append(sep + "bin" + sep);
76 libname += ".dll";
77 } else if (os.lastIndexOf("Linux", 0) != -1) {
78 if (arch.equals("x86") || arch.equals("i386")) {
79 path.append(sep + "lib" + sep + "i386" + sep);
80 libname += "-i386.so";
81 } else if (arch.equals("amd64") || arch.equals("x86_64")) {
82 path.append(sep + "lib" + sep + "amd64" + sep);
83 libname += "-amd64.so";
84 } else {
85 path.append(sep + "lib" + sep + arch + sep);
86 libname += "-" + arch + ".so";
87 }
88 } else if (os.lastIndexOf("Mac OS X", 0) != -1) {
89 path.append(sep + "lib" + sep);
90 libname += "-amd64" + ".dylib"; // x86_64 => amd64
91 } else {
92 path.append(sep + "lib" + sep + "arch" + sep);
93 libname += "-" + arch + ".so";
94 }
95 decode_function = load_library(path.toString(), libname);
96 }
|