1 /*
   2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_JVMCI_VMSTRUCTS_JVMCI_HPP
  26 #define SHARE_VM_JVMCI_VMSTRUCTS_JVMCI_HPP
  27 
  28 #include "compiler/abstractCompiler.hpp"
  29 #include "jvmci/jvmciCodeInstaller.hpp"
  30 #include "jvmci/jvmciCompilerToVM.hpp"
  31 #include "jvmci/jvmciEnv.hpp"
  32 #include "jvmci/jvmciRuntime.hpp"
  33 
  34 #define VM_STRUCTS_JVMCI(nonstatic_field, static_field)                               \
  35   nonstatic_field(JavaThread,    _pending_deoptimization,               int)          \
  36   nonstatic_field(JavaThread,    _pending_failed_speculation,           oop)          \
  37   nonstatic_field(JavaThread,    _pending_transfer_to_interpreter,      bool)         \
  38   nonstatic_field(JavaThread,    _jvmci_counters,                       jlong*)       \
  39   nonstatic_field(MethodData,    _jvmci_ir_size,                        int)          \
  40   nonstatic_field(JVMCIEnv,      _task,                                 CompileTask*) \
  41   nonstatic_field(JVMCIEnv,      _jvmti_can_hotswap_or_post_breakpoint, bool)         \
  42   nonstatic_field(DeoptimizationBlob, _uncommon_trap_offset,            int)          \
  43   \
  44   static_field(CompilerToVM, _supports_inline_contig_alloc, bool) \
  45   static_field(CompilerToVM, _heap_end_addr, HeapWord**) \
  46   static_field(CompilerToVM, _heap_top_addr, HeapWord**)
  47 
  48 #define VM_TYPES_JVMCI(declare_type, declare_toplevel_type)                   \
  49   declare_toplevel_type(CompilerToVM)                                         \
  50   declare_toplevel_type(JVMCIEnv)                                             \
  51 
  52 #define VM_INT_CONSTANTS_JVMCI(declare_constant, declare_preprocessor_constant)                   \
  53   declare_constant(Deoptimization::Reason_unreached0)                                             \
  54   declare_constant(Deoptimization::Reason_type_checked_inlining)                                  \
  55   declare_constant(Deoptimization::Reason_optimized_type_check)                                   \
  56   declare_constant(Deoptimization::Reason_aliasing)                                               \
  57   declare_constant(Deoptimization::Reason_transfer_to_interpreter)                                \
  58   declare_constant(Deoptimization::Reason_not_compiled_exception_handler)                         \
  59   declare_constant(Deoptimization::Reason_unresolved)                                             \
  60   declare_constant(Deoptimization::Reason_jsr_mismatch)                                           \
  61   declare_constant(JVMCIEnv::ok)                                                                  \
  62   declare_constant(JVMCIEnv::dependencies_failed)                                                 \
  63   declare_constant(JVMCIEnv::dependencies_invalid)                                                \
  64   declare_constant(JVMCIEnv::cache_full)                                                          \
  65   declare_constant(JVMCIEnv::code_too_large)                                                      \
  66                                                                                                   \
  67   declare_preprocessor_constant("JVM_ACC_SYNTHETIC", JVM_ACC_SYNTHETIC)                           \
  68   declare_preprocessor_constant("JVM_RECOGNIZED_FIELD_MODIFIERS", JVM_RECOGNIZED_FIELD_MODIFIERS) \
  69                                                                                                   \
  70   declare_constant(CompilerToVM::KLASS_TAG)                                                       \
  71   declare_constant(CompilerToVM::SYMBOL_TAG)                                                      \
  72                                                                                                   \
  73   declare_constant(CodeInstaller::VERIFIED_ENTRY)                                                 \
  74   declare_constant(CodeInstaller::UNVERIFIED_ENTRY)                                               \
  75   declare_constant(CodeInstaller::OSR_ENTRY)                                                      \
  76   declare_constant(CodeInstaller::EXCEPTION_HANDLER_ENTRY)                                        \
  77   declare_constant(CodeInstaller::DEOPT_HANDLER_ENTRY)                                            \
  78   declare_constant(CodeInstaller::INVOKEINTERFACE)                                                \
  79   declare_constant(CodeInstaller::INVOKEVIRTUAL)                                                  \
  80   declare_constant(CodeInstaller::INVOKESTATIC)                                                   \
  81   declare_constant(CodeInstaller::INVOKESPECIAL)                                                  \
  82   declare_constant(CodeInstaller::INLINE_INVOKE)                                                  \
  83   declare_constant(CodeInstaller::POLL_NEAR)                                                      \
  84   declare_constant(CodeInstaller::POLL_RETURN_NEAR)                                               \
  85   declare_constant(CodeInstaller::POLL_FAR)                                                       \
  86   declare_constant(CodeInstaller::POLL_RETURN_FAR)                                                \
  87   declare_constant(CodeInstaller::CARD_TABLE_ADDRESS)                                             \
  88   declare_constant(CodeInstaller::HEAP_TOP_ADDRESS)                                               \
  89   declare_constant(CodeInstaller::HEAP_END_ADDRESS)                                               \
  90   declare_constant(CodeInstaller::NARROW_KLASS_BASE_ADDRESS)                                      \
  91   declare_constant(CodeInstaller::CRC_TABLE_ADDRESS)                                              \
  92   declare_constant(CodeInstaller::INVOKE_INVALID)                                                 \
  93                                                                                                   \
  94   declare_constant(Method::invalid_vtable_index)                                                  \
  95 
  96 #define VM_ADDRESSES_JVMCI(declare_address, declare_preprocessor_address, declare_function)      \
  97   declare_function(JVMCIRuntime::new_instance) \
  98   declare_function(JVMCIRuntime::new_array) \
  99   declare_function(JVMCIRuntime::new_multi_array) \
 100   declare_function(JVMCIRuntime::dynamic_new_array) \
 101   declare_function(JVMCIRuntime::dynamic_new_instance) \
 102   \
 103   declare_function(JVMCIRuntime::thread_is_interrupted) \
 104   declare_function(JVMCIRuntime::vm_message) \
 105   declare_function(JVMCIRuntime::identity_hash_code) \
 106   declare_function(JVMCIRuntime::exception_handler_for_pc) \
 107   declare_function(JVMCIRuntime::monitorenter) \
 108   declare_function(JVMCIRuntime::monitorexit) \
 109   declare_function(JVMCIRuntime::create_null_exception) \
 110   declare_function(JVMCIRuntime::create_out_of_bounds_exception) \
 111   declare_function(JVMCIRuntime::log_primitive) \
 112   declare_function(JVMCIRuntime::log_object) \
 113   declare_function(JVMCIRuntime::log_printf) \
 114   declare_function(JVMCIRuntime::vm_error) \
 115   declare_function(JVMCIRuntime::load_and_clear_exception) \
 116   declare_function(JVMCIRuntime::write_barrier_pre) \
 117   declare_function(JVMCIRuntime::write_barrier_post) \
 118   declare_function(JVMCIRuntime::validate_object) \
 119   \
 120   declare_function(JVMCIRuntime::test_deoptimize_call_int)
 121 
 122 #endif // SHARE_VM_JVMCI_VMSTRUCTS_JVMCI_HPP