src/hotspot/share/jvmci/jvmciEnv.hpp
author herrick
Wed, 27 Mar 2019 08:27:58 -0400
branchJDK-8200758-branch
changeset 57288 0be43184f52a
parent 53430 ccfd4e614bb8
child 54669 ad45b3802d4e
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     1
/*
53425
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
     2
 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     4
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     8
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    13
 * accompanied this code).
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    14
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    18
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    21
 * questions.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    22
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    23
 */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 48299
diff changeset
    25
#ifndef SHARE_JVMCI_JVMCIENV_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 48299
diff changeset
    26
#define SHARE_JVMCI_JVMCIENV_HPP
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    27
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    28
#include "classfile/systemDictionary.hpp"
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    29
#include "code/debugInfoRec.hpp"
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    30
#include "code/dependencies.hpp"
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    31
#include "code/exceptionHandlerTable.hpp"
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    32
#include "compiler/oopMap.hpp"
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    33
#include "runtime/thread.hpp"
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    34
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    35
class CompileTask;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    36
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    37
// Bring the JVMCI compiler thread into the VM state.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    38
#define JVMCI_VM_ENTRY_MARK                       \
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    39
  JavaThread* thread = JavaThread::current(); \
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    40
  ThreadInVMfromNative __tiv(thread);       \
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    41
  ResetNoHandleMark rnhm;                   \
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    42
  HandleMarkCleaner __hm(thread);           \
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    43
  Thread* THREAD = thread;                  \
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    44
  debug_only(VMNativeEntryWrapper __vew;)
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    45
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    46
#define JVMCI_EXCEPTION_CONTEXT \
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    47
  JavaThread* thread=JavaThread::current(); \
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    48
  Thread* THREAD = thread;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    49
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    50
//
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    51
// This class is the top level broker for requests from the compiler
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    52
// to the VM.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    53
class JVMCIEnv : StackObj {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    54
  CI_PACKAGE_ACCESS_TO
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    55
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 34317
diff changeset
    56
  friend class JVMCIVMStructs;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    57
  friend class CompileBroker;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    58
  friend class Dependencies;  // for get_object, during logging
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    59
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    60
public:
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    61
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    62
  enum CodeInstallResult {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    63
     ok,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    64
     dependencies_failed,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    65
     dependencies_invalid,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    66
     cache_full,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    67
     code_too_large
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    68
  };
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    69
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    70
  // Look up a klass by name from a particular class loader (the accessor's).
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    71
  // If require_local, result must be defined in that class loader, or NULL.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    72
  // If !require_local, a result from remote class loader may be reported,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    73
  // if sufficient class loader constraints exist such that initiating
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    74
  // a class loading request from the given loader is bound to return
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    75
  // the class defined in the remote loader (or throw an error).
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    76
  //
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    77
  // Return an unloaded klass if !require_local and no class at all is found.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    78
  //
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    79
  // The CI treats a klass as loaded if it is consistently defined in
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    80
  // another loader, even if it hasn't yet been loaded in all loaders
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    81
  // that could potentially see it via delegation.
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    82
  static Klass* get_klass_by_name(Klass* accessing_klass, Symbol* klass_name, bool require_local);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    83
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    84
  // Constant pool access.
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    85
  static Klass* get_klass_by_index(const constantPoolHandle& cpool,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    86
                                   int klass_index,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    87
                                   bool& is_accessible,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    88
                                   Klass* loading_klass);
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    89
  static void   get_field_by_index(InstanceKlass* loading_klass, fieldDescriptor& fd,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    90
                                   int field_index);
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33160
diff changeset
    91
  static methodHandle  get_method_by_index(const constantPoolHandle& cpool,
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    92
                                    int method_index, Bytecodes::Code bc,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
    93
                                    InstanceKlass* loading_klass);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    94
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    95
  JVMCIEnv(CompileTask* task, int system_dictionary_modification_counter);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    96
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    97
private:
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    98
  CompileTask*     _task;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    99
  int              _system_dictionary_modification_counter;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   100
35592
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   101
  // Compilation result values
53417
126c5e7b97b1 8217445: [JVMCI] incorrect management of JVMCI compilation failure reason string
dnsimon
parents: 53244
diff changeset
   102
  bool             _retryable;
35592
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   103
  const char*      _failure_reason;
53417
126c5e7b97b1 8217445: [JVMCI] incorrect management of JVMCI compilation failure reason string
dnsimon
parents: 53244
diff changeset
   104
126c5e7b97b1 8217445: [JVMCI] incorrect management of JVMCI compilation failure reason string
dnsimon
parents: 53244
diff changeset
   105
  // Specifies if _failure_reason is on the C heap.
126c5e7b97b1 8217445: [JVMCI] incorrect management of JVMCI compilation failure reason string
dnsimon
parents: 53244
diff changeset
   106
  bool             _failure_reason_on_C_heap;
35592
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   107
53425
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   108
  // Cache JVMTI state. Defined as bytes so that reading them from Java
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   109
  // via Unsafe is well defined (the C++ type for bool is implementation
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   110
  // defined and may not be the same as a Java boolean).
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   111
  jbyte  _jvmti_can_hotswap_or_post_breakpoint;
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   112
  jbyte  _jvmti_can_access_local_variables;
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   113
  jbyte  _jvmti_can_post_on_exceptions;
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   114
  jbyte  _jvmti_can_pop_frame;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   115
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   116
  // Implementation methods for loading and constant pool access.
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   117
  static Klass* get_klass_by_name_impl(Klass* accessing_klass,
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33160
diff changeset
   118
                                  const constantPoolHandle& cpool,
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   119
                                  Symbol* klass_name,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   120
                                  bool require_local);
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   121
  static Klass* get_klass_by_index_impl(const constantPoolHandle& cpool,
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   122
                                     int klass_index,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   123
                                     bool& is_accessible,
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   124
                                     Klass* loading_klass);
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   125
  static void   get_field_by_index_impl(InstanceKlass* loading_klass, fieldDescriptor& fd,
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   126
                                     int field_index);
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33160
diff changeset
   127
  static methodHandle  get_method_by_index_impl(const constantPoolHandle& cpool,
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   128
                                      int method_index, Bytecodes::Code bc,
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   129
                                      InstanceKlass* loading_klass);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   130
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   131
  // Helper methods
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   132
  static bool       check_klass_accessibility(Klass* accessing_klass, Klass* resolved_klass);
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   133
  static methodHandle  lookup_method(InstanceKlass*  accessor,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   134
                           Klass*         holder,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   135
                           Symbol*        name,
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   136
                           Symbol*        sig,
38719
133bf85c3f36 8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents: 35592
diff changeset
   137
                           Bytecodes::Code bc,
133bf85c3f36 8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents: 35592
diff changeset
   138
                           constantTag     tag);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   139
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   140
  private:
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   141
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   142
  // Is this thread currently in the VM state?
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   143
  static bool is_in_vm();
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   144
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   145
  // Helper routine for determining the validity of a compilation
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   146
  // with respect to concurrent class loading.
48299
e8f5fc8f5f67 8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents: 47216
diff changeset
   147
  static JVMCIEnv::CodeInstallResult validate_compile_task_dependencies(Dependencies* target, Handle compiled_code,
e8f5fc8f5f67 8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents: 47216
diff changeset
   148
                                                                        JVMCIEnv* env, char** failure_detail);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   149
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   150
public:
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   151
  CompileTask* task() { return _task; }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   152
53425
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   153
  bool  jvmti_state_changed() const;
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   154
  bool  jvmti_can_hotswap_or_post_breakpoint() const { return  _jvmti_can_hotswap_or_post_breakpoint != 0; }
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   155
  bool  jvmti_can_access_local_variables() const     { return  _jvmti_can_access_local_variables != 0; }
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   156
  bool  jvmti_can_post_on_exceptions() const         { return  _jvmti_can_post_on_exceptions != 0; }
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   157
  bool  jvmti_can_pop_frame() const                  { return  _jvmti_can_pop_frame != 0; }
312880c38a7f 8215375: [Graal] jck:vm/jvmti/Exception/excp001/excp00101 fails in Graal as JIT mode and -Xcomp mode
dnsimon
parents: 48299
diff changeset
   158
35592
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   159
  const char* failure_reason() { return _failure_reason; }
53417
126c5e7b97b1 8217445: [JVMCI] incorrect management of JVMCI compilation failure reason string
dnsimon
parents: 53244
diff changeset
   160
  bool failure_reason_on_C_heap() { return _failure_reason_on_C_heap; }
35592
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   161
  bool retryable() { return _retryable; }
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   162
53417
126c5e7b97b1 8217445: [JVMCI] incorrect management of JVMCI compilation failure reason string
dnsimon
parents: 53244
diff changeset
   163
  void set_failure(bool retryable, const char* reason, bool reason_on_C_heap = false) {
35592
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   164
    _failure_reason = reason;
53417
126c5e7b97b1 8217445: [JVMCI] incorrect management of JVMCI compilation failure reason string
dnsimon
parents: 53244
diff changeset
   165
    _failure_reason_on_C_heap = reason_on_C_heap;
35592
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   166
    _retryable = retryable;
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   167
  }
5814f874d736 8147432: JVMCI should report bailouts in PrintCompilation output
never
parents: 35123
diff changeset
   168
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   169
  // Register the result of a compilation.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   170
  static JVMCIEnv::CodeInstallResult register_method(
34165
66826441022f 8142329: [JVMCI] pass Handle by value
twisti
parents: 33160
diff changeset
   171
                       const methodHandle&       target,
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   172
                       nmethod*&                 nm,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   173
                       int                       entry_bci,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   174
                       CodeOffsets*              offsets,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   175
                       int                       orig_pc_offset,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   176
                       CodeBuffer*               code_buffer,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   177
                       int                       frame_words,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   178
                       OopMapSet*                oop_map_set,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   179
                       ExceptionHandlerTable*    handler_table,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   180
                       AbstractCompiler*         compiler,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   181
                       DebugInformationRecorder* debug_info,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   182
                       Dependencies*             dependencies,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   183
                       JVMCIEnv*                 env,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   184
                       int                       compile_id,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   185
                       bool                      has_unsafe_access,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   186
                       bool                      has_wide_vector,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   187
                       Handle                    installed_code,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   188
                       Handle                    compiled_code,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   189
                       Handle                    speculation_log);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   190
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   191
  // converts the Klass* representing the holder of a method into a
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   192
  // InstanceKlass*.  This is needed since the holder of a method in
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   193
  // the bytecodes could be an array type.  Basically this converts
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   194
  // array types into java/lang/Object and other types stay as they are.
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43938
diff changeset
   195
  static InstanceKlass* get_instance_klass_for_declared_method_holder(Klass* klass);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   196
};
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   197
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 48299
diff changeset
   198
#endif // SHARE_JVMCI_JVMCIENV_HPP