Mercurial > hg > truffle
annotate src/cpu/x86/vm/jniTypes_x86.hpp @ 1917:f42a2f0c16bb
6996563: 6984311 changes forgot to update vmStructs.cpp for new field _operands
Summary: Add missing line to vmStructs. Also fix bug with class dumper.
Reviewed-by: twisti, kvn
author | jrose |
---|---|
date | Fri, 05 Nov 2010 12:18:30 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 1998, 2003, 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 | |
25 // This file holds platform-dependent routines used to write primitive jni | |
26 // types to the array of arguments passed into JavaCalls::call | |
27 | |
28 class JNITypes : AllStatic { | |
29 // These functions write a java primitive type (in native format) | |
30 // to a java stack slot array to be passed as an argument to JavaCalls:calls. | |
31 // I.e., they are functionally 'push' operations if they have a 'pos' | |
32 // formal parameter. Note that jlong's and jdouble's are written | |
33 // _in reverse_ of the order in which they appear in the interpreter | |
34 // stack. This is because call stubs (see stubGenerator_sparc.cpp) | |
35 // reverse the argument list constructed by JavaCallArguments (see | |
36 // javaCalls.hpp). | |
37 | |
38 private: | |
39 | |
40 #ifndef AMD64 | |
41 // 32bit Helper routines. | |
42 static inline void put_int2r(jint *from, intptr_t *to) { *(jint *)(to++) = from[1]; | |
43 *(jint *)(to ) = from[0]; } | |
44 static inline void put_int2r(jint *from, intptr_t *to, int& pos) { put_int2r(from, to + pos); pos += 2; } | |
45 #endif // AMD64 | |
46 | |
47 public: | |
48 // Ints are stored in native format in one JavaCallArgument slot at *to. | |
49 static inline void put_int(jint from, intptr_t *to) { *(jint *)(to + 0 ) = from; } | |
50 static inline void put_int(jint from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = from; } | |
51 static inline void put_int(jint *from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = *from; } | |
52 | |
53 #ifdef AMD64 | |
54 // Longs are stored in native format in one JavaCallArgument slot at | |
55 // *(to+1). | |
56 static inline void put_long(jlong from, intptr_t *to) { | |
57 *(jlong*) (to + 1) = from; | |
58 } | |
59 | |
60 static inline void put_long(jlong from, intptr_t *to, int& pos) { | |
61 *(jlong*) (to + 1 + pos) = from; | |
62 pos += 2; | |
63 } | |
64 | |
65 static inline void put_long(jlong *from, intptr_t *to, int& pos) { | |
66 *(jlong*) (to + 1 + pos) = *from; | |
67 pos += 2; | |
68 } | |
69 #else | |
70 // Longs are stored in big-endian word format in two JavaCallArgument slots at *to. | |
71 // The high half is in *to and the low half in *(to+1). | |
72 static inline void put_long(jlong from, intptr_t *to) { put_int2r((jint *)&from, to); } | |
73 static inline void put_long(jlong from, intptr_t *to, int& pos) { put_int2r((jint *)&from, to, pos); } | |
74 static inline void put_long(jlong *from, intptr_t *to, int& pos) { put_int2r((jint *) from, to, pos); } | |
75 #endif // AMD64 | |
76 | |
77 // Oops are stored in native format in one JavaCallArgument slot at *to. | |
78 static inline void put_obj(oop from, intptr_t *to) { *(oop *)(to + 0 ) = from; } | |
79 static inline void put_obj(oop from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = from; } | |
80 static inline void put_obj(oop *from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = *from; } | |
81 | |
82 // Floats are stored in native format in one JavaCallArgument slot at *to. | |
83 static inline void put_float(jfloat from, intptr_t *to) { *(jfloat *)(to + 0 ) = from; } | |
84 static inline void put_float(jfloat from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = from; } | |
85 static inline void put_float(jfloat *from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = *from; } | |
86 | |
87 #undef _JNI_SLOT_OFFSET | |
88 #ifdef AMD64 | |
89 #define _JNI_SLOT_OFFSET 1 | |
90 // Doubles are stored in native word format in one JavaCallArgument | |
91 // slot at *(to+1). | |
92 static inline void put_double(jdouble from, intptr_t *to) { | |
93 *(jdouble*) (to + 1) = from; | |
94 } | |
95 | |
96 static inline void put_double(jdouble from, intptr_t *to, int& pos) { | |
97 *(jdouble*) (to + 1 + pos) = from; | |
98 pos += 2; | |
99 } | |
100 | |
101 static inline void put_double(jdouble *from, intptr_t *to, int& pos) { | |
102 *(jdouble*) (to + 1 + pos) = *from; | |
103 pos += 2; | |
104 } | |
105 #else | |
106 #define _JNI_SLOT_OFFSET 0 | |
107 // Doubles are stored in big-endian word format in two JavaCallArgument slots at *to. | |
108 // The high half is in *to and the low half in *(to+1). | |
109 static inline void put_double(jdouble from, intptr_t *to) { put_int2r((jint *)&from, to); } | |
110 static inline void put_double(jdouble from, intptr_t *to, int& pos) { put_int2r((jint *)&from, to, pos); } | |
111 static inline void put_double(jdouble *from, intptr_t *to, int& pos) { put_int2r((jint *) from, to, pos); } | |
112 #endif // AMD64 | |
113 | |
114 | |
115 // The get_xxx routines, on the other hand, actually _do_ fetch | |
116 // java primitive types from the interpreter stack. | |
117 // No need to worry about alignment on Intel. | |
118 static inline jint get_int (intptr_t *from) { return *(jint *) from; } | |
119 static inline jlong get_long (intptr_t *from) { return *(jlong *) (from + _JNI_SLOT_OFFSET); } | |
120 static inline oop get_obj (intptr_t *from) { return *(oop *) from; } | |
121 static inline jfloat get_float (intptr_t *from) { return *(jfloat *) from; } | |
122 static inline jdouble get_double(intptr_t *from) { return *(jdouble *)(from + _JNI_SLOT_OFFSET); } | |
123 #undef _JNI_SLOT_OFFSET | |
124 }; |