annotate src/hotspot/share/interpreter/interpreterRuntime.hpp @ 59067:6e321004dde1

fix on test ListModuleDeps.java
author vromero
date Tue, 03 Dec 2019 23:45:06 -0500
parents 9d1a788dea3d
children
rev   line source
duke@1 1 /*
coleenp@54304 2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation.
duke@1 8 *
duke@1 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 13 * accompanied this code).
duke@1 14 *
duke@1 15 * You should have received a copy of the GNU General Public License version
duke@1 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 18 *
trims@5547 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@5547 20 * or visit www.oracle.com if you need additional information or have any
trims@5547 21 * questions.
duke@1 22 *
duke@1 23 */
duke@1 24
coleenp@54304 25 #ifndef SHARE_INTERPRETER_INTERPRETERRUNTIME_HPP
coleenp@54304 26 #define SHARE_INTERPRETER_INTERPRETERRUNTIME_HPP
stefank@7397 27
stefank@7397 28 #include "interpreter/bytecode.hpp"
stefank@7397 29 #include "interpreter/linkResolver.hpp"
coleenp@13728 30 #include "oops/method.hpp"
coleenp@49945 31 #include "runtime/frame.hpp"
stefank@7397 32 #include "runtime/signature.hpp"
stefank@37456 33 #include "runtime/thread.hpp"
goetz@40010 34 #include "utilities/macros.hpp"
stefank@7397 35
duke@1 36 // The InterpreterRuntime is called by the interpreter for everything
duke@1 37 // that cannot/should not be dealt with in assembly and needs C support.
duke@1 38
duke@1 39 class InterpreterRuntime: AllStatic {
duke@1 40 friend class BytecodeClosure; // for method and bcp
duke@1 41 friend class PrintingClosure; // for method and bcp
duke@1 42
duke@1 43 private:
iklam@47951 44
iklam@46430 45 static void set_bcp_and_mdp(address bcp, JavaThread*thread);
goetz@22836 46 static void note_trap_inner(JavaThread* thread, int reason,
coleenp@46727 47 const methodHandle& trap_method, int trap_bci, TRAPS);
duke@1 48 static void note_trap(JavaThread *thread, int reason, TRAPS);
goetz@22836 49 #ifdef CC_INTERP
goetz@22836 50 // Profile traps in C++ interpreter.
goetz@22836 51 static void note_trap(JavaThread* thread, int reason, Method *method, int trap_bci);
goetz@22836 52 #endif // CC_INTERP
duke@1 53
goetz@22836 54 // Inner work method for Interpreter's frequency counter overflow.
ysr@3696 55 static nmethod* frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp);
ysr@3696 56
duke@1 57 public:
duke@1 58 // Constants
duke@1 59 static void ldc (JavaThread* thread, bool wide);
jrose@5882 60 static void resolve_ldc (JavaThread* thread, Bytecodes::Code bytecode);
duke@1 61
duke@1 62 // Allocation
coleenp@13728 63 static void _new (JavaThread* thread, ConstantPool* pool, int index);
duke@1 64 static void newarray (JavaThread* thread, BasicType type, jint size);
coleenp@13728 65 static void anewarray (JavaThread* thread, ConstantPool* pool, int index, jint size);
duke@1 66 static void multianewarray(JavaThread* thread, jint* first_size_address);
duke@1 67 static void register_finalizer(JavaThread* thread, oopDesc* obj);
duke@1 68
duke@1 69 // Quicken instance-of and check-cast bytecodes
duke@1 70 static void quicken_io_cc(JavaThread* thread);
duke@1 71
duke@1 72 // Exceptions thrown by the interpreter
duke@1 73 static void throw_AbstractMethodError(JavaThread* thread);
goetz@49833 74 static void throw_AbstractMethodErrorWithMethod(JavaThread* thread, Method* oop);
goetz@49833 75 static void throw_AbstractMethodErrorVerbose(JavaThread* thread,
goetz@49833 76 Klass* recvKlass,
goetz@49833 77 Method* missingMethod);
goetz@49833 78
duke@1 79 static void throw_IncompatibleClassChangeError(JavaThread* thread);
goetz@49833 80 static void throw_IncompatibleClassChangeErrorVerbose(JavaThread* thread,
goetz@49833 81 Klass* resc,
goetz@49833 82 Klass* interfaceKlass);
duke@1 83 static void throw_StackOverflowError(JavaThread* thread);
fparain@35071 84 static void throw_delayed_StackOverflowError(JavaThread* thread);
goetz@50643 85 static void throw_ArrayIndexOutOfBoundsException(JavaThread* thread, arrayOopDesc* a, jint index);
duke@1 86 static void throw_ClassCastException(JavaThread* thread, oopDesc* obj);
duke@1 87 static void create_exception(JavaThread* thread, char* name, char* message);
duke@1 88 static void create_klass_exception(JavaThread* thread, char* name, oopDesc* obj);
duke@1 89 static address exception_handler_for_exception(JavaThread* thread, oopDesc* exception);
sspitsyn@19266 90 #if INCLUDE_JVMTI
sspitsyn@19266 91 static void member_name_arg_or_null(JavaThread* thread, address dmh, Method* m, address bcp);
sspitsyn@19266 92 #endif
duke@1 93 static void throw_pending_exception(JavaThread* thread);
duke@1 94
goetz@22836 95 #ifdef CC_INTERP
goetz@22836 96 // Profile traps in C++ interpreter.
goetz@22836 97 static void note_nullCheck_trap (JavaThread* thread, Method *method, int trap_bci);
goetz@22836 98 static void note_div0Check_trap (JavaThread* thread, Method *method, int trap_bci);
goetz@22836 99 static void note_rangeCheck_trap(JavaThread* thread, Method *method, int trap_bci);
goetz@22836 100 static void note_classCheck_trap(JavaThread* thread, Method *method, int trap_bci);
goetz@22836 101 static void note_arrayCheck_trap(JavaThread* thread, Method *method, int trap_bci);
coleenp@35214 102 // A dummy for macros that shall not profile traps.
goetz@22836 103 static void note_no_trap(JavaThread* thread, Method *method, int trap_bci) {}
goetz@22836 104 #endif // CC_INTERP
goetz@22836 105
coleenp@30132 106 static void resolve_from_cache(JavaThread* thread, Bytecodes::Code bytecode);
coleenp@30132 107 private:
duke@1 108 // Statics & fields
coleenp@30132 109 static void resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode);
duke@1 110
coleenp@30132 111 // Calls
coleenp@30132 112 static void resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode);
coleenp@30132 113 static void resolve_invokehandle (JavaThread* thread);
coleenp@30132 114 static void resolve_invokedynamic(JavaThread* thread);
coleenp@30132 115
coleenp@30132 116 public:
duke@1 117 // Synchronization
duke@1 118 static void monitorenter(JavaThread* thread, BasicObjectLock* elem);
duke@1 119 static void monitorexit (JavaThread* thread, BasicObjectLock* elem);
duke@1 120
duke@1 121 static void throw_illegal_monitor_state_exception(JavaThread* thread);
duke@1 122 static void new_illegal_monitor_state_exception(JavaThread* thread);
duke@1 123
duke@1 124 // Breakpoints
coleenp@13728 125 static void _breakpoint(JavaThread* thread, Method* method, address bcp);
coleenp@13728 126 static Bytecodes::Code get_original_bytecode_at(JavaThread* thread, Method* method, address bcp);
coleenp@13728 127 static void set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code);
duke@1 128
duke@1 129 // Safepoints
duke@1 130 static void at_safepoint(JavaThread* thread);
duke@1 131
duke@1 132 // Debugger support
duke@1 133 static void post_field_access(JavaThread *thread, oopDesc* obj,
duke@1 134 ConstantPoolCacheEntry *cp_entry);
duke@1 135 static void post_field_modification(JavaThread *thread, oopDesc* obj,
duke@1 136 ConstantPoolCacheEntry *cp_entry, jvalue *value);
duke@1 137 static void post_method_entry(JavaThread *thread);
duke@1 138 static void post_method_exit (JavaThread *thread);
duke@1 139 static int interpreter_contains(address pc);
duke@1 140
duke@1 141 // Native signature handlers
coleenp@13728 142 static void prepare_native_call(JavaThread* thread, Method* method);
duke@1 143 static address slow_signature_handler(JavaThread* thread,
coleenp@13728 144 Method* method,
duke@1 145 intptr_t* from, intptr_t* to);
duke@1 146
roland@10520 147 #if defined(IA32) || defined(AMD64) || defined(ARM)
roland@10520 148 // Popframe support (only needed on x86, AMD64 and ARM)
duke@1 149 static void popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address);
duke@1 150 #endif
duke@1 151
coleenp@37152 152 // bytecode tracing is only used by the TraceBytecodes
coleenp@37152 153 static intptr_t trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2) PRODUCT_RETURN0;
coleenp@37152 154
duke@1 155 // Platform dependent stuff
goetz@40010 156 #include CPU_HEADER(interpreterRT)
stefank@7397 157
bdelsart@31382 158 // optional normalization of fingerprints to reduce the number of adapters
bdelsart@31382 159 static uint64_t normalize_fast_native_fingerprint(uint64_t fingerprint);
duke@1 160
duke@1 161 // Interpreter's frequency counter overflow
duke@1 162 static nmethod* frequency_counter_overflow(JavaThread* thread, address branch_bcp);
duke@1 163
duke@1 164 // Interpreter profiling support
coleenp@13728 165 static jint bcp_to_di(Method* method, address cur_bcp);
iveresov@7889 166 static void profile_method(JavaThread* thread);
duke@1 167 static void update_mdp_for_ret(JavaThread* thread, int bci);
duke@1 168 #ifdef ASSERT
coleenp@13728 169 static void verify_mdp(Method* method, address bcp, address mdp);
duke@1 170 #endif // ASSERT
jiangli@17000 171 static MethodCounters* build_method_counters(JavaThread* thread, Method* m);
duke@1 172 };
duke@1 173
duke@1 174
duke@1 175 class SignatureHandlerLibrary: public AllStatic {
duke@1 176 public:
duke@1 177 enum { buffer_size = 1*K }; // the size of the temporary code buffer
duke@1 178 enum { blob_size = 32*K }; // the size of a handler code blob.
duke@1 179
duke@1 180 private:
duke@1 181 static BufferBlob* _handler_blob; // the current buffer blob containing the generated handlers
duke@1 182 static address _handler; // next available address within _handler_blob;
duke@1 183 static GrowableArray<uint64_t>* _fingerprints; // the fingerprint collection
duke@1 184 static GrowableArray<address>* _handlers; // the corresponding handlers
duke@1 185 static address _buffer; // the temporary code buffer
duke@1 186
duke@1 187 static address set_handler_blob();
duke@1 188 static void initialize();
duke@1 189 static address set_handler(CodeBuffer* buffer);
duke@1 190 static void pd_set_handler(address handler);
duke@1 191
duke@1 192 public:
coleenp@33593 193 static void add(const methodHandle& method);
bdelsart@31620 194 static void add(uint64_t fingerprint, address handler);
duke@1 195 };
stefank@7397 196
coleenp@54304 197 #endif // SHARE_INTERPRETER_INTERPRETERRUNTIME_HPP