annotate src/share/vm/prims/hpi_imported.h @ 2011:dad31fc330cd

7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute Reviewed-by: twisti
author jrose
date Fri, 03 Dec 2010 15:53:57 -0800
parents f95d63e2154a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
26 * HotSpot integration note:
a61af66fc99e Initial load
duke
parents:
diff changeset
27 *
a61af66fc99e Initial load
duke
parents:
diff changeset
28 * This is a consolidation of these two files:
a61af66fc99e Initial load
duke
parents:
diff changeset
29 * src/share/hpi/export/hpi.h 1.15 99/06/18 JDK1.3 beta build I
a61af66fc99e Initial load
duke
parents:
diff changeset
30 * src/share/hpi/export/dll.h 1.3 98/09/15 JDK1.3 beta build I
a61af66fc99e Initial load
duke
parents:
diff changeset
31 * from the classic VM.
a61af66fc99e Initial load
duke
parents:
diff changeset
32 *
a61af66fc99e Initial load
duke
parents:
diff changeset
33 * bool_t is a type in the classic VM, and we define it here,
a61af66fc99e Initial load
duke
parents:
diff changeset
34 * but in the future this should be a jboolean.
a61af66fc99e Initial load
duke
parents:
diff changeset
35 *
a61af66fc99e Initial load
duke
parents:
diff changeset
36 * The files are included verbatim expect for local includes removed from hpi.h.
a61af66fc99e Initial load
duke
parents:
diff changeset
37 */
a61af66fc99e Initial load
duke
parents:
diff changeset
38
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
39 #ifndef SHARE_VM_PRIMS_HPI_IMPORTED_H
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
40 #define SHARE_VM_PRIMS_HPI_IMPORTED_H
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
41
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
42 #include "jni.h"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 #ifdef __cplusplus
a61af66fc99e Initial load
duke
parents:
diff changeset
45 extern "C" {
a61af66fc99e Initial load
duke
parents:
diff changeset
46 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 /* A classic VMism that should become a jboolean. Fix in 1.2.1? */
a61af66fc99e Initial load
duke
parents:
diff changeset
49 typedef enum { HPI_FALSE = 0, HPI_TRUE = 1 } bool_t;
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
52 * DLL.H: A common interface for helper DLLs loaded by the VM.
a61af66fc99e Initial load
duke
parents:
diff changeset
53 * Each library exports the main entry point "DLL_Initialize". Through
a61af66fc99e Initial load
duke
parents:
diff changeset
54 * that function the programmer can obtain a function pointer which has
a61af66fc99e Initial load
duke
parents:
diff changeset
55 * type "GetInterfaceFunc." Through the function pointer the programmer
a61af66fc99e Initial load
duke
parents:
diff changeset
56 * can obtain other interfaces supported in the DLL.
a61af66fc99e Initial load
duke
parents:
diff changeset
57 */
a61af66fc99e Initial load
duke
parents:
diff changeset
58 typedef jint (JNICALL * GetInterfaceFunc)
a61af66fc99e Initial load
duke
parents:
diff changeset
59 (void **intfP, const char *name, jint ver);
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 jint JNICALL DLL_Initialize(GetInterfaceFunc *, void *args);
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
65 * Host Porting Interface. This defines the "porting layer" for
a61af66fc99e Initial load
duke
parents:
diff changeset
66 * POSIX.1 compliant operating systems.
a61af66fc99e Initial load
duke
parents:
diff changeset
67 */
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
70 * memory allocations
a61af66fc99e Initial load
duke
parents:
diff changeset
71 */
a61af66fc99e Initial load
duke
parents:
diff changeset
72 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
74 * Malloc must return a unique pointer if size == 0.
a61af66fc99e Initial load
duke
parents:
diff changeset
75 */
a61af66fc99e Initial load
duke
parents:
diff changeset
76 void * (*Malloc)(size_t size);
a61af66fc99e Initial load
duke
parents:
diff changeset
77 void * (*Realloc)(void *ptr, size_t new_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
79 * Free must allow ptr == NULL to be a no-op.
a61af66fc99e Initial load
duke
parents:
diff changeset
80 */
a61af66fc99e Initial load
duke
parents:
diff changeset
81 void (*Free)(void *ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
83 * Calloc must return a unique pointer for if
a61af66fc99e Initial load
duke
parents:
diff changeset
84 * n_item == 0 || item_size == 0.
a61af66fc99e Initial load
duke
parents:
diff changeset
85 */
a61af66fc99e Initial load
duke
parents:
diff changeset
86 void * (*Calloc)(size_t n_item, size_t item_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 char * (*Strdup)(const char *str);
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void * (*MapMem)(size_t req_size, size_t *maped_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 void * (*UnmapMem)(void *req_addr, size_t req_size, size_t *unmap_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
91 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
92 * CommitMem should round the ptr down to the nearest page and
a61af66fc99e Initial load
duke
parents:
diff changeset
93 * round the size up to the nearest page so that the committed
a61af66fc99e Initial load
duke
parents:
diff changeset
94 * region is at least as large as the requested region.
a61af66fc99e Initial load
duke
parents:
diff changeset
95 */
a61af66fc99e Initial load
duke
parents:
diff changeset
96 void * (*CommitMem)(void *ptr, size_t size, size_t *actual);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
98 * sysDecommitMem should round the ptr up to the nearest page and
a61af66fc99e Initial load
duke
parents:
diff changeset
99 * round the size down to the nearest page so that the decommitted
a61af66fc99e Initial load
duke
parents:
diff changeset
100 * region is no greater than the requested region.
a61af66fc99e Initial load
duke
parents:
diff changeset
101 */
a61af66fc99e Initial load
duke
parents:
diff changeset
102 void * (*DecommitMem)(void *ptr, size_t size, size_t *actual);
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 #define HPI_PAGE_ALIGNMENT (64 * 1024)
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 void * (*AllocBlock)(size_t size, void **headP);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void (*FreeBlock)(void *head);
a61af66fc99e Initial load
duke
parents:
diff changeset
108 } HPI_MemoryInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
111 * dynamic linking libraries
a61af66fc99e Initial load
duke
parents:
diff changeset
112 */
a61af66fc99e Initial load
duke
parents:
diff changeset
113 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 void (*BuildLibName)(char *buf, int buf_len, char *path, const char *name);
a61af66fc99e Initial load
duke
parents:
diff changeset
115 int (*BuildFunName)(char *name, int name_len, int arg_size, int en_idx);
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 void * (*LoadLibrary)(const char *name, char *err_buf, int err_buflen);
a61af66fc99e Initial load
duke
parents:
diff changeset
118 void (*UnloadLibrary)(void *lib);
a61af66fc99e Initial load
duke
parents:
diff changeset
119 void * (*FindLibraryEntry)(void *lib, const char *name);
a61af66fc99e Initial load
duke
parents:
diff changeset
120 } HPI_LibraryInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 typedef void (*signal_handler_t)(int sig, void *siginfo, void *context);
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 #define HPI_SIG_DFL (signal_handler_t)0
a61af66fc99e Initial load
duke
parents:
diff changeset
125 #define HPI_SIG_ERR (signal_handler_t)-1
a61af66fc99e Initial load
duke
parents:
diff changeset
126 #define HPI_SIG_IGN (signal_handler_t)1
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
129 char *name; /* name such as green/native threads. */
a61af66fc99e Initial load
duke
parents:
diff changeset
130 int isMP;
a61af66fc99e Initial load
duke
parents:
diff changeset
131 } HPI_SysInfo;
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
134 HPI_SysInfo * (*GetSysInfo)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
135 long (*GetMilliTicks)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
136 jlong (*TimeMillis)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 signal_handler_t (*Signal)(int sig, signal_handler_t handler);
a61af66fc99e Initial load
duke
parents:
diff changeset
139 void (*Raise)(int sig);
a61af66fc99e Initial load
duke
parents:
diff changeset
140 void (*SignalNotify)(int sig);
a61af66fc99e Initial load
duke
parents:
diff changeset
141 int (*SignalWait)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 int (*Shutdown)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 int (*SetLoggingLevel)(int level);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 bool_t (*SetMonitoringOn)(bool_t on);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 int (*GetLastErrorString)(char *buf, int len);
a61af66fc99e Initial load
duke
parents:
diff changeset
148 } HPI_SystemInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
151 * threads and monitors
a61af66fc99e Initial load
duke
parents:
diff changeset
152 */
a61af66fc99e Initial load
duke
parents:
diff changeset
153 typedef struct sys_thread sys_thread_t;
a61af66fc99e Initial load
duke
parents:
diff changeset
154 typedef struct sys_mon sys_mon_t;
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156 #define HPI_OK 0
a61af66fc99e Initial load
duke
parents:
diff changeset
157 #define HPI_ERR -1
a61af66fc99e Initial load
duke
parents:
diff changeset
158 #define HPI_INTRPT -2 /* Operation was interrupted */
a61af66fc99e Initial load
duke
parents:
diff changeset
159 #define HPI_TIMEOUT -3 /* A timer ran out */
a61af66fc99e Initial load
duke
parents:
diff changeset
160 #define HPI_NOMEM -5 /* Ran out of memory */
a61af66fc99e Initial load
duke
parents:
diff changeset
161 #define HPI_NORESOURCE -6 /* Ran out of some system resource */
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 /* There are three basic states: RUNNABLE, MONITOR_WAIT, and CONDVAR_WAIT.
a61af66fc99e Initial load
duke
parents:
diff changeset
164 * When the thread is suspended in any of these states, the
a61af66fc99e Initial load
duke
parents:
diff changeset
165 * HPI_THREAD_SUSPENDED bit will be set
a61af66fc99e Initial load
duke
parents:
diff changeset
166 */
a61af66fc99e Initial load
duke
parents:
diff changeset
167 enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 HPI_THREAD_RUNNABLE = 1,
a61af66fc99e Initial load
duke
parents:
diff changeset
169 HPI_THREAD_MONITOR_WAIT,
a61af66fc99e Initial load
duke
parents:
diff changeset
170 HPI_THREAD_CONDVAR_WAIT
a61af66fc99e Initial load
duke
parents:
diff changeset
171 };
a61af66fc99e Initial load
duke
parents:
diff changeset
172
a61af66fc99e Initial load
duke
parents:
diff changeset
173 #define HPI_MINIMUM_PRIORITY 1
a61af66fc99e Initial load
duke
parents:
diff changeset
174 #define HPI_MAXIMUM_PRIORITY 10
a61af66fc99e Initial load
duke
parents:
diff changeset
175 #define HPI_NORMAL_PRIORITY 5
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 #define HPI_THREAD_SUSPENDED 0x8000
a61af66fc99e Initial load
duke
parents:
diff changeset
178 #define HPI_THREAD_INTERRUPTED 0x4000
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
181 sys_thread_t *owner;
a61af66fc99e Initial load
duke
parents:
diff changeset
182 int entry_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 sys_thread_t **monitor_waiters;
a61af66fc99e Initial load
duke
parents:
diff changeset
184 sys_thread_t **condvar_waiters;
a61af66fc99e Initial load
duke
parents:
diff changeset
185 int sz_monitor_waiters;
a61af66fc99e Initial load
duke
parents:
diff changeset
186 int sz_condvar_waiters;
a61af66fc99e Initial load
duke
parents:
diff changeset
187 int n_monitor_waiters;
a61af66fc99e Initial load
duke
parents:
diff changeset
188 int n_condvar_waiters;
a61af66fc99e Initial load
duke
parents:
diff changeset
189 } sys_mon_info;
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
192 int (*ThreadBootstrap)(sys_thread_t **tidP,
a61af66fc99e Initial load
duke
parents:
diff changeset
193 sys_mon_t **qlockP,
a61af66fc99e Initial load
duke
parents:
diff changeset
194 int nReservedBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
195 int (*ThreadCreate)(sys_thread_t **tidP,
a61af66fc99e Initial load
duke
parents:
diff changeset
196 long stk_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
197 void (*func)(void *),
a61af66fc99e Initial load
duke
parents:
diff changeset
198 void *arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
199 sys_thread_t * (*ThreadSelf)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
200 void (*ThreadYield)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
201 int (*ThreadSuspend)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
202 int (*ThreadResume)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
203 int (*ThreadSetPriority)(sys_thread_t *tid, int prio);
a61af66fc99e Initial load
duke
parents:
diff changeset
204 int (*ThreadGetPriority)(sys_thread_t *tid, int *prio);
a61af66fc99e Initial load
duke
parents:
diff changeset
205 void * (*ThreadStackPointer)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
206 void * (*ThreadStackTop)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
207 long * (*ThreadRegs)(sys_thread_t *tid, int *regs);
a61af66fc99e Initial load
duke
parents:
diff changeset
208 int (*ThreadSingle)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
209 void (*ThreadMulti)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
210 int (*ThreadEnumerateOver)(int (*func)(sys_thread_t *, void *),
a61af66fc99e Initial load
duke
parents:
diff changeset
211 void *arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
212 int (*ThreadCheckStack)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
213 void (*ThreadPostException)(sys_thread_t *tid, void *arg);
a61af66fc99e Initial load
duke
parents:
diff changeset
214 void (*ThreadInterrupt)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
215 int (*ThreadIsInterrupted)(sys_thread_t *tid, int clear);
a61af66fc99e Initial load
duke
parents:
diff changeset
216 int (*ThreadAlloc)(sys_thread_t **tidP);
a61af66fc99e Initial load
duke
parents:
diff changeset
217 int (*ThreadFree)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
218 jlong (*ThreadCPUTime)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
219 int (*ThreadGetStatus)(sys_thread_t *tid, sys_mon_t **monitor);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 void * (*ThreadInterruptEvent)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
221 void * (*ThreadNativeID)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 /* These three functions are used by the CPU time profiler.
a61af66fc99e Initial load
duke
parents:
diff changeset
224 * sysThreadIsRunning determines whether the thread is running (not just
a61af66fc99e Initial load
duke
parents:
diff changeset
225 * runnable). It is only safe to call this function after calling
a61af66fc99e Initial load
duke
parents:
diff changeset
226 * sysThreadProfSuspend.
a61af66fc99e Initial load
duke
parents:
diff changeset
227 */
a61af66fc99e Initial load
duke
parents:
diff changeset
228 bool_t (*ThreadIsRunning)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
229 void (*ThreadProfSuspend)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
230 void (*ThreadProfResume)(sys_thread_t *tid);
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 int (*AdjustTimeSlice)(int ms);
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 size_t (*MonitorSizeof)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
235 int (*MonitorInit)(sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
236 int (*MonitorDestroy)(sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
237 int (*MonitorEnter)(sys_thread_t *self, sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
238 bool_t (*MonitorEntered)(sys_thread_t *self, sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
239 int (*MonitorExit)(sys_thread_t *self, sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
240 int (*MonitorNotify)(sys_thread_t *self, sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
241 int (*MonitorNotifyAll)(sys_thread_t *self, sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
242 int (*MonitorWait)(sys_thread_t *self, sys_mon_t *mid, jlong ms);
a61af66fc99e Initial load
duke
parents:
diff changeset
243 bool_t (*MonitorInUse)(sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
244 sys_thread_t * (*MonitorOwner)(sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
245 int (*MonitorGetInfo)(sys_mon_t *mid, sys_mon_info *info);
a61af66fc99e Initial load
duke
parents:
diff changeset
246
a61af66fc99e Initial load
duke
parents:
diff changeset
247 } HPI_ThreadInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
250 * files
a61af66fc99e Initial load
duke
parents:
diff changeset
251 */
a61af66fc99e Initial load
duke
parents:
diff changeset
252
a61af66fc99e Initial load
duke
parents:
diff changeset
253 #define HPI_FILETYPE_REGULAR (0)
a61af66fc99e Initial load
duke
parents:
diff changeset
254 #define HPI_FILETYPE_DIRECTORY (1)
a61af66fc99e Initial load
duke
parents:
diff changeset
255 #define HPI_FILETYPE_OTHER (2)
a61af66fc99e Initial load
duke
parents:
diff changeset
256
a61af66fc99e Initial load
duke
parents:
diff changeset
257 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
258 char * (*NativePath)(char *path);
a61af66fc99e Initial load
duke
parents:
diff changeset
259 int (*FileType)(const char *path);
a61af66fc99e Initial load
duke
parents:
diff changeset
260 int (*Open)(const char *name, int openMode, int filePerm);
a61af66fc99e Initial load
duke
parents:
diff changeset
261 int (*Close)(int fd);
a61af66fc99e Initial load
duke
parents:
diff changeset
262 jlong (*Seek)(int fd, jlong offset, int whence);
a61af66fc99e Initial load
duke
parents:
diff changeset
263 int (*SetLength)(int fd, jlong length);
a61af66fc99e Initial load
duke
parents:
diff changeset
264 int (*Sync)(int fd);
a61af66fc99e Initial load
duke
parents:
diff changeset
265 int (*Available)(int fd, jlong *bytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
266 size_t (*Read)(int fd, void *buf, unsigned int nBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
267 size_t (*Write)(int fd, const void *buf, unsigned int nBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
268 int (*FileSizeFD)(int fd, jlong *size);
a61af66fc99e Initial load
duke
parents:
diff changeset
269 } HPI_FileInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
270
a61af66fc99e Initial load
duke
parents:
diff changeset
271 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
272 * sockets
a61af66fc99e Initial load
duke
parents:
diff changeset
273 */
a61af66fc99e Initial load
duke
parents:
diff changeset
274 struct sockaddr;
a61af66fc99e Initial load
duke
parents:
diff changeset
275 struct hostent;
a61af66fc99e Initial load
duke
parents:
diff changeset
276
a61af66fc99e Initial load
duke
parents:
diff changeset
277 typedef struct {
a61af66fc99e Initial load
duke
parents:
diff changeset
278 int (*Close)(int fd);
a61af66fc99e Initial load
duke
parents:
diff changeset
279 long (*Available)(int fd, jint *pbytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
280 int (*Connect)(int fd, struct sockaddr *him, int len);
a61af66fc99e Initial load
duke
parents:
diff changeset
281 int (*Accept)(int fd, struct sockaddr *him, int *len);
a61af66fc99e Initial load
duke
parents:
diff changeset
282 int (*SendTo)(int fd, char *buf, int len, int flags,
a61af66fc99e Initial load
duke
parents:
diff changeset
283 struct sockaddr *to, int tolen);
a61af66fc99e Initial load
duke
parents:
diff changeset
284 int (*RecvFrom)(int fd, char *buf, int nbytes, int flags,
a61af66fc99e Initial load
duke
parents:
diff changeset
285 struct sockaddr *from, int *fromlen);
a61af66fc99e Initial load
duke
parents:
diff changeset
286 int (*Listen)(int fd, long count);
a61af66fc99e Initial load
duke
parents:
diff changeset
287 int (*Recv)(int fd, char *buf, int nBytes, int flags);
a61af66fc99e Initial load
duke
parents:
diff changeset
288 int (*Send)(int fd, char *buf, int nBytes, int flags);
a61af66fc99e Initial load
duke
parents:
diff changeset
289 int (*Timeout)(int fd, long timeout);
a61af66fc99e Initial load
duke
parents:
diff changeset
290 struct hostent * (*GetHostByName)(char *hostname);
a61af66fc99e Initial load
duke
parents:
diff changeset
291 int (*Socket)(int domain, int type, int protocol);
a61af66fc99e Initial load
duke
parents:
diff changeset
292 int (*SocketShutdown)(int fd, int howto);
a61af66fc99e Initial load
duke
parents:
diff changeset
293 int (*Bind)(int fd, struct sockaddr *him, int len);
a61af66fc99e Initial load
duke
parents:
diff changeset
294 int (*GetSocketName)(int fd, struct sockaddr *him, int *len);
a61af66fc99e Initial load
duke
parents:
diff changeset
295 int (*GetHostName)(char *hostname, int namelen);
a61af66fc99e Initial load
duke
parents:
diff changeset
296 struct hostent * (*GetHostByAddr)(const char *hostname, int len, int type);
a61af66fc99e Initial load
duke
parents:
diff changeset
297 int (*SocketGetOption)(int fd, int level, int optname, char *optval, int *optlen);
a61af66fc99e Initial load
duke
parents:
diff changeset
298 int (*SocketSetOption)(int fd, int level, int optname, const char *optval, int optlen);
a61af66fc99e Initial load
duke
parents:
diff changeset
299 struct protoent * (*GetProtoByName)(char* name);
a61af66fc99e Initial load
duke
parents:
diff changeset
300 } HPI_SocketInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
301
a61af66fc99e Initial load
duke
parents:
diff changeset
302 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
303 * callbacks.
a61af66fc99e Initial load
duke
parents:
diff changeset
304 */
a61af66fc99e Initial load
duke
parents:
diff changeset
305 typedef struct vm_calls {
a61af66fc99e Initial load
duke
parents:
diff changeset
306 int (*jio_fprintf)(FILE *fp, const char *fmt, ...);
a61af66fc99e Initial load
duke
parents:
diff changeset
307 void (*panic)(const char *fmt, ...);
a61af66fc99e Initial load
duke
parents:
diff changeset
308 void (*monitorRegister)(sys_mon_t *mid, char *info_str);
a61af66fc99e Initial load
duke
parents:
diff changeset
309
a61af66fc99e Initial load
duke
parents:
diff changeset
310 void (*monitorContendedEnter)(sys_thread_t *self, sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
311 void (*monitorContendedEntered)(sys_thread_t *self, sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
312 void (*monitorContendedExit)(sys_thread_t *self, sys_mon_t *mid);
a61af66fc99e Initial load
duke
parents:
diff changeset
313 } vm_calls_t;
a61af66fc99e Initial load
duke
parents:
diff changeset
314
a61af66fc99e Initial load
duke
parents:
diff changeset
315 #ifdef __cplusplus
a61af66fc99e Initial load
duke
parents:
diff changeset
316 }
a61af66fc99e Initial load
duke
parents:
diff changeset
317 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
318
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
319 #endif // SHARE_VM_PRIMS_HPI_IMPORTED_H