src/hotspot/share/ci/ciMethodType.hpp
changeset 49449 ef5d5d343e2a
parent 47216 71c04702a3d5
child 53244 9807daeb47c4
equal deleted inserted replaced
49448:b91b558a9076 49449:ef5d5d343e2a
    24 
    24 
    25 #ifndef SHARE_VM_CI_CIMETHODTYPE_HPP
    25 #ifndef SHARE_VM_CI_CIMETHODTYPE_HPP
    26 #define SHARE_VM_CI_CIMETHODTYPE_HPP
    26 #define SHARE_VM_CI_CIMETHODTYPE_HPP
    27 
    27 
    28 #include "ci/ciInstance.hpp"
    28 #include "ci/ciInstance.hpp"
    29 #include "ci/ciUtilities.hpp"
       
    30 #include "classfile/javaClasses.hpp"
       
    31 
    29 
    32 // ciMethodType
    30 // ciMethodType
    33 //
    31 //
    34 // The class represents a java.lang.invoke.MethodType object.
    32 // The class represents a java.lang.invoke.MethodType object.
    35 class ciMethodType : public ciInstance {
    33 class ciMethodType : public ciInstance {
    36 private:
    34 private:
    37   ciType* class_to_citype(oop klass_oop) const {
    35   ciType* class_to_citype(oop klass_oop) const;
    38     if (java_lang_Class::is_primitive(klass_oop)) {
       
    39       BasicType bt = java_lang_Class::primitive_type(klass_oop);
       
    40       return ciType::make(bt);
       
    41     } else {
       
    42       Klass* k = java_lang_Class::as_Klass(klass_oop);
       
    43       return CURRENT_ENV->get_klass(k);
       
    44     }
       
    45   }
       
    46 
    36 
    47 public:
    37 public:
    48   ciMethodType(instanceHandle h_i) : ciInstance(h_i) {}
    38   ciMethodType(instanceHandle h_i) : ciInstance(h_i) {}
    49 
    39 
    50   // What kind of ciObject is this?
    40   // What kind of ciObject is this?
    51   bool is_method_type() const { return true; }
    41   bool is_method_type() const { return true; }
    52 
    42 
    53   ciType* rtype() const {
    43   ciType* rtype() const;
    54     GUARDED_VM_ENTRY(
       
    55       oop rtype = java_lang_invoke_MethodType::rtype(get_oop());
       
    56       return class_to_citype(rtype);
       
    57     )
       
    58   }
       
    59 
    44 
    60   int ptype_count() const {
    45   int ptype_count() const;
    61     GUARDED_VM_ENTRY(return java_lang_invoke_MethodType::ptype_count(get_oop());)
    46   int ptype_slot_count() const ;
    62   }
       
    63 
    47 
    64   int ptype_slot_count() const {
    48   ciType* ptype_at(int index) const;
    65     GUARDED_VM_ENTRY(return java_lang_invoke_MethodType::ptype_slot_count(get_oop());)
       
    66   }
       
    67 
       
    68   ciType* ptype_at(int index) const {
       
    69     GUARDED_VM_ENTRY(
       
    70       oop ptype = java_lang_invoke_MethodType::ptype(get_oop(), index);
       
    71       return class_to_citype(ptype);
       
    72     )
       
    73   }
       
    74 };
    49 };
    75 
    50 
    76 #endif // SHARE_VM_CI_CIMETHODTYPE_HPP
    51 #endif // SHARE_VM_CI_CIMETHODTYPE_HPP