38 // I.e., they are functionally 'push' operations if they have a 'pos' 39 // formal parameter. Note that jlong's and jdouble's are written 40 // _in reverse_ of the order in which they appear in the interpreter 41 // stack. This is because call stubs (see stubGenerator_sparc.cpp) 42 // reverse the argument list constructed by JavaCallArguments (see 43 // javaCalls.hpp). 44 45 private: 46 // Helper routines. 47 static inline void put_int2 (jint *from, jint *to) { to[0] = from[0]; to[1] = from[1]; } 48 static inline void put_int2 (jint *from, jint *to, int& pos) { put_int2 (from, (jint *)((intptr_t *)to + pos)); pos += 2; } 49 static inline void put_int2r(jint *from, jint *to) { to[0] = from[1]; to[1] = from[0]; } 50 static inline void put_int2r(jint *from, jint *to, int& pos) { put_int2r(from, (jint *)((intptr_t *)to + pos)); pos += 2; } 51 52 public: 53 // Ints are stored in native format in one JavaCallArgument slot at *to. 54 static inline void put_int(jint from, intptr_t *to) { *(jint *)(to + 0 ) = from; } 55 static inline void put_int(jint from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = from; } 56 static inline void put_int(jint *from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = *from; } 57 58 #ifdef _LP64 59 // Longs are stored in native format in one JavaCallArgument slot at *(to+1). 60 static inline void put_long(jlong from, intptr_t *to) { *(jlong *)(to + 1 + 0) = from; } 61 static inline void put_long(jlong from, intptr_t *to, int& pos) { *(jlong *)(to + 1 + pos) = from; pos += 2; } 62 static inline void put_long(jlong *from, intptr_t *to, int& pos) { *(jlong *)(to + 1 + pos) = *from; pos += 2; } 63 #else 64 // Longs are stored in reversed native word format in two JavaCallArgument slots at *to. 65 // The high half is in *(to+1) and the low half in *to. 66 static inline void put_long(jlong from, intptr_t *to) { put_int2r((jint *)&from, (jint *)to); } 67 static inline void put_long(jlong from, intptr_t *to, int& pos) { put_int2r((jint *)&from, (jint *)to, pos); } 68 static inline void put_long(jlong *from, intptr_t *to, int& pos) { put_int2r((jint *) from, (jint *)to, pos); } 69 #endif 70 71 // Oops are stored in native format in one JavaCallArgument slot at *to. 72 static inline void put_obj(oop from, intptr_t *to) { *(oop *)(to + 0 ) = from; } 73 static inline void put_obj(oop from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = from; } 74 static inline void put_obj(oop *from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = *from; } 75 76 // Floats are stored in native format in one JavaCallArgument slot at *to. 77 static inline void put_float(jfloat from, intptr_t *to) { *(jfloat *)(to + 0 ) = from; } 78 static inline void put_float(jfloat from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = from; } 79 static inline void put_float(jfloat *from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = *from; } 80 81 #ifdef _LP64 82 // Doubles are stored in native word format in one JavaCallArgument slot at *(to+1). 83 static inline void put_double(jdouble from, intptr_t *to) { *(jdouble *)(to + 1 + 0) = from; } 84 static inline void put_double(jdouble from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = from; pos += 2; } 85 static inline void put_double(jdouble *from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = *from; pos += 2; } 86 #else 87 // Doubles are stored in reversed native word format in two JavaCallArgument slots at *to. 88 static inline void put_double(jdouble from, intptr_t *to) { put_int2r((jint *)&from, (jint *)to); } 89 static inline void put_double(jdouble from, intptr_t *to, int& pos) { put_int2r((jint *)&from, (jint *)to, pos); } 90 static inline void put_double(jdouble *from, intptr_t *to, int& pos) { put_int2r((jint *) from, (jint *)to, pos); } 91 #endif 92 93 // The get_xxx routines, on the other hand, actually _do_ fetch 94 // java primitive types from the interpreter stack. 95 static inline jint get_int(intptr_t *from) { return *(jint *)from; } 96 97 #ifdef _LP64 98 static inline jlong get_long(intptr_t *from) { return *(jlong *)from; } 99 #else 100 static inline jlong get_long(intptr_t *from) { return ((jlong)(*( signed int *)((jint *)from )) << 32) | 101 ((jlong)(*(unsigned int *)((jint *)from + 1)) << 0); } 102 #endif 103 104 static inline oop get_obj(intptr_t *from) { return *(oop *)from; } 105 static inline jfloat get_float(intptr_t *from) { return *(jfloat *)from; } 106 107 #ifdef _LP64 108 static inline jdouble get_double(intptr_t *from) { return *(jdouble *)from; } 109 #else 110 static inline jdouble get_double(intptr_t *from) { jlong jl = ((jlong)(*( signed int *)((jint *)from )) << 32) | 111 ((jlong)(*(unsigned int *)((jint *)from + 1)) << 0); 112 return *(jdouble *)&jl; } 113 #endif 114 115 }; 116 117 #endif // CPU_SPARC_VM_JNITYPES_SPARC_HPP | 38 // I.e., they are functionally 'push' operations if they have a 'pos' 39 // formal parameter. Note that jlong's and jdouble's are written 40 // _in reverse_ of the order in which they appear in the interpreter 41 // stack. This is because call stubs (see stubGenerator_sparc.cpp) 42 // reverse the argument list constructed by JavaCallArguments (see 43 // javaCalls.hpp). 44 45 private: 46 // Helper routines. 47 static inline void put_int2 (jint *from, jint *to) { to[0] = from[0]; to[1] = from[1]; } 48 static inline void put_int2 (jint *from, jint *to, int& pos) { put_int2 (from, (jint *)((intptr_t *)to + pos)); pos += 2; } 49 static inline void put_int2r(jint *from, jint *to) { to[0] = from[1]; to[1] = from[0]; } 50 static inline void put_int2r(jint *from, jint *to, int& pos) { put_int2r(from, (jint *)((intptr_t *)to + pos)); pos += 2; } 51 52 public: 53 // Ints are stored in native format in one JavaCallArgument slot at *to. 54 static inline void put_int(jint from, intptr_t *to) { *(jint *)(to + 0 ) = from; } 55 static inline void put_int(jint from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = from; } 56 static inline void put_int(jint *from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = *from; } 57 58 // Longs are stored in native format in one JavaCallArgument slot at *(to+1). 59 static inline void put_long(jlong from, intptr_t *to) { *(jlong *)(to + 1 + 0) = from; } 60 static inline void put_long(jlong from, intptr_t *to, int& pos) { *(jlong *)(to + 1 + pos) = from; pos += 2; } 61 static inline void put_long(jlong *from, intptr_t *to, int& pos) { *(jlong *)(to + 1 + pos) = *from; pos += 2; } 62 63 // Oops are stored in native format in one JavaCallArgument slot at *to. 64 static inline void put_obj(oop from, intptr_t *to) { *(oop *)(to + 0 ) = from; } 65 static inline void put_obj(oop from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = from; } 66 static inline void put_obj(oop *from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = *from; } 67 68 // Floats are stored in native format in one JavaCallArgument slot at *to. 69 static inline void put_float(jfloat from, intptr_t *to) { *(jfloat *)(to + 0 ) = from; } 70 static inline void put_float(jfloat from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = from; } 71 static inline void put_float(jfloat *from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = *from; } 72 73 // Doubles are stored in native word format in one JavaCallArgument slot at *(to+1). 74 static inline void put_double(jdouble from, intptr_t *to) { *(jdouble *)(to + 1 + 0) = from; } 75 static inline void put_double(jdouble from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = from; pos += 2; } 76 static inline void put_double(jdouble *from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = *from; pos += 2; } 77 78 // The get_xxx routines, on the other hand, actually _do_ fetch 79 // java primitive types from the interpreter stack. 80 static inline jint get_int(intptr_t *from) { return *(jint *)from; } 81 82 static inline jlong get_long(intptr_t *from) { return *(jlong *)from; } 83 84 static inline oop get_obj(intptr_t *from) { return *(oop *)from; } 85 static inline jfloat get_float(intptr_t *from) { return *(jfloat *)from; } 86 87 static inline jdouble get_double(intptr_t *from) { return *(jdouble *)from; } 88 89 }; 90 91 #endif // CPU_SPARC_VM_JNITYPES_SPARC_HPP |