Merge
This commit is contained in:
commit
ebe8b1d7f6
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,21 +52,19 @@ public class Method extends Metadata {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("Method");
|
||||
type = db.lookupType("Method");
|
||||
constMethod = type.getAddressField("_constMethod");
|
||||
methodData = type.getAddressField("_method_data");
|
||||
methodCounters = type.getAddressField("_method_counters");
|
||||
methodSize = new CIntField(type.getCIntegerField("_method_size"), 0);
|
||||
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
|
||||
code = type.getAddressField("_code");
|
||||
vtableIndex = new CIntField(type.getCIntegerField("_vtable_index"), 0);
|
||||
bytecodeOffset = type.getSize();
|
||||
|
||||
/*
|
||||
interpreterEntry = type.getAddressField("_interpreter_entry");
|
||||
fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");
|
||||
|
||||
interpreterEntry = type.getAddressField("_from_interpreted_entry");
|
||||
*/
|
||||
|
||||
objectInitializerName = null;
|
||||
classInitializerName = null;
|
||||
}
|
||||
@ -77,16 +75,22 @@ public class Method extends Metadata {
|
||||
|
||||
public boolean isMethod() { return true; }
|
||||
|
||||
// Not a Method field, used to keep type.
|
||||
private static Type type;
|
||||
|
||||
// Fields
|
||||
private static AddressField constMethod;
|
||||
private static AddressField methodData;
|
||||
private static AddressField methodCounters;
|
||||
private static CIntField methodSize;
|
||||
private static CIntField accessFlags;
|
||||
private static CIntField vtableIndex;
|
||||
private static long bytecodeOffset;
|
||||
|
||||
private static AddressField code;
|
||||
/*
|
||||
private static AddressCField fromCompiledCodeEntryPoint;
|
||||
private static AddressField interpreterEntry;
|
||||
*/
|
||||
|
||||
|
||||
// constant method names - <init>, <clinit>
|
||||
// Initialized lazily to avoid initialization ordering dependencies between Method and SymbolTable
|
||||
@ -106,11 +110,6 @@ public class Method extends Metadata {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
private static AddressCField interpreterEntry;
|
||||
private static AddressCField fromCompiledCodeEntryPoint;
|
||||
*/
|
||||
|
||||
// Accessors for declared fields
|
||||
public ConstMethod getConstMethod() {
|
||||
Address addr = constMethod.getValue(getAddress());
|
||||
@ -128,7 +127,6 @@ public class Method extends Metadata {
|
||||
return (MethodCounters) VMObjectFactory.newObject(MethodCounters.class, addr);
|
||||
}
|
||||
/** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
|
||||
public long getMethodSize() { return methodSize.getValue(this); }
|
||||
public long getMaxStack() { return getConstMethod().getMaxStack(); }
|
||||
public long getMaxLocals() { return getConstMethod().getMaxLocals(); }
|
||||
public long getSizeOfParameters() { return getConstMethod().getSizeOfParameters(); }
|
||||
@ -265,7 +263,7 @@ public class Method extends Metadata {
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return getMethodSize();
|
||||
return type.getSize() + (isNative() ? 2: 0);
|
||||
}
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
@ -273,7 +271,6 @@ public class Method extends Metadata {
|
||||
}
|
||||
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
visitor.doCInt(methodSize, true);
|
||||
visitor.doCInt(accessFlags, true);
|
||||
}
|
||||
|
||||
|
@ -72,17 +72,14 @@ Method* Method::allocate(ClassLoaderData* loader_data,
|
||||
sizes,
|
||||
method_type,
|
||||
CHECK_NULL);
|
||||
|
||||
int size = Method::size(access_flags.is_native());
|
||||
|
||||
return new (loader_data, size, false, MetaspaceObj::MethodType, THREAD) Method(cm, access_flags, size);
|
||||
return new (loader_data, size, false, MetaspaceObj::MethodType, THREAD) Method(cm, access_flags);
|
||||
}
|
||||
|
||||
Method::Method(ConstMethod* xconst, AccessFlags access_flags, int size) {
|
||||
Method::Method(ConstMethod* xconst, AccessFlags access_flags) {
|
||||
No_Safepoint_Verifier no_safepoint;
|
||||
set_constMethod(xconst);
|
||||
set_access_flags(access_flags);
|
||||
set_method_size(size);
|
||||
#ifdef CC_INTERP
|
||||
set_result_index(T_VOID);
|
||||
#endif
|
||||
@ -1227,7 +1224,6 @@ methodHandle Method::clone_with_new_data(methodHandle m, u_char* new_code, int n
|
||||
m->method_type(),
|
||||
CHECK_(methodHandle()));
|
||||
methodHandle newm (THREAD, newm_oop);
|
||||
int new_method_size = newm->method_size();
|
||||
|
||||
// Create a shallow copy of Method part, but be careful to preserve the new ConstMethod*
|
||||
ConstMethod* newcm = newm->constMethod();
|
||||
@ -1242,7 +1238,6 @@ methodHandle Method::clone_with_new_data(methodHandle m, u_char* new_code, int n
|
||||
newm->set_constMethod(newcm);
|
||||
newm->constMethod()->set_code_size(new_code_length);
|
||||
newm->constMethod()->set_constMethod_size(new_const_method_size);
|
||||
newm->set_method_size(new_method_size);
|
||||
assert(newm->code_size() == new_code_length, "check");
|
||||
assert(newm->method_parameters_length() == method_parameters_len, "check");
|
||||
assert(newm->checked_exceptions_length() == checked_exceptions_len, "check");
|
||||
|
@ -71,7 +71,6 @@ class Method : public Metadata {
|
||||
#ifdef CC_INTERP
|
||||
int _result_index; // C++ interpreter needs for converting results to/from stack
|
||||
#endif
|
||||
u2 _method_size; // size of this object
|
||||
u2 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
|
||||
|
||||
// Flags
|
||||
@ -106,7 +105,7 @@ class Method : public Metadata {
|
||||
volatile address _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry
|
||||
|
||||
// Constructor
|
||||
Method(ConstMethod* xconst, AccessFlags access_flags, int size);
|
||||
Method(ConstMethod* xconst, AccessFlags access_flags);
|
||||
public:
|
||||
|
||||
static Method* allocate(ClassLoaderData* loader_data,
|
||||
@ -241,12 +240,8 @@ class Method : public Metadata {
|
||||
// code size
|
||||
int code_size() const { return constMethod()->code_size(); }
|
||||
|
||||
// method size
|
||||
int method_size() const { return _method_size; }
|
||||
void set_method_size(int size) {
|
||||
assert(0 <= size && size < (1 << 16), "invalid method size");
|
||||
_method_size = size;
|
||||
}
|
||||
// method size in words
|
||||
int method_size() const { return sizeof(Method)/wordSize + is_native() ? 2 : 0; }
|
||||
|
||||
// constant pool for Klass* holding this method
|
||||
ConstantPool* constants() const { return constMethod()->constants(); }
|
||||
|
@ -381,7 +381,6 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
|
||||
nonstatic_field(Method, _method_counters, MethodCounters*) \
|
||||
nonstatic_field(Method, _access_flags, AccessFlags) \
|
||||
nonstatic_field(Method, _vtable_index, int) \
|
||||
nonstatic_field(Method, _method_size, u2) \
|
||||
nonstatic_field(Method, _intrinsic_id, u2) \
|
||||
nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \
|
||||
volatile_nonstatic_field(Method, _code, nmethod*) \
|
||||
|
Loading…
Reference in New Issue
Block a user