comparison src/share/vm/jvmci/jvmciCompilerToVM.hpp @ 22454:76af33d4d504

Make jvmci redefinition safe
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Fri, 21 Aug 2015 11:57:29 -0700
parents be896a1983c0
children 02fc27dc1da7
comparison
equal deleted inserted replaced
22453:d6bbd5d8d81e 22454:76af33d4d504
24 #ifndef SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP 24 #ifndef SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP
25 #define SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP 25 #define SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP
26 26
27 #include "prims/jni.h" 27 #include "prims/jni.h"
28 #include "runtime/javaCalls.hpp" 28 #include "runtime/javaCalls.hpp"
29 #include "jvmci/jvmciJavaAccess.hpp"
29 30
30 class CompilerToVM { 31 class CompilerToVM {
31 public: 32 public:
32 /** 33 /**
33 * Tag bits used by lookupKlassInPool to distinguish the types in Java. 34 * Tag bits used by lookupKlassInPool to distinguish the types in Java.
43 44
44 static intptr_t tag_pointer(Symbol* symbol) { 45 static intptr_t tag_pointer(Symbol* symbol) {
45 return ((intptr_t) symbol) | SYMBOL_TAG; 46 return ((intptr_t) symbol) | SYMBOL_TAG;
46 } 47 }
47 48
48 // nothing here - no need to define the jni method implementations in a header file 49 static JNINativeMethod methods[];
50 static int methods_count();
51
52 static inline Method* asMethod(jobject jvmci_method) {
53 return (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(jvmci_method);
54 }
55
56 static inline Method* asMethod(Handle jvmci_method) {
57 return (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(jvmci_method);
58 }
59
60 static inline Method* asMethod(oop jvmci_method) {
61 return (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(jvmci_method);
62 }
63
64 static inline ConstantPool* asConstantPool(jobject jvmci_constant_pool) {
65 return (ConstantPool*) (address) HotSpotConstantPool::metaspaceConstantPool(jvmci_constant_pool);
66 }
67
68 static inline ConstantPool* asConstantPool(Handle jvmci_constant_pool) {
69 return (ConstantPool*) (address) HotSpotConstantPool::metaspaceConstantPool(jvmci_constant_pool);
70 }
71
72 static inline ConstantPool* asConstantPool(oop jvmci_constant_pool) {
73 return (ConstantPool*) (address) HotSpotConstantPool::metaspaceConstantPool(jvmci_constant_pool);
74 }
75
76 static inline Klass* asKlass(jobject jvmci_type) {
77 return java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(jvmci_type));
78 }
79
80 static inline Klass* asKlass(Handle jvmci_type) {
81 return java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(jvmci_type));
82 }
83
84 static inline Klass* asKlass(oop jvmci_type) {
85 return java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(jvmci_type));
86 }
87
88 static inline MethodData* asMethodData(jlong metaspaceMethodData) {
89 return (MethodData*) (address) metaspaceMethodData;
90 }
91
92 static oop get_jvmci_method(methodHandle method, TRAPS);
93
94 static oop get_jvmci_type(KlassHandle klass, TRAPS);
49 }; 95 };
50
51 extern JNINativeMethod CompilerToVM_methods[];
52 int CompilerToVM_methods_count();
53
54 inline Method* asMethod(jlong metaspaceMethod) {
55 return (Method*) (address) metaspaceMethod;
56 }
57
58 inline MethodData* asMethodData(jlong metaspaceMethodData) {
59 return (MethodData*) (address) metaspaceMethodData;
60 }
61
62 inline Klass* asKlass(jlong metaspaceKlass) {
63 return (Klass*) (address) metaspaceKlass;
64 }
65 96
66 class JavaArgumentUnboxer : public SignatureIterator { 97 class JavaArgumentUnboxer : public SignatureIterator {
67 protected: 98 protected:
68 JavaCallArguments* _jca; 99 JavaCallArguments* _jca;
69 arrayOop _args; 100 arrayOop _args;