annotate src/cpu/x86/vm/jniTypes_x86.hpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children 120820e30baa
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
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef CPU_X86_VM_JNITYPES_X86_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define CPU_X86_VM_JNITYPES_X86_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "oops/oop.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "prims/jni.h"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // This file holds platform-dependent routines used to write primitive jni
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // types to the array of arguments passed into JavaCalls::call
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class JNITypes : AllStatic {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // These functions write a java primitive type (in native format)
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // to a java stack slot array to be passed as an argument to JavaCalls:calls.
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // I.e., they are functionally 'push' operations if they have a 'pos'
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // formal parameter. Note that jlong's and jdouble's are written
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // _in reverse_ of the order in which they appear in the interpreter
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // stack. This is because call stubs (see stubGenerator_sparc.cpp)
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // reverse the argument list constructed by JavaCallArguments (see
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // javaCalls.hpp).
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 #ifndef AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // 32bit Helper routines.
a61af66fc99e Initial load
duke
parents:
diff changeset
49 static inline void put_int2r(jint *from, intptr_t *to) { *(jint *)(to++) = from[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
50 *(jint *)(to ) = from[0]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
51 static inline void put_int2r(jint *from, intptr_t *to, int& pos) { put_int2r(from, to + pos); pos += 2; }
a61af66fc99e Initial load
duke
parents:
diff changeset
52 #endif // AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Ints are stored in native format in one JavaCallArgument slot at *to.
a61af66fc99e Initial load
duke
parents:
diff changeset
56 static inline void put_int(jint from, intptr_t *to) { *(jint *)(to + 0 ) = from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 static inline void put_int(jint from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
58 static inline void put_int(jint *from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = *from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 #ifdef AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // Longs are stored in native format in one JavaCallArgument slot at
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // *(to+1).
a61af66fc99e Initial load
duke
parents:
diff changeset
63 static inline void put_long(jlong from, intptr_t *to) {
a61af66fc99e Initial load
duke
parents:
diff changeset
64 *(jlong*) (to + 1) = from;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 static inline void put_long(jlong from, intptr_t *to, int& pos) {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 *(jlong*) (to + 1 + pos) = from;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 pos += 2;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 static inline void put_long(jlong *from, intptr_t *to, int& pos) {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 *(jlong*) (to + 1 + pos) = *from;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 pos += 2;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // Longs are stored in big-endian word format in two JavaCallArgument slots at *to.
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // The high half is in *to and the low half in *(to+1).
a61af66fc99e Initial load
duke
parents:
diff changeset
79 static inline void put_long(jlong from, intptr_t *to) { put_int2r((jint *)&from, to); }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 static inline void put_long(jlong from, intptr_t *to, int& pos) { put_int2r((jint *)&from, to, pos); }
a61af66fc99e Initial load
duke
parents:
diff changeset
81 static inline void put_long(jlong *from, intptr_t *to, int& pos) { put_int2r((jint *) from, to, pos); }
a61af66fc99e Initial load
duke
parents:
diff changeset
82 #endif // AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // Oops are stored in native format in one JavaCallArgument slot at *to.
a61af66fc99e Initial load
duke
parents:
diff changeset
85 static inline void put_obj(oop from, intptr_t *to) { *(oop *)(to + 0 ) = from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
86 static inline void put_obj(oop from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
87 static inline void put_obj(oop *from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = *from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // Floats are stored in native format in one JavaCallArgument slot at *to.
a61af66fc99e Initial load
duke
parents:
diff changeset
90 static inline void put_float(jfloat from, intptr_t *to) { *(jfloat *)(to + 0 ) = from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 static inline void put_float(jfloat from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
92 static inline void put_float(jfloat *from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = *from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 #undef _JNI_SLOT_OFFSET
a61af66fc99e Initial load
duke
parents:
diff changeset
95 #ifdef AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
96 #define _JNI_SLOT_OFFSET 1
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Doubles are stored in native word format in one JavaCallArgument
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // slot at *(to+1).
a61af66fc99e Initial load
duke
parents:
diff changeset
99 static inline void put_double(jdouble from, intptr_t *to) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 *(jdouble*) (to + 1) = from;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 static inline void put_double(jdouble from, intptr_t *to, int& pos) {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 *(jdouble*) (to + 1 + pos) = from;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 pos += 2;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 }
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 static inline void put_double(jdouble *from, intptr_t *to, int& pos) {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 *(jdouble*) (to + 1 + pos) = *from;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 pos += 2;
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
113 #define _JNI_SLOT_OFFSET 0
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // Doubles are stored in big-endian word format in two JavaCallArgument slots at *to.
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // The high half is in *to and the low half in *(to+1).
a61af66fc99e Initial load
duke
parents:
diff changeset
116 static inline void put_double(jdouble from, intptr_t *to) { put_int2r((jint *)&from, to); }
a61af66fc99e Initial load
duke
parents:
diff changeset
117 static inline void put_double(jdouble from, intptr_t *to, int& pos) { put_int2r((jint *)&from, to, pos); }
a61af66fc99e Initial load
duke
parents:
diff changeset
118 static inline void put_double(jdouble *from, intptr_t *to, int& pos) { put_int2r((jint *) from, to, pos); }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 #endif // AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // The get_xxx routines, on the other hand, actually _do_ fetch
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // java primitive types from the interpreter stack.
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // No need to worry about alignment on Intel.
a61af66fc99e Initial load
duke
parents:
diff changeset
125 static inline jint get_int (intptr_t *from) { return *(jint *) from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 static inline jlong get_long (intptr_t *from) { return *(jlong *) (from + _JNI_SLOT_OFFSET); }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 static inline oop get_obj (intptr_t *from) { return *(oop *) from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
128 static inline jfloat get_float (intptr_t *from) { return *(jfloat *) from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
129 static inline jdouble get_double(intptr_t *from) { return *(jdouble *)(from + _JNI_SLOT_OFFSET); }
a61af66fc99e Initial load
duke
parents:
diff changeset
130 #undef _JNI_SLOT_OFFSET
a61af66fc99e Initial load
duke
parents:
diff changeset
131 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
132
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
133 #endif // CPU_X86_VM_JNITYPES_X86_HPP