< prev index next > src/hotspot/share/runtime/sharedRuntime.hpp
Print this page
*/
#ifndef SHARE_RUNTIME_SHAREDRUNTIME_HPP
#define SHARE_RUNTIME_SHAREDRUNTIME_HPP
+ #include "asm/codeBuffer.hpp"
#include "code/codeBlob.hpp"
#include "code/vmreg.hpp"
#include "interpreter/linkResolver.hpp"
#include "memory/allStatic.hpp"
#include "memory/resourceArea.hpp"
+ #include "runtime/signature.hpp"
#include "runtime/stubDeclarations.hpp"
#include "utilities/macros.hpp"
class AdapterHandlerEntry;
class AdapterFingerPrint;
class vframeStream;
+ class SigEntry;
// Runtime is the base class for various runtime interfaces
// (InterpreterRuntime, CompilerRuntime, etc.). It provides
// shared functionality such as exception forwarding (C++ to
// Java exceptions), locking/unlocking mechanisms, statistical
// The caller (or one of it's callers) must use a ResourceMark
// in order to correctly free the result.
//
static char* generate_class_cast_message(Klass* caster_klass, Klass* target_klass, Symbol* target_klass_name = nullptr);
+ static char* generate_identity_exception_message(JavaThread* thr, Klass* klass);
+
// Resolves a call site- may patch in the destination of the call into the
// compiled code.
- static methodHandle resolve_helper(bool is_virtual, bool is_optimized, TRAPS);
+ static methodHandle resolve_helper(bool is_virtual, bool is_optimized, bool& caller_is_c1, TRAPS);
private:
// deopt blob
static void generate_deopt_blob(void);
static bool handle_ic_miss_helper_internal(Handle receiver, nmethod* caller_nm, const frame& caller_frame,
methodHandle callee_method, Bytecodes::Code bc, CallInfo& call_info,
- bool& needs_ic_stub_refill, TRAPS);
+ bool& needs_ic_stub_refill, bool& is_optimized, bool caller_is_c1, TRAPS);
public:
static DeoptimizationBlob* deopt_blob(void) { return _deopt_blob; }
// Resets a call-site in compiled code so it will get resolved again.
- static methodHandle reresolve_call_site(TRAPS);
+ static methodHandle reresolve_call_site(bool& is_static_call, bool& is_optimized, bool& caller_is_c1, TRAPS);
// In the code prolog, if the klass comparison fails, the inline cache
// misses and the call site is patched to megamorphic
- static methodHandle handle_ic_miss_helper(TRAPS);
+ static methodHandle handle_ic_miss_helper(bool& is_optimized, bool& caller_is_c1, TRAPS);
// Find the method that called us.
- static methodHandle find_callee_method(TRAPS);
+ static methodHandle find_callee_method(bool is_optimized, bool& caller_is_c1, TRAPS);
static void monitor_enter_helper(oopDesc* obj, BasicLock* lock, JavaThread* thread);
static void monitor_exit_helper(oopDesc* obj, BasicLock* lock, JavaThread* current);
// based off of the window top. SharedInfo::stack0 refers to the first usable
// slot in the bottom of the frame. SharedInfo::stack0+1 refers to the memory word
// 4-bytes higher.
// return value is the maximum number of VMReg stack slots the convention will use.
static int java_calling_convention(const BasicType* sig_bt, VMRegPair* regs, int total_args_passed);
+ static int java_calling_convention(const GrowableArray<SigEntry>* sig, VMRegPair* regs) {
+ BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, sig->length());
+ int total_args_passed = SigEntry::fill_sig_bt(sig, sig_bt);
+ return java_calling_convention(sig_bt, regs, total_args_passed);
+ }
+ static int java_return_convention(const BasicType* sig_bt, VMRegPair* regs, int total_args_passed);
+ static const uint java_return_convention_max_int;
+ static const uint java_return_convention_max_float;
static void check_member_name_argument_is_last_argument(const methodHandle& method,
const BasicType* sig_bt,
const VMRegPair* regs) NOT_DEBUG_RETURN;
// that the interpreter before it does any call dispatch will record the current
// stack pointer in the interpreter frame. On return it will restore the stack
// pointer as needed. This means the i2c adapter code doesn't need any special
// handshaking path with compiled code to keep the stack walking correct.
- static AdapterHandlerEntry* generate_i2c2i_adapters(MacroAssembler *_masm,
- int total_args_passed,
- int max_arg,
- const BasicType *sig_bt,
- const VMRegPair *regs,
- AdapterFingerPrint* fingerprint);
+ static AdapterHandlerEntry* generate_i2c2i_adapters(MacroAssembler *masm,
+ int comp_args_on_stack,
+ const GrowableArray<SigEntry>* sig,
+ const VMRegPair* regs,
+ const GrowableArray<SigEntry>* sig_cc,
+ const VMRegPair* regs_cc,
+ const GrowableArray<SigEntry>* sig_cc_ro,
+ const VMRegPair* regs_cc_ro,
+ AdapterFingerPrint* fingerprint,
+ AdapterBlob*& new_adapter,
+ bool allocate_code_blob);
static void gen_i2c_adapter(MacroAssembler *_masm,
- int total_args_passed,
int comp_args_on_stack,
- const BasicType *sig_bt,
+ const GrowableArray<SigEntry>* sig,
const VMRegPair *regs);
// OSR support
// OSR_migration_begin will extract the jvm state from an interpreter
// Slow-path Locking and Unlocking
static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current);
static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* current);
// Resolving of calls
- static address get_resolved_entry (JavaThread* current, methodHandle callee_method);
+ static address get_resolved_entry (JavaThread* current, methodHandle callee_method,
+ bool is_static_call, bool is_optimized, bool caller_is_c1);
static address resolve_static_call_C (JavaThread* current);
static address resolve_virtual_call_C (JavaThread* current);
static address resolve_opt_virtual_call_C(JavaThread* current);
+ static void load_inline_type_fields_in_regs(JavaThread* current, oopDesc* res);
+ static void store_inline_type_fields_to_buf(JavaThread* current, intptr_t res);
+
// arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
static void slow_arraycopy_C(oopDesc* src, jint src_pos,
oopDesc* dest, jint dest_pos,
jint length, JavaThread* thread);
// handle ic miss with caller being compiled code
// wrong method handling (inline cache misses)
static address handle_wrong_method(JavaThread* current);
static address handle_wrong_method_abstract(JavaThread* current);
static address handle_wrong_method_ic_miss(JavaThread* current);
+ static void allocate_inline_types(JavaThread* current, Method* callee, bool allocate_receiver);
+ static oop allocate_inline_types_impl(JavaThread* current, methodHandle callee, bool allocate_receiver, TRAPS);
static address handle_unsafe_access(JavaThread* thread, address next_pc);
+ static BufferedInlineTypeBlob* generate_buffered_inline_type_adapter(const InlineKlass* vk);
#ifndef PRODUCT
// Collect and print inline cache miss statistics
private:
enum { maxICmiss_count = 100 };
private:
AdapterFingerPrint* _fingerprint;
address _i2c_entry;
address _c2i_entry;
+ address _c2i_inline_entry;
+ address _c2i_inline_ro_entry;
address _c2i_unverified_entry;
+ address _c2i_unverified_inline_entry;
address _c2i_no_clinit_check_entry;
+ // Support for scalarized inline type calling convention
+ const GrowableArray<SigEntry>* _sig_cc;
+
#ifdef ASSERT
// Captures code and signature used to generate this adapter when
// verifying adapter equivalence.
unsigned char* _saved_code;
int _saved_code_length;
#endif
AdapterHandlerEntry(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry,
- address c2i_unverified_entry,
+ address c2i_inline_entry, address c2i_inline_ro_entry,
+ address c2i_unverified_entry, address c2i_unverified_inline_entry,
address c2i_no_clinit_check_entry) :
_fingerprint(fingerprint),
_i2c_entry(i2c_entry),
_c2i_entry(c2i_entry),
+ _c2i_inline_entry(c2i_inline_entry),
+ _c2i_inline_ro_entry(c2i_inline_ro_entry),
_c2i_unverified_entry(c2i_unverified_entry),
- _c2i_no_clinit_check_entry(c2i_no_clinit_check_entry)
+ _c2i_unverified_inline_entry(c2i_unverified_inline_entry),
+ _c2i_no_clinit_check_entry(c2i_no_clinit_check_entry),
+ _sig_cc(nullptr)
#ifdef ASSERT
, _saved_code_length(0)
#endif
{ }
~AdapterHandlerEntry();
public:
- address get_i2c_entry() const { return _i2c_entry; }
- address get_c2i_entry() const { return _c2i_entry; }
- address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }
- address get_c2i_no_clinit_check_entry() const { return _c2i_no_clinit_check_entry; }
+ address get_i2c_entry() const { return _i2c_entry; }
+ address get_c2i_entry() const { return _c2i_entry; }
+ address get_c2i_inline_entry() const { return _c2i_inline_entry; }
+ address get_c2i_inline_ro_entry() const { return _c2i_inline_ro_entry; }
+ address get_c2i_unverified_entry() const { return _c2i_unverified_entry; }
+ address get_c2i_unverified_inline_entry() const { return _c2i_unverified_inline_entry; }
+ address get_c2i_no_clinit_check_entry() const { return _c2i_no_clinit_check_entry; }
address base_address();
void relocate(address new_base);
+ // Support for scalarized inline type calling convention
+ void set_sig_cc(const GrowableArray<SigEntry>* sig) { _sig_cc = sig; }
+ const GrowableArray<SigEntry>* get_sig_cc() const { return _sig_cc; }
+
AdapterFingerPrint* fingerprint() const { return _fingerprint; }
#ifdef ASSERT
// Used to verify that code generated for shared adapters is equivalent
void save_code (unsigned char* code, int length);
//virtual void print_on(outputStream* st) const; DO NOT USE
void print_adapter_on(outputStream* st) const;
};
+ class CompiledEntrySignature;
+
class AdapterHandlerLibrary: public AllStatic {
friend class SharedRuntime;
private:
static BufferBlob* _buffer; // the temporary code buffer in CodeCache
static AdapterHandlerEntry* _abstract_method_handler;
static AdapterHandlerEntry* _obj_obj_arg_handler;
static BufferBlob* buffer_blob();
static void initialize();
static AdapterHandlerEntry* create_adapter(AdapterBlob*& new_adapter,
- int total_args_passed,
- BasicType* sig_bt,
+ CompiledEntrySignature& ces,
bool allocate_code_blob);
static AdapterHandlerEntry* get_simple_adapter(const methodHandle& method);
public:
static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
- address i2c_entry,
- address c2i_entry,
- address c2i_unverified_entry,
- address c2i_no_clinit_check_entry = nullptr);
+ address i2c_entry, address c2i_entry, address c2i_inline_entry, address c2i_inline_ro_entry,
+ address c2i_unverified_entry, address c2i_unverified_inline_entry, address c2i_no_clinit_check_entry = nullptr);
static void create_native_wrapper(const methodHandle& method);
static AdapterHandlerEntry* get_adapter(const methodHandle& method);
static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
static void print_handler_on(outputStream* st, const CodeBlob* b);
static void print_statistics();
#endif // PRODUCT
};
+ // Utility class for computing the calling convention of the 3 types
+ // of compiled method entries:
+ // Method::_from_compiled_entry - sig_cc
+ // Method::_from_compiled_inline_ro_entry - sig_cc_ro
+ // Method::_from_compiled_inline_entry - sig
+ class CompiledEntrySignature : public StackObj {
+ Method* _method;
+ int _num_inline_args;
+ bool _has_inline_recv;
+ GrowableArray<SigEntry>* _sig;
+ GrowableArray<SigEntry>* _sig_cc;
+ GrowableArray<SigEntry>* _sig_cc_ro;
+ VMRegPair* _regs;
+ VMRegPair* _regs_cc;
+ VMRegPair* _regs_cc_ro;
+
+ int _args_on_stack;
+ int _args_on_stack_cc;
+ int _args_on_stack_cc_ro;
+
+ bool _c1_needs_stack_repair;
+ bool _c2_needs_stack_repair;
+
+ GrowableArray<Method*>* _supers;
+
+ public:
+ Method* method() const { return _method; }
+
+ // Used by Method::_from_compiled_inline_entry
+ GrowableArray<SigEntry>* sig() const { return _sig; }
+
+ // Used by Method::_from_compiled_entry
+ GrowableArray<SigEntry>* sig_cc() const { return _sig_cc; }
+
+ // Used by Method::_from_compiled_inline_ro_entry
+ GrowableArray<SigEntry>* sig_cc_ro() const { return _sig_cc_ro; }
+
+ VMRegPair* regs() const { return _regs; }
+ VMRegPair* regs_cc() const { return _regs_cc; }
+ VMRegPair* regs_cc_ro() const { return _regs_cc_ro; }
+
+ int args_on_stack() const { return _args_on_stack; }
+ int args_on_stack_cc() const { return _args_on_stack_cc; }
+ int args_on_stack_cc_ro() const { return _args_on_stack_cc_ro; }
+
+ int num_inline_args() const { return _num_inline_args; }
+ bool has_inline_recv() const { return _has_inline_recv; }
+
+ bool has_scalarized_args() const { return _sig != _sig_cc; }
+ bool c1_needs_stack_repair() const { return _c1_needs_stack_repair; }
+ bool c2_needs_stack_repair() const { return _c2_needs_stack_repair; }
+ CodeOffsets::Entries c1_inline_ro_entry_type() const;
+
+ GrowableArray<Method*>* get_supers();
+
+ CompiledEntrySignature(Method* method = nullptr);
+ void compute_calling_conventions(bool init = true);
+ };
+
#endif // SHARE_RUNTIME_SHAREDRUNTIME_HPP
< prev index next >