src/hotspot/cpu/sparc/jniTypes_sparc.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 47659 a8e9aff89f7b
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     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.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47659
diff changeset
    25
#ifndef CPU_SPARC_JNITYPES_SPARC_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47659
diff changeset
    26
#define CPU_SPARC_JNITYPES_SPARC_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
47659
a8e9aff89f7b 8189608: Remove duplicated jni.h
ihse
parents: 47216
diff changeset
    28
#include "jni.h"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "oops/oop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// This file holds platform-dependent routines used to write primitive jni
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// types to the array of arguments passed into JavaCalls::call
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class JNITypes : AllStatic {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  // These functions write a java primitive type (in native format)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  // to a java stack slot array to be passed as an argument to JavaCalls:calls.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  // I.e., they are functionally 'push' operations if they have a 'pos'
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  // formal parameter.  Note that jlong's and jdouble's are written
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  // _in reverse_ of the order in which they appear in the interpreter
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  // stack.  This is because call stubs (see stubGenerator_sparc.cpp)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  // reverse the argument list constructed by JavaCallArguments (see
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  // javaCalls.hpp).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // Helper routines.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  static inline void    put_int2 (jint *from, jint *to)           { to[0] = from[0]; to[1] = from[1]; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  static inline void    put_int2 (jint *from, jint *to, int& pos) { put_int2 (from, (jint *)((intptr_t *)to + pos)); pos += 2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  static inline void    put_int2r(jint *from, jint *to)           { to[0] = from[1]; to[1] = from[0]; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  static inline void    put_int2r(jint *from, jint *to, int& pos) { put_int2r(from, (jint *)((intptr_t *)to + pos)); pos += 2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  // Ints are stored in native format in one JavaCallArgument slot at *to.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  static inline void    put_int(jint  from, intptr_t *to)               { *(jint *)(to +   0  ) =  from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  static inline void    put_int(jint  from, intptr_t *to, int& pos)     { *(jint *)(to + pos++) =  from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  static inline void    put_int(jint *from, intptr_t *to, int& pos)     { *(jint *)(to + pos++) = *from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  // Longs are stored in native format in one JavaCallArgument slot at *(to+1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  static inline void    put_long(jlong  from, intptr_t *to)             { *(jlong *)(to + 1 +   0) =  from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  static inline void    put_long(jlong  from, intptr_t *to, int& pos)   { *(jlong *)(to + 1 + pos) =  from; pos += 2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  static inline void    put_long(jlong *from, intptr_t *to, int& pos)   { *(jlong *)(to + 1 + pos) = *from; pos += 2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  // Oops are stored in native format in one JavaCallArgument slot at *to.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  static inline void    put_obj(oop  from, intptr_t *to)                { *(oop *)(to +   0  ) =  from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  static inline void    put_obj(oop  from, intptr_t *to, int& pos)      { *(oop *)(to + pos++) =  from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  static inline void    put_obj(oop *from, intptr_t *to, int& pos)      { *(oop *)(to + pos++) = *from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  // Floats are stored in native format in one JavaCallArgument slot at *to.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  static inline void    put_float(jfloat  from, intptr_t *to)           { *(jfloat *)(to +   0  ) =  from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  static inline void    put_float(jfloat  from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) =  from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  static inline void    put_float(jfloat *from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = *from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  // Doubles are stored in native word format in one JavaCallArgument slot at *(to+1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  static inline void    put_double(jdouble  from, intptr_t *to)           { *(jdouble *)(to + 1 +   0) =  from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  static inline void    put_double(jdouble  from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) =  from; pos += 2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  static inline void    put_double(jdouble *from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = *from; pos += 2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // The get_xxx routines, on the other hand, actually _do_ fetch
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  // java primitive types from the interpreter stack.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  static inline jint    get_int(intptr_t *from)         { return *(jint *)from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  static inline jlong   get_long(intptr_t *from)        { return *(jlong *)from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  static inline oop     get_obj(intptr_t *from)         { return *(oop *)from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  static inline jfloat  get_float(intptr_t *from)       { return *(jfloat *)from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  static inline jdouble get_double(intptr_t *from)      { return *(jdouble *)from; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    90
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47659
diff changeset
    91
#endif // CPU_SPARC_JNITYPES_SPARC_HPP