ciMethodHandle.hpp revision 1879:f95d63e2154a
11590Srgrimes/*
21590Srgrimes * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
31590Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41590Srgrimes *
51590Srgrimes * This code is free software; you can redistribute it and/or modify it
61590Srgrimes * under the terms of the GNU General Public License version 2 only, as
71590Srgrimes * published by the Free Software Foundation.
81590Srgrimes *
91590Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
101590Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
111590Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
121590Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
131590Srgrimes * accompanied this code).
141590Srgrimes *
151590Srgrimes * You should have received a copy of the GNU General Public License version
161590Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
171590Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
181590Srgrimes *
191590Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
201590Srgrimes * or visit www.oracle.com if you need additional information or have any
211590Srgrimes * questions.
221590Srgrimes *
231590Srgrimes */
241590Srgrimes
251590Srgrimes#ifndef SHARE_VM_CI_CIMETHODHANDLE_HPP
261590Srgrimes#define SHARE_VM_CI_CIMETHODHANDLE_HPP
271590Srgrimes
281590Srgrimes#include "prims/methodHandles.hpp"
291590Srgrimes
3087693Smarkm// ciMethodHandle
311590Srgrimes//
3287693Smarkm// The class represents a java.dyn.MethodHandle object.
3387693Smarkmclass ciMethodHandle : public ciInstance {
341590Srgrimesprivate:
351590Srgrimes  ciMethod* _callee;
361590Srgrimes
371590Srgrimes  // Return an adapter for this MethodHandle.
3880381Ssheldonh  ciMethod* get_adapter(bool is_invokedynamic) const;
3980381Ssheldonh
401590Srgrimesprotected:
411590Srgrimes  void print_impl(outputStream* st);
421590Srgrimes
431590Srgrimespublic:
441590Srgrimes  ciMethodHandle(instanceHandle h_i) : ciInstance(h_i) {};
451590Srgrimes
461590Srgrimes  // What kind of ciObject is this?
471590Srgrimes  bool is_method_handle() const { return true; }
481590Srgrimes
491590Srgrimes  ciMethod* callee() const { return _callee; }
501590Srgrimes  void  set_callee(ciMethod* m) { _callee = m; }
511590Srgrimes
521590Srgrimes  // Return an adapter for a MethodHandle call.
531590Srgrimes  ciMethod* get_method_handle_adapter() const {
541590Srgrimes    return get_adapter(false);
551590Srgrimes  }
561590Srgrimes
571590Srgrimes  // Return an adapter for an invokedynamic call.
581590Srgrimes  ciMethod* get_invokedynamic_adapter() const {
591590Srgrimes    return get_adapter(true);
601590Srgrimes  }
611590Srgrimes};
621590Srgrimes
631590Srgrimes#endif // SHARE_VM_CI_CIMETHODHANDLE_HPP
641590Srgrimes