src/hotspot/cpu/zero/interpreterRT_zero.hpp
author stefank
Thu, 09 May 2019 14:28:30 +0200
changeset 54786 ebf733a324d4
parent 53244 9807daeb47c4
permissions -rw-r--r--
8223624: Cleanup includes of universe.hpp Reviewed-by: coleenp, lkorinth
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49480
diff changeset
     2
 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     3
 * Copyright 2007, 2008 Red Hat, Inc.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     5
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     8
 * published by the Free Software Foundation.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     9
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    14
 * accompanied this code).
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    15
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    19
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4013
diff changeset
    22
 * questions.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    23
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    24
 */
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    25
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49480
diff changeset
    26
#ifndef CPU_ZERO_INTERPRETERRT_ZERO_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49480
diff changeset
    27
#define CPU_ZERO_INTERPRETERRT_ZERO_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6771
diff changeset
    28
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
    29
// This is included in the middle of class Interpreter.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
    30
// Do not include files here.
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 47216
diff changeset
    31
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6771
diff changeset
    32
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    33
class SignatureHandler {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    34
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    35
  static SignatureHandler *from_handlerAddr(address handlerAddr) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    36
    return (SignatureHandler *) handlerAddr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    37
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    38
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    39
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    40
  ffi_cif* cif() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    41
    return (ffi_cif *) this;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    42
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    43
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    44
  int argument_count() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    45
    return cif()->nargs;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    46
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    47
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    48
  ffi_type** argument_types() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    49
    return (ffi_type**) (cif() + 1);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    50
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    51
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    52
  ffi_type* argument_type(int i) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    53
    return argument_types()[i];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    54
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    55
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    56
  ffi_type* result_type() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    57
    return *(argument_types() + argument_count());
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    58
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    59
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    60
 protected:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    61
  friend class InterpreterRuntime;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    62
  friend class SignatureHandlerLibrary;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    63
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    64
  void finalize();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    65
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    66
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    67
class SignatureHandlerGeneratorBase : public NativeSignatureIterator {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    68
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    69
  ffi_cif* _cif;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    70
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    71
 protected:
46727
6e4a84748e2c 8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents: 7397
diff changeset
    72
  SignatureHandlerGeneratorBase(const methodHandle& method, ffi_cif *cif)
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    73
    : NativeSignatureIterator(method), _cif(cif) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    74
    _cif->nargs = 0;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    75
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    76
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    77
  ffi_cif *cif() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    78
    return _cif;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    79
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    80
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    81
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    82
  void generate(uint64_t fingerprint);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    83
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    84
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    85
  void pass_int();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    86
  void pass_long();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    87
  void pass_float();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    88
  void pass_double();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    89
  void pass_object();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    90
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    91
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    92
  void push(BasicType type);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    93
  virtual void push(intptr_t value) = 0;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    94
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    95
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    96
class SignatureHandlerGenerator : public SignatureHandlerGeneratorBase {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    97
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    98
  CodeBuffer* _cb;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    99
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   100
 public:
46727
6e4a84748e2c 8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents: 7397
diff changeset
   101
  SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer)
6771
3f9a5f169070 6990549: Zero and Shark fixes after 6978355 and 6953144
twisti
parents: 5547
diff changeset
   102
    : SignatureHandlerGeneratorBase(method, (ffi_cif *) buffer->insts_end()),
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   103
      _cb(buffer) {
6771
3f9a5f169070 6990549: Zero and Shark fixes after 6978355 and 6953144
twisti
parents: 5547
diff changeset
   104
    _cb->set_insts_end((address) (cif() + 1));
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   105
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   106
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   107
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   108
  void push(intptr_t value) {
6771
3f9a5f169070 6990549: Zero and Shark fixes after 6978355 and 6953144
twisti
parents: 5547
diff changeset
   109
    intptr_t *dst = (intptr_t *) _cb->insts_end();
3f9a5f169070 6990549: Zero and Shark fixes after 6978355 and 6953144
twisti
parents: 5547
diff changeset
   110
    _cb->set_insts_end((address) (dst + 1));
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   111
    *dst = value;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   112
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   113
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   114
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   115
class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   116
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   117
  intptr_t *_dst;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   118
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   119
 public:
46727
6e4a84748e2c 8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents: 7397
diff changeset
   120
  SlowSignatureHandlerGenerator(const methodHandle& method, intptr_t* buf)
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   121
    : SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   122
    _dst = (intptr_t *) (cif() + 1);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   123
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   124
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   125
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   126
  void push(intptr_t value) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   127
    *(_dst++) = value;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   128
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   129
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   130
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   131
  SignatureHandler *handler() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   132
    return (SignatureHandler *) cif();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   133
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   134
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6771
diff changeset
   135
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49480
diff changeset
   136
#endif // CPU_ZERO_INTERPRETERRT_ZERO_HPP