src/hotspot/share/code/nmethod.hpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File
*** old/src/hotspot/share/code/nmethod.hpp	Thu Mar 28 11:22:24 2019
--- new/src/hotspot/share/code/nmethod.hpp	Thu Mar 28 11:22:24 2019

*** 49,89 **** --- 49,80 ---- // - pcs // [Exception handler table] // - handler entry point array // [Implicit Null Pointer exception table] // - implicit null table array + // [Speculations] + // - encoded speculations array + // [JVMCINMethodData] + // - meta data for JVMCI compiled nmethod + + #if INCLUDE_JVMCI + class FailedSpeculation; + class JVMCINMethodData; + #endif class nmethod : public CompiledMethod { friend class VMStructs; friend class JVMCIVMStructs; friend class NMethodSweeper; friend class CodeCache; // scavengable oops + friend class JVMCINMethodData; private: // Shared fields for all nmethod's int _entry_bci; // != InvocationEntryBci if this nmethod is an on-stack replacement method jmethodID _jmethod_id; // Cache of method()->jmethod_id() #if INCLUDE_JVMCI // A weak reference to an InstalledCode object associated with // this nmethod. jweak _jvmci_installed_code; // A weak reference to a SpeculationLog object associated with // this nmethod. jweak _speculation_log; // Determines whether this nmethod is unloaded when the // referent in _jvmci_installed_code is cleared. This // will be false if the referent is initialized to a // HotSpotNMethod object whose isDefault field is true. // That is, installed code other than a "default" // HotSpotNMethod causes nmethod unloading. // This field is ignored once _jvmci_installed_code is NULL. bool _jvmci_installed_code_triggers_invalidation; #endif // To support simple linked-list chaining of nmethods: nmethod* _osr_link; // from InstanceKlass::osr_nmethods_head static nmethod* volatile _oops_do_mark_nmethods; nmethod* volatile _oops_do_mark_link;
*** 105,114 **** --- 96,109 ---- int _scopes_data_offset; int _scopes_pcs_offset; int _dependencies_offset; int _handler_table_offset; int _nul_chk_table_offset; + #if INCLUDE_JVMCI + int _speculations_offset; + int _jvmci_data_offset; + #endif int _nmethod_end_offset; int code_offset() const { return (address) code_begin() - header_begin(); } // location in frame (offset for sp) that deopt can store the original
*** 205,216 **** --- 200,212 ---- ExceptionHandlerTable* handler_table, ImplicitExceptionTable* nul_chk_table, AbstractCompiler* compiler, int comp_level #if INCLUDE_JVMCI ! , jweak installed_code, jweak speculation_log ! , char* speculations, + int speculations_len, + int jvmci_data_size #endif ); // helper methods void* operator new(size_t size, int nmethod_size, int comp_level) throw();
*** 249,260 **** --- 245,259 ---- ExceptionHandlerTable* handler_table, ImplicitExceptionTable* nul_chk_table, AbstractCompiler* compiler, int comp_level #if INCLUDE_JVMCI ! , jweak installed_code = NULL, jweak speculation_log = NULL ! , char* speculations = NULL, + int speculations_len = 0, + int nmethod_mirror_index = -1, + const char* nmethod_mirror_name = NULL, + FailedSpeculation** failed_speculations = NULL #endif ); // Only used for unit tests. nmethod()
*** 297,312 **** --- 296,323 ---- address dependencies_begin () const { return header_begin() + _dependencies_offset ; } address dependencies_end () const { return header_begin() + _handler_table_offset ; } address handler_table_begin () const { return header_begin() + _handler_table_offset ; } address handler_table_end () const { return header_begin() + _nul_chk_table_offset ; } address nul_chk_table_begin () const { return header_begin() + _nul_chk_table_offset ; } + #if INCLUDE_JVMCI + address nul_chk_table_end () const { return header_begin() + _speculations_offset ; } + address speculations_begin () const { return header_begin() + _speculations_offset ; } + address speculations_end () const { return header_begin() + _jvmci_data_offset ; } + address jvmci_data_begin () const { return header_begin() + _jvmci_data_offset ; } + address jvmci_data_end () const { return header_begin() + _nmethod_end_offset ; } + #else address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; } + #endif // Sizes int oops_size () const { return (address) oops_end () - (address) oops_begin (); } int metadata_size () const { return (address) metadata_end () - (address) metadata_begin (); } int dependencies_size () const { return dependencies_end () - dependencies_begin (); } + #if INCLUDE_JVMCI + int speculations_size () const { return speculations_end () - speculations_begin (); } + int jvmci_data_size () const { return jvmci_data_end () - jvmci_data_begin (); } + #endif int oops_count() const { assert(oops_size() % oopSize == 0, ""); return (oops_size() / oopSize) + 1; } int metadata_count() const { assert(metadata_size() % wordSize == 0, ""); return (metadata_size() / wordSize) + 1; } int total_size () const;
*** 444,486 **** --- 455,477 ---- // Evolution support. We make old (discarded) compiled methods point to new Method*s. void set_method(Method* method) { _method = method; } #if INCLUDE_JVMCI ! // Gets the InstalledCode object associated with this nmethod // which may be NULL if this nmethod was not compiled by JVMCI // or the weak reference has been cleared. oop jvmci_installed_code(); // Copies the value of the name field in the InstalledCode // object (if any) associated with this nmethod into buf. // Returns the value of buf if it was updated otherwise NULL. char* jvmci_installed_code_name(char* buf, size_t buflen) const; // Updates the state of the InstalledCode (if any) associated with // this nmethod based on the current value of _state. void maybe_invalidate_installed_code(); // Deoptimizes the nmethod (if any) in the address field of a given // InstalledCode object. The address field is zeroed upon return. static void invalidate_installed_code(Handle installed_code, TRAPS); // Gets the SpeculationLog object associated with this nmethod // which may be NULL if this nmethod was not compiled by JVMCI // or the weak reference has been cleared. oop speculation_log(); ! // Gets the JVMCI name of this nmethod. + const char* jvmci_name(); private: // Deletes the weak reference (if any) to the InstalledCode object // associated with this nmethod. void clear_jvmci_installed_code(); // Deletes the weak reference (if any) to the SpeculationLog object ! // associated with this nmethod. void clear_speculation_log(); public: + // Records the pending failed speculation in the + // JVMCI speculation log associated with this nmethod. + void update_speculation(JavaThread* thread); + + // Gets the data specific to a JVMCI compiled method. + // This returns a non-NULL value iff this nmethod was ! // compiled by the JVMCI compiler. + JVMCINMethodData* jvmci_nmethod_data() const { + return jvmci_data_size() == 0 ? NULL : (JVMCINMethodData*) jvmci_data_begin(); + } #endif public: void oops_do(OopClosure* f) { oops_do(f, false); } void oops_do(OopClosure* f, bool allow_zombie);

src/hotspot/share/code/nmethod.hpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File