Mercurial > hg > graal-compiler
annotate src/share/vm/services/attachListener.hpp @ 7951:8b46b0196eb0
8000692: Remove old KERNEL code
Summary: Removed depreciated kernel VM source code from hotspot VM
Reviewed-by: dholmes, acorn
author | zgu |
---|---|
date | Fri, 25 Jan 2013 10:04:08 -0500 |
parents | 9855b7e559ae |
children | 3c9bc17b9403 |
rev | line source |
---|---|
0 | 1 /* |
7951 | 2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_SERVICES_ATTACHLISTENER_HPP |
26 #define SHARE_VM_SERVICES_ATTACHLISTENER_HPP | |
27 | |
28 #include "memory/allocation.hpp" | |
29 #include "utilities/debug.hpp" | |
30 #include "utilities/ostream.hpp" | |
31 | |
0 | 32 // The AttachListener thread services a queue of operations that are enqueued |
33 // by client tools. Each operation is identified by a name and has up to 3 | |
34 // arguments. The operation name is mapped to a function which performs the | |
35 // operation. The function is called with an outputStream which is can use to | |
36 // write any result data (for examples the properties command serializes | |
37 // properties names and values to the output stream). When the function | |
38 // complets the result value and any result data is returned to the client | |
39 // tool. | |
40 | |
41 class AttachOperation; | |
42 | |
43 typedef jint (*AttachOperationFunction)(AttachOperation* op, outputStream* out); | |
44 | |
45 struct AttachOperationFunctionInfo { | |
46 const char* name; | |
47 AttachOperationFunction func; | |
48 }; | |
49 | |
50 class AttachListener: AllStatic { | |
51 public: | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
52 static void init() NOT_SERVICES_RETURN; |
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
53 static void abort() NOT_SERVICES_RETURN; |
0 | 54 |
55 // invoke to perform clean-up tasks when all clients detach | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
56 static void detachall() NOT_SERVICES_RETURN; |
0 | 57 |
58 // indicates if the Attach Listener needs to be created at startup | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
59 static bool init_at_startup() NOT_SERVICES_RETURN_(false); |
0 | 60 |
61 // indicates if we have a trigger to start the Attach Listener | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
62 static bool is_init_trigger() NOT_SERVICES_RETURN_(false); |
0 | 63 |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
64 #if !INCLUDE_SERVICES |
0 | 65 static bool is_attach_supported() { return false; } |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
66 #else |
0 | 67 private: |
68 static volatile bool _initialized; | |
69 | |
70 public: | |
71 static bool is_initialized() { return _initialized; } | |
72 static void set_initialized() { _initialized = true; } | |
73 | |
74 // indicates if this VM supports attach-on-demand | |
75 static bool is_attach_supported() { return !DisableAttachMechanism; } | |
76 | |
77 // platform specific initialization | |
78 static int pd_init(); | |
79 | |
80 // platform specific operation | |
81 static AttachOperationFunctionInfo* pd_find_operation(const char* name); | |
82 | |
83 // platform specific flag change | |
84 static jint pd_set_flag(AttachOperation* op, outputStream* out); | |
85 | |
86 // platform specific detachall | |
87 static void pd_detachall(); | |
88 | |
89 // platform specific data dump | |
90 static void pd_data_dump(); | |
91 | |
92 // dequeue the next operation | |
93 static AttachOperation* dequeue(); | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
94 #endif // !INCLUDE_SERVICES |
0 | 95 }; |
96 | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
97 #if INCLUDE_SERVICES |
6197 | 98 class AttachOperation: public CHeapObj<mtInternal> { |
0 | 99 public: |
100 enum { | |
101 name_length_max = 16, // maximum length of name | |
102 arg_length_max = 1024, // maximum length of argument | |
103 arg_count_max = 3 // maximum number of arguments | |
104 }; | |
105 | |
106 // name of special operation that can be enqueued when all | |
107 // clients detach | |
108 static char* detachall_operation_name() { return (char*)"detachall"; } | |
109 | |
110 private: | |
111 char _name[name_length_max+1]; | |
112 char _arg[arg_count_max][arg_length_max+1]; | |
113 | |
114 public: | |
115 const char* name() const { return _name; } | |
116 | |
117 // set the operation name | |
118 void set_name(char* name) { | |
119 assert(strlen(name) <= name_length_max, "exceeds maximum name length"); | |
120 strcpy(_name, name); | |
121 } | |
122 | |
123 // get an argument value | |
124 const char* arg(int i) const { | |
125 assert(i>=0 && i<arg_count_max, "invalid argument index"); | |
126 return _arg[i]; | |
127 } | |
128 | |
129 // set an argument value | |
130 void set_arg(int i, char* arg) { | |
131 assert(i>=0 && i<arg_count_max, "invalid argument index"); | |
132 if (arg == NULL) { | |
133 _arg[i][0] = '\0'; | |
134 } else { | |
135 assert(strlen(arg) <= arg_length_max, "exceeds maximum argument length"); | |
136 strcpy(_arg[i], arg); | |
137 } | |
138 } | |
139 | |
140 // create an operation of a given name | |
141 AttachOperation(char* name) { | |
142 set_name(name); | |
143 for (int i=0; i<arg_count_max; i++) { | |
144 set_arg(i, NULL); | |
145 } | |
146 } | |
147 | |
148 // complete operation by sending result code and any result data to the client | |
149 virtual void complete(jint result, bufferedStream* result_stream) = 0; | |
150 }; | |
6854
fb19af007ffc
7189254: Change makefiles for more flexibility to override defaults
jprovino
parents:
6197
diff
changeset
|
151 #endif // INCLUDE_SERVICES |
1972 | 152 |
153 #endif // SHARE_VM_SERVICES_ATTACHLISTENER_HPP |