author | eosterlund |
Wed, 09 Oct 2019 12:30:06 +0000 | |
changeset 58516 | d376d86b0a01 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
29183 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
47659
diff
changeset
|
2 |
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. |
29183 | 3 |
* Copyright (c) 2014, Red Hat Inc. All rights reserved. |
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 |
* |
|
6 |
* This code is free software; you can redistribute it and/or modify it |
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
|
8 |
* published by the Free Software Foundation. |
|
9 |
* |
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
* accompanied this code). |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License version |
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
* |
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 |
* or visit www.oracle.com if you need additional information or have any |
|
22 |
* questions. |
|
23 |
* |
|
24 |
*/ |
|
25 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
47659
diff
changeset
|
26 |
#ifndef CPU_AARCH64_JNITYPES_AARCH64_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
47659
diff
changeset
|
27 |
#define CPU_AARCH64_JNITYPES_AARCH64_HPP |
29183 | 28 |
|
47659 | 29 |
#include "jni.h" |
29183 | 30 |
#include "memory/allocation.hpp" |
31 |
#include "oops/oop.hpp" |
|
32 |
||
33 |
// This file holds platform-dependent routines used to write primitive jni |
|
34 |
// types to the array of arguments passed into JavaCalls::call |
|
35 |
||
36 |
class JNITypes : AllStatic { |
|
37 |
// These functions write a java primitive type (in native format) |
|
38 |
// to a java stack slot array to be passed as an argument to JavaCalls:calls. |
|
39 |
// I.e., they are functionally 'push' operations if they have a 'pos' |
|
40 |
// formal parameter. Note that jlong's and jdouble's are written |
|
41 |
// _in reverse_ of the order in which they appear in the interpreter |
|
42 |
// stack. This is because call stubs (see stubGenerator_sparc.cpp) |
|
43 |
// reverse the argument list constructed by JavaCallArguments (see |
|
44 |
// javaCalls.hpp). |
|
45 |
||
46 |
public: |
|
47 |
// Ints are stored in native format in one JavaCallArgument slot at *to. |
|
48 |
static inline void put_int(jint from, intptr_t *to) { *(jint *)(to + 0 ) = from; } |
|
49 |
static inline void put_int(jint from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = from; } |
|
50 |
static inline void put_int(jint *from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = *from; } |
|
51 |
||
52 |
// Longs are stored in native format in one JavaCallArgument slot at |
|
53 |
// *(to+1). |
|
54 |
static inline void put_long(jlong from, intptr_t *to) { |
|
55 |
*(jlong*) (to + 1) = from; |
|
56 |
} |
|
57 |
||
58 |
static inline void put_long(jlong from, intptr_t *to, int& pos) { |
|
59 |
*(jlong*) (to + 1 + pos) = from; |
|
60 |
pos += 2; |
|
61 |
} |
|
62 |
||
63 |
static inline void put_long(jlong *from, intptr_t *to, int& pos) { |
|
64 |
*(jlong*) (to + 1 + pos) = *from; |
|
65 |
pos += 2; |
|
66 |
} |
|
67 |
||
68 |
// Oops are stored in native format in one JavaCallArgument slot at *to. |
|
69 |
static inline void put_obj(oop from, intptr_t *to) { *(oop *)(to + 0 ) = from; } |
|
70 |
static inline void put_obj(oop from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = from; } |
|
71 |
static inline void put_obj(oop *from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = *from; } |
|
72 |
||
73 |
// Floats are stored in native format in one JavaCallArgument slot at *to. |
|
74 |
static inline void put_float(jfloat from, intptr_t *to) { *(jfloat *)(to + 0 ) = from; } |
|
75 |
static inline void put_float(jfloat from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = from; } |
|
76 |
static inline void put_float(jfloat *from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = *from; } |
|
77 |
||
78 |
#undef _JNI_SLOT_OFFSET |
|
79 |
#define _JNI_SLOT_OFFSET 1 |
|
80 |
// Doubles are stored in native word format in one JavaCallArgument |
|
81 |
// slot at *(to+1). |
|
82 |
static inline void put_double(jdouble from, intptr_t *to) { |
|
83 |
*(jdouble*) (to + 1) = from; |
|
84 |
} |
|
85 |
||
86 |
static inline void put_double(jdouble from, intptr_t *to, int& pos) { |
|
87 |
*(jdouble*) (to + 1 + pos) = from; |
|
88 |
pos += 2; |
|
89 |
} |
|
90 |
||
91 |
static inline void put_double(jdouble *from, intptr_t *to, int& pos) { |
|
92 |
*(jdouble*) (to + 1 + pos) = *from; |
|
93 |
pos += 2; |
|
94 |
} |
|
95 |
||
96 |
// The get_xxx routines, on the other hand, actually _do_ fetch |
|
97 |
// java primitive types from the interpreter stack. |
|
98 |
// No need to worry about alignment on Intel. |
|
99 |
static inline jint get_int (intptr_t *from) { return *(jint *) from; } |
|
100 |
static inline jlong get_long (intptr_t *from) { return *(jlong *) (from + _JNI_SLOT_OFFSET); } |
|
101 |
static inline oop get_obj (intptr_t *from) { return *(oop *) from; } |
|
102 |
static inline jfloat get_float (intptr_t *from) { return *(jfloat *) from; } |
|
103 |
static inline jdouble get_double(intptr_t *from) { return *(jdouble *)(from + _JNI_SLOT_OFFSET); } |
|
104 |
#undef _JNI_SLOT_OFFSET |
|
105 |
}; |
|
106 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
47659
diff
changeset
|
107 |
#endif // CPU_AARCH64_JNITYPES_AARCH64_HPP |