4048N/A/*
4048N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4048N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4048N/A *
4048N/A * This code is free software; you can redistribute it and/or modify it
4048N/A * under the terms of the GNU General Public License version 2 only, as
4048N/A * published by the Free Software Foundation.
4048N/A *
4048N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4048N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4048N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4048N/A * version 2 for more details (a copy is included in the LICENSE file that
4048N/A * accompanied this code).
4048N/A *
4048N/A * You should have received a copy of the GNU General Public License version
4048N/A * 2 along with this work; if not, write to the Free Software Foundation,
4048N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4048N/A *
4048N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4048N/A * or visit www.oracle.com if you need additional information or have any
4048N/A * questions.
4048N/A *
4048N/A */
4048N/A
4048N/A#ifndef SHARE_VM_CI_CIMETHODTYPE_HPP
4048N/A#define SHARE_VM_CI_CIMETHODTYPE_HPP
4048N/A
4048N/A#include "ci/ciInstance.hpp"
4048N/A#include "ci/ciUtilities.hpp"
4048N/A#include "classfile/javaClasses.hpp"
4048N/A
4048N/A// ciMethodType
4048N/A//
4048N/A// The class represents a java.lang.invoke.MethodType object.
4048N/Aclass ciMethodType : public ciInstance {
4048N/Aprivate:
4048N/A ciType* class_to_citype(oop klass_oop) const {
4048N/A if (java_lang_Class::is_primitive(klass_oop)) {
4048N/A BasicType bt = java_lang_Class::primitive_type(klass_oop);
4048N/A return ciType::make(bt);
4048N/A } else {
4048N/A klassOop k = java_lang_Class::as_klassOop(klass_oop);
4048N/A return CURRENT_ENV->get_object(k)->as_klass();
4048N/A }
4048N/A }
4048N/A
4048N/Apublic:
4048N/A ciMethodType(instanceHandle h_i) : ciInstance(h_i) {}
4048N/A
4048N/A // What kind of ciObject is this?
4048N/A bool is_method_type() const { return true; }
4048N/A
4048N/A ciType* rtype() const {
4048N/A GUARDED_VM_ENTRY(
4048N/A oop rtype = java_lang_invoke_MethodType::rtype(get_oop());
4048N/A return class_to_citype(rtype);
4048N/A )
4048N/A }
4048N/A
4048N/A int ptype_count() const {
4048N/A GUARDED_VM_ENTRY(return java_lang_invoke_MethodType::ptype_count(get_oop());)
4048N/A }
4048N/A
4048N/A int ptype_slot_count() const {
4048N/A GUARDED_VM_ENTRY(return java_lang_invoke_MethodType::ptype_slot_count(get_oop());)
4048N/A }
4048N/A
4048N/A ciType* ptype_at(int index) const {
4048N/A GUARDED_VM_ENTRY(
4048N/A oop ptype = java_lang_invoke_MethodType::ptype(get_oop(), index);
4048N/A return class_to_citype(ptype);
4048N/A )
4048N/A }
4048N/A};
4048N/A
4048N/A#endif // SHARE_VM_CI_CIMETHODTYPE_HPP