src/hotspot/share/jvmci/jvmciCompilerToVM.hpp
author coleenp
Fri, 16 Mar 2018 09:12:13 -0400
changeset 49449 ef5d5d343e2a
parent 47659 a8e9aff89f7b
child 49752 93d84f667d12
permissions -rw-r--r--
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files Summary: interfaceSupport.hpp is an inline file so moved to interfaceSupport.inline.hpp and stopped including it in .hpp files Reviewed-by: stefank, rehn, kvn
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
/*
46271
979ebd346ecf 8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents: 42650
diff changeset
     2
 * Copyright (c) 2011, 2017, 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
#ifndef SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    25
#define SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    26
47659
a8e9aff89f7b 8189608: Remove duplicated jni.h
ihse
parents: 47216
diff changeset
    27
#include "jni.h"
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    28
#include "runtime/javaCalls.hpp"
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    29
#include "jvmci/jvmciJavaClasses.hpp"
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    30
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    31
class CompilerToVM {
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    32
 public:
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    33
  class Data {
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    34
    friend class JVMCIVMStructs;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    35
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    36
   private:
35899
0dbc821628fc 8148047: Move the vtable length field to Klass
mgerdin
parents: 35123
diff changeset
    37
    static int Klass_vtable_start_offset;
0dbc821628fc 8148047: Move the vtable length field to Klass
mgerdin
parents: 35123
diff changeset
    38
    static int Klass_vtable_length_offset;
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    39
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    40
    static int Method_extra_stack_entries;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    41
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    42
    static address SharedRuntime_ic_miss_stub;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    43
    static address SharedRuntime_handle_wrong_method_stub;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    44
    static address SharedRuntime_deopt_blob_unpack;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    45
    static address SharedRuntime_deopt_blob_uncommon_trap;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    46
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    47
    static size_t ThreadLocalAllocBuffer_alignment_reserve;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    48
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    49
    static CollectedHeap* Universe_collectedHeap;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    50
    static int Universe_base_vtable_size;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    51
    static address Universe_narrow_oop_base;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    52
    static int Universe_narrow_oop_shift;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    53
    static address Universe_narrow_klass_base;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    54
    static int Universe_narrow_klass_shift;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    55
    static uintptr_t Universe_verify_oop_mask;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    56
    static uintptr_t Universe_verify_oop_bits;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    57
    static void* Universe_non_oop_bits;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    58
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    59
    static bool _supports_inline_contig_alloc;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    60
    static HeapWord** _heap_end_addr;
41283
2615c024f3eb 8033552: Fix missing missing volatile specifiers in CAS operations in GC code
eosterlund
parents: 40878
diff changeset
    61
    static HeapWord* volatile* _heap_top_addr;
39441
7464b1552bf7 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents: 38283
diff changeset
    62
    static int _max_oop_map_stack_offset;
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    63
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    64
    static jbyte* cardtable_start_address;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    65
    static int cardtable_shift;
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    66
35593
c733fd198e6e 8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents: 35123
diff changeset
    67
    static int vm_page_size;
c733fd198e6e 8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents: 35123
diff changeset
    68
43939
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    69
    static int sizeof_vtableEntry;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    70
    static int sizeof_ExceptionTableElement;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    71
    static int sizeof_LocalVariableTableElement;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    72
    static int sizeof_ConstantPool;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    73
    static int sizeof_SymbolPointer;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    74
    static int sizeof_narrowKlass;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    75
    static int sizeof_arrayOopDesc;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    76
    static int sizeof_BasicLock;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    77
38283
4fb93f7c26fe 8156178: [JVMCI] expose StubRoutines trig functions
never
parents: 35913
diff changeset
    78
    static address dsin;
4fb93f7c26fe 8156178: [JVMCI] expose StubRoutines trig functions
never
parents: 35913
diff changeset
    79
    static address dcos;
4fb93f7c26fe 8156178: [JVMCI] expose StubRoutines trig functions
never
parents: 35913
diff changeset
    80
    static address dtan;
4fb93f7c26fe 8156178: [JVMCI] expose StubRoutines trig functions
never
parents: 35913
diff changeset
    81
    static address dexp;
4fb93f7c26fe 8156178: [JVMCI] expose StubRoutines trig functions
never
parents: 35913
diff changeset
    82
    static address dlog;
4fb93f7c26fe 8156178: [JVMCI] expose StubRoutines trig functions
never
parents: 35913
diff changeset
    83
    static address dlog10;
4fb93f7c26fe 8156178: [JVMCI] expose StubRoutines trig functions
never
parents: 35913
diff changeset
    84
    static address dpow;
4fb93f7c26fe 8156178: [JVMCI] expose StubRoutines trig functions
never
parents: 35913
diff changeset
    85
43939
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    86
    static address symbol_init;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    87
    static address symbol_clinit;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    88
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
    89
   public:
43939
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    90
    static void initialize(TRAPS);
39441
7464b1552bf7 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents: 38283
diff changeset
    91
7464b1552bf7 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents: 38283
diff changeset
    92
    static int max_oop_map_stack_offset() {
7464b1552bf7 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents: 38283
diff changeset
    93
      assert(_max_oop_map_stack_offset > 0, "must be initialized");
7464b1552bf7 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents: 38283
diff changeset
    94
      return Data::_max_oop_map_stack_offset;
7464b1552bf7 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents: 38283
diff changeset
    95
    }
33160
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
43939
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    98
  static bool cstring_equals(const char* const& s0, const char* const& s1) {
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
    99
    return strcmp(s0, s1) == 0;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   100
  }
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   101
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   102
  static unsigned cstring_hash(const char* const& s) {
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   103
    int h = 0;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   104
    const char* p = s;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   105
    while (*p != '\0') {
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   106
      h = 31 * h + *p;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   107
      p++;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   108
    }
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   109
    return h;
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   110
  }
39f5b59549de 8173912: [JVMCI] fix memory overhead of JVMCI
dnsimon
parents: 42650
diff changeset
   111
40878
5d87104b10d5 8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents: 39441
diff changeset
   112
  static JNINativeMethod methods[];
5d87104b10d5 8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents: 39441
diff changeset
   113
5d87104b10d5 8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents: 39441
diff changeset
   114
  static objArrayHandle initialize_intrinsics(TRAPS);
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 35092
diff changeset
   115
 public:
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   116
  static int methods_count();
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   117
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   118
  static inline Method* asMethod(jobject jvmci_method) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   119
    return (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(jvmci_method);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   120
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   121
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   122
  static inline Method* asMethod(Handle jvmci_method) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   123
    return (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(jvmci_method);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   124
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   125
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   126
  static inline Method* asMethod(oop jvmci_method) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   127
    return (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(jvmci_method);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   128
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   129
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   130
  static inline ConstantPool* asConstantPool(jobject jvmci_constant_pool) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   131
    return (ConstantPool*) (address) HotSpotConstantPool::metaspaceConstantPool(jvmci_constant_pool);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   132
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   133
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   134
  static inline ConstantPool* asConstantPool(Handle jvmci_constant_pool) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   135
    return (ConstantPool*) (address) HotSpotConstantPool::metaspaceConstantPool(jvmci_constant_pool);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   136
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   137
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   138
  static inline ConstantPool* asConstantPool(oop jvmci_constant_pool) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   139
    return (ConstantPool*) (address) HotSpotConstantPool::metaspaceConstantPool(jvmci_constant_pool);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   140
  }
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
  static inline Klass* asKlass(jobject jvmci_type) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   143
    return java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(jvmci_type));
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
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   146
  static inline Klass* asKlass(Handle jvmci_type) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   147
    return java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(jvmci_type));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   148
  }
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
  static inline Klass* asKlass(oop jvmci_type) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   151
    return java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(jvmci_type));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   152
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   153
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41283
diff changeset
   154
  static inline Klass* asKlass(jlong metaspaceKlass) {
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41283
diff changeset
   155
    return (Klass*) (address) metaspaceKlass;
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41283
diff changeset
   156
  }
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 41283
diff changeset
   157
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   158
  static inline MethodData* asMethodData(jlong metaspaceMethodData) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   159
    return (MethodData*) (address) metaspaceMethodData;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   160
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   161
34165
66826441022f 8142329: [JVMCI] pass Handle by value
twisti
parents: 33632
diff changeset
   162
  static oop get_jvmci_method(const methodHandle& method, TRAPS);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   163
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 46327
diff changeset
   164
  static oop get_jvmci_type(Klass* klass, TRAPS);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   165
};
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   166
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   167
class JavaArgumentUnboxer : public SignatureIterator {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   168
 protected:
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   169
  JavaCallArguments*  _jca;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   170
  arrayOop _args;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   171
  int _index;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   172
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47659
diff changeset
   173
  Handle next_arg(BasicType expectedType);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   174
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   175
 public:
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   176
  JavaArgumentUnboxer(Symbol* signature, JavaCallArguments*  jca, arrayOop args, bool is_static) : SignatureIterator(signature) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   177
    this->_return_type = T_ILLEGAL;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   178
    _jca = jca;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   179
    _index = 0;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   180
    _args = args;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   181
    if (!is_static) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   182
      _jca->push_oop(next_arg(T_OBJECT));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   183
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   184
    iterate();
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   185
    assert(_index == args->length(), "arg count mismatch with signature");
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   186
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   187
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   188
  inline void do_bool()   { if (!is_return_type()) _jca->push_int(next_arg(T_BOOLEAN)->bool_field(java_lang_boxing_object::value_offset_in_bytes(T_BOOLEAN))); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   189
  inline void do_char()   { if (!is_return_type()) _jca->push_int(next_arg(T_CHAR)->char_field(java_lang_boxing_object::value_offset_in_bytes(T_CHAR))); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   190
  inline void do_short()  { if (!is_return_type()) _jca->push_int(next_arg(T_SHORT)->short_field(java_lang_boxing_object::value_offset_in_bytes(T_SHORT))); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   191
  inline void do_byte()   { if (!is_return_type()) _jca->push_int(next_arg(T_BYTE)->byte_field(java_lang_boxing_object::value_offset_in_bytes(T_BYTE))); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   192
  inline void do_int()    { if (!is_return_type()) _jca->push_int(next_arg(T_INT)->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT))); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   193
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   194
  inline void do_long()   { if (!is_return_type()) _jca->push_long(next_arg(T_LONG)->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG))); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   195
  inline void do_float()  { if (!is_return_type()) _jca->push_float(next_arg(T_FLOAT)->float_field(java_lang_boxing_object::value_offset_in_bytes(T_FLOAT))); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   196
  inline void do_double() { if (!is_return_type()) _jca->push_double(next_arg(T_DOUBLE)->double_field(java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE))); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   197
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   198
  inline void do_object() { _jca->push_oop(next_arg(T_OBJECT)); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   199
  inline void do_object(int begin, int end) { if (!is_return_type()) _jca->push_oop(next_arg(T_OBJECT)); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   200
  inline void do_array(int begin, int end)  { if (!is_return_type()) _jca->push_oop(next_arg(T_OBJECT)); }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   201
  inline void do_void()                     { }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   202
};
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   203
44092
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   204
class JNIHandleMark : public StackObj {
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   205
  public:
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   206
    JNIHandleMark() { push_jni_handle_block(); }
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   207
    ~JNIHandleMark() { pop_jni_handle_block(); }
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   208
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   209
  private:
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   210
    static void push_jni_handle_block();
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   211
    static void pop_jni_handle_block();
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   212
};
bc842cc2356b 8175917: [JVMCI] Avoid long JNI handle chains
chaeubl
parents: 43939
diff changeset
   213
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   214
#endif // SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP