author | minqi |
Mon, 24 Sep 2012 12:44:00 -0700 | |
changeset 13873 | 7b72e3873785 |
parent 10565 | dc90c239f4ec |
child 13897 | 4d2ca6fb1285 |
permissions | -rw-r--r-- |
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
1 |
/* |
13873 | 2 |
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. |
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
4 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
8 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
13 |
* accompanied this code). |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
14 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
18 |
* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
347
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
347
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
347
diff
changeset
|
21 |
* questions. |
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
22 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
23 |
*/ |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
24 |
|
7397 | 25 |
#ifndef SHARE_VM_COMPILER_DISASSEMBLER_HPP |
26 |
#define SHARE_VM_COMPILER_DISASSEMBLER_HPP |
|
27 |
||
28 |
#include "runtime/globals.hpp" |
|
29 |
#ifdef TARGET_OS_FAMILY_linux |
|
30 |
# include "os_linux.inline.hpp" |
|
31 |
#endif |
|
32 |
#ifdef TARGET_OS_FAMILY_solaris |
|
33 |
# include "os_solaris.inline.hpp" |
|
34 |
#endif |
|
35 |
#ifdef TARGET_OS_FAMILY_windows |
|
36 |
# include "os_windows.inline.hpp" |
|
37 |
#endif |
|
10565 | 38 |
#ifdef TARGET_OS_FAMILY_bsd |
39 |
# include "os_bsd.inline.hpp" |
|
40 |
#endif |
|
7397 | 41 |
|
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
42 |
class decode_env; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
43 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
44 |
// The disassembler prints out assembly code annotated |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
45 |
// with Java specific information. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
46 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
47 |
class Disassembler { |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
48 |
friend class decode_env; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
49 |
private: |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
50 |
// this is the type of the dll entry point: |
13873 | 51 |
typedef void* (*decode_func)(uintptr_t start_va, uintptr_t end_va, |
52 |
unsigned char* buffer, uintptr_t length, |
|
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
53 |
void* (*event_callback)(void*, const char*, void*), |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
54 |
void* event_stream, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
55 |
int (*printf_callback)(void*, const char*, ...), |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
56 |
void* printf_stream, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
57 |
const char* options); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
58 |
// points to the library. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
59 |
static void* _library; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
60 |
// bailout |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
61 |
static bool _tried_to_load_library; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
62 |
// points to the decode function. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
63 |
static decode_func _decode_instructions; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
64 |
// tries to load library and return whether it succedded. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
65 |
static bool load_library(); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
66 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
67 |
// Machine dependent stuff |
7397 | 68 |
#ifdef TARGET_ARCH_x86 |
69 |
# include "disassembler_x86.hpp" |
|
70 |
#endif |
|
71 |
#ifdef TARGET_ARCH_sparc |
|
72 |
# include "disassembler_sparc.hpp" |
|
73 |
#endif |
|
74 |
#ifdef TARGET_ARCH_zero |
|
75 |
# include "disassembler_zero.hpp" |
|
76 |
#endif |
|
8107
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
77 |
#ifdef TARGET_ARCH_arm |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
78 |
# include "disassembler_arm.hpp" |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
79 |
#endif |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
80 |
#ifdef TARGET_ARCH_ppc |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
81 |
# include "disassembler_ppc.hpp" |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
82 |
#endif |
7397 | 83 |
|
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
84 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
85 |
public: |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
86 |
static bool can_decode() { |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
87 |
return (_decode_instructions != NULL) || load_library(); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
88 |
} |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
89 |
static void decode(CodeBlob *cb, outputStream* st = NULL); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
90 |
static void decode(nmethod* nm, outputStream* st = NULL); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
91 |
static void decode(address begin, address end, outputStream* st = NULL); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
92 |
}; |
7397 | 93 |
|
94 |
#endif // SHARE_VM_COMPILER_DISASSEMBLER_HPP |