constMethodOop.hpp revision 3790
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_OOPS_CONSTMETHODOOP_HPP
#define SHARE_VM_OOPS_CONSTMETHODOOP_HPP
#include "oops/typeArrayOop.hpp"
// An constMethodOop represents portions of a Java method which
// do not vary.
//
// Memory layout (each line represents a word). Note that most
// applications load thousands of methods, so keeping the size of this
// structure small has a big impact on footprint.
//
// |------------------------------------------------------|
// | header |
// | klass |
// |------------------------------------------------------|
// | fingerprint 1 |
// | fingerprint 2 |
// | constants (oop) |
// | stackmap_data (oop) |
// | exception_table (oop) |
// | constMethod_size |
// | interp_kind | flags | code_size |
// | name index | signature index |
// | method_idnum | generic_signature_index |
// |------------------------------------------------------|
// | |
// | byte codes |
// | |
// |------------------------------------------------------|
// | compressed linenumber table |
// | (see class CompressedLineNumberReadStream) |
// | (note that length is unknown until decompressed) |
// | (access flags bit tells whether table is present) |
// | (indexed from start of constMethodOop) |
// | (elements not necessarily sorted!) |
// |------------------------------------------------------|
// | localvariable table elements + length (length last) |
// | (length is u2, elements are 6-tuples of u2) |
// | (see class LocalVariableTableElement) |
// | (access flags bit tells whether table is present) |
// | (indexed from end of contMethodOop) |
// |------------------------------------------------------|
// | checked exceptions elements + length (length last) |
// | (length is u2, elements are u2) |
// | (see class CheckedExceptionElement) |
// | (access flags bit tells whether table is present) |
// | (indexed from end of constMethodOop) |
// |------------------------------------------------------|
// Utitily class decribing elements in checked exceptions table inlined in methodOop.
public:
};
// Utitily class decribing elements in local variable table inlined in methodOop.
public:
};
class constMethodOopDesc : public oopDesc {
friend class constMethodKlass;
friend class VMStructs;
private:
enum {
};
// Bit vector of signature
// Callers interpret 0=not initialized yet and
// -1=too many args to fix, must parse the slow way.
// The real initial value is special to account for nonatomicity of 64 bit
// loads and stores. This value may updated and read without a lock by
// multiple threads, so is volatile.
volatile uint64_t _fingerprint;
volatile bool _is_conc_safe; // if true, safe for concurrent GC processing
public:
private:
//
// The oop block. See comment in klass.hpp before making changes.
//
// Raw stackmap data for the method
// The exception handler table. 4-tuples of ints [start_pc, end_pc,
// handler_pc, catch_type index] For methods with no exceptions the
// table is pointing to Universe::the_empty_int_array
//
// End of the oop block.
//
int _constMethod_size;
// Size of Java bytecodes allocated immediately after methodOop.
// initially corresponds to the index into the methods array.
// but this may change with redefinition
public:
// Inlined tables
int localvariable_table_len);
bool has_linenumber_table() const
{ return (_flags & _has_linenumber_table) != 0; }
bool has_checked_exceptions() const
{ return (_flags & _has_checked_exceptions) != 0; }
bool has_localvariable_table() const
{ return (_flags & _has_localvariable_table) != 0; }
int interpreter_kind(void) const { return _interpreter_kind; }
// constant pool
void set_constants(constantPoolOop c) {
}
// stackmap table data
}
// exception handler table
void set_exception_table(typeArrayOop e) { oop_store_without_check((oop*) &_exception_table, (oop) e); }
bool has_exception_handler() const { return exception_table() != NULL && exception_table()->length() > 0; }
void init_fingerprint() {
}
uint64_t fingerprint() const {
// Since reads aren't atomic for 64 bits, if any of the high or low order
// word is the initial value, return 0. See init_fingerprint for initval.
return 0L;
} else {
return _fingerprint;
}
}
#ifdef ASSERT
#endif // ASSERT
"fingerprint cannot change");
"fingerprint should call init to set initial value");
return new_fingerprint;
}
// name
int name_index() const { return _name_index; }
// signature
int signature_index() const { return _signature_index; }
// generics support
int generic_signature_index() const { return _generic_signature_index; }
// Sizing
static int header_size() {
return sizeof(constMethodOopDesc)/HeapWordSize;
}
// Object size needed
int object_size() const { return _constMethod_size; }
// Is object parsable by gc
bool object_is_parsable() { return object_size() > 0; }
// code size
int code_size() const { return _code_size; }
void set_code_size(int size) {
"u2 is too small to hold method code size in general");
_code_size = size;
}
// linenumber table - note that length is unknown until decompression,
// see class CompressedLineNumberReadStream.
u2* checked_exceptions_length_addr() const;
u2* localvariable_table_length_addr() const;
// checked exceptions
int checked_exceptions_length() const;
// localvariable table
int localvariable_table_length() const;
// byte codes
if (code_size() > 0) {
}
}
// Offset to bytecodes
static ByteSize codes_offset()
{ return in_ByteSize(sizeof(constMethodOopDesc)); }
// interpreter support
static ByteSize constants_offset()
static ByteSize exception_table_offset()
// Garbage collection support
bool is_conc_safe() { return _is_conc_safe; }
void set_is_conc_safe(bool v) { _is_conc_safe = v; }
// Unique id for the method
static const u2 UNSET_IDNUM;
private:
// Since the size of the compressed line number table is unknown, the
// offsets of the other variable sized sections are computed backwards
// from the end of the constMethodOop.
// First byte after constMethodOop
address constMethod_end() const
// Last short in constMethodOop
u2* last_u2_element() const
};
#endif // SHARE_VM_OOPS_CONSTMETHODOOP_HPP