| 1 | /* |
| 2 | * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | * accompanied this code). |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License version |
| 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | * or visit www.oracle.com if you need additional information or have any |
| 21 | * questions. |
| 22 | */ |
| 23 | |
| 24 | #ifndef SHARE_AOT_COMPILEDIC_AOT_HPP |
| 25 | #define SHARE_AOT_COMPILEDIC_AOT_HPP |
| 26 | |
| 27 | #include "code/compiledIC.hpp" |
| 28 | #include "code/nativeInst.hpp" |
| 29 | #include "interpreter/linkResolver.hpp" |
| 30 | #include "oops/compiledICHolder.hpp" |
| 31 | |
| 32 | class CompiledPltStaticCall: public CompiledStaticCall { |
| 33 | friend class CompiledIC; |
| 34 | friend class PltNativeCallWrapper; |
| 35 | |
| 36 | // Also used by CompiledIC |
| 37 | void set_to_interpreted(const methodHandle& callee, address entry); |
| 38 | |
| 39 | address instruction_address() const { return _call->instruction_address(); } |
| 40 | void set_destination_mt_safe(address dest) { _call->set_destination_mt_safe(dest); } |
| 41 | |
| 42 | NativePltCall* _call; |
| 43 | |
| 44 | CompiledPltStaticCall(NativePltCall* call) : _call(call) {} |
| 45 | |
| 46 | public: |
| 47 | |
| 48 | inline static CompiledPltStaticCall* before(address return_addr) { |
| 49 | CompiledPltStaticCall* st = new CompiledPltStaticCall(nativePltCall_before(return_addr)); |
| 50 | st->verify(); |
| 51 | return st; |
| 52 | } |
| 53 | |
| 54 | static inline CompiledPltStaticCall* at(address native_call) { |
| 55 | CompiledPltStaticCall* st = new CompiledPltStaticCall(nativePltCall_at(native_call)); |
| 56 | st->verify(); |
| 57 | return st; |
| 58 | } |
| 59 | |
| 60 | static inline CompiledPltStaticCall* at(Relocation* call_site) { |
| 61 | return at(call_site->addr()); |
| 62 | } |
| 63 | |
| 64 | // Delegation |
| 65 | address destination() const { return _call->destination(); } |
| 66 | |
| 67 | virtual bool is_call_to_interpreted() const; |
| 68 | |
| 69 | // Stub support |
| 70 | address find_stub(); |
| 71 | static void set_stub_to_clean(static_stub_Relocation* static_stub); |
| 72 | |
| 73 | // Misc. |
| 74 | void print() PRODUCT_RETURN; |
| 75 | void verify() PRODUCT_RETURN; |
| 76 | |
| 77 | protected: |
| 78 | virtual address resolve_call_stub() const { return _call->plt_resolve_call(); } |
| 79 | virtual void set_to_far(const methodHandle& callee, address entry) { set_to_compiled(entry); } |
| 80 | virtual const char* name() const { return "CompiledPltStaticCall" ; } |
| 81 | }; |
| 82 | |
| 83 | #endif // SHARE_AOT_COMPILEDIC_AOT_HPP |
| 84 | |