提交 c6207a37 编写于 作者: J jiangli

7172967: Eliminate constMethod's _method backpointer to methodOop.

Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod.
Reviewed-by: roland, bdelsart, kamg
上级 5ee6cad1
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -50,8 +50,7 @@ public class ConstMethod extends Oop {
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type type = db.lookupType("constMethodOopDesc");
// Backpointer to non-const methodOop
method = new OopField(type.getOopField("_method"), 0);
constants = new OopField(type.getOopField("_constants"), 0);
// 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
......@@ -69,6 +68,7 @@ public class ConstMethod extends Oop {
nameIndex = new CIntField(type.getCIntegerField("_name_index"), 0);
signatureIndex = new CIntField(type.getCIntegerField("_signature_index"), 0);
genericSignatureIndex = new CIntField(type.getCIntegerField("_generic_signature_index"),0);
idnum = new CIntField(type.getCIntegerField("_method_idnum"), 0);
// start of byte code
bytecodeOffset = type.getSize();
......@@ -85,7 +85,7 @@ public class ConstMethod extends Oop {
}
// Fields
private static OopField method;
private static OopField constants;
private static OopField exceptionTable;
private static CIntField constMethodSize;
private static ByteField flags;
......@@ -93,6 +93,7 @@ public class ConstMethod extends Oop {
private static CIntField nameIndex;
private static CIntField signatureIndex;
private static CIntField genericSignatureIndex;
private static CIntField idnum;
// start of bytecode
private static long bytecodeOffset;
......@@ -100,9 +101,15 @@ public class ConstMethod extends Oop {
private static long checkedExceptionElementSize;
private static long localVariableTableElementSize;
// Accessors for declared fields
public Method getMethod() {
return (Method) method.getValue(this);
InstanceKlass ik = (InstanceKlass)getConstants().getPoolHolder();
ObjArray methods = ik.getMethods();
return (Method)methods.getObjAt(getIdNum());
}
// Accessors for declared fields
public ConstantPool getConstants() {
return (ConstantPool) constants.getValue(this);
}
public TypeArray getExceptionTable() {
......@@ -133,6 +140,10 @@ public class ConstMethod extends Oop {
return genericSignatureIndex.getValue(this);
}
public long getIdNum() {
return idnum.getValue(this);
}
public Symbol getName() {
return getMethod().getName();
}
......@@ -223,7 +234,7 @@ public class ConstMethod extends Oop {
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
super.iterateFields(visitor, doVMFields);
if (doVMFields) {
visitor.doOop(method, true);
visitor.doOop(constants, true);
visitor.doOop(exceptionTable, true);
visitor.doCInt(constMethodSize, true);
visitor.doByte(flags, true);
......
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, 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
......@@ -48,7 +48,6 @@ public class Method extends Oop {
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type type = db.lookupType("methodOopDesc");
constMethod = new OopField(type.getOopField("_constMethod"), 0);
constants = new OopField(type.getOopField("_constants"), 0);
methodData = new OopField(type.getOopField("_method_data"), 0);
methodSize = new CIntField(type.getCIntegerField("_method_size"), 0);
maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0);
......@@ -83,7 +82,6 @@ public class Method extends Oop {
// Fields
private static OopField constMethod;
private static OopField constants;
private static OopField methodData;
private static CIntField methodSize;
private static CIntField maxStack;
......@@ -125,7 +123,9 @@ public class Method extends Oop {
// Accessors for declared fields
public ConstMethod getConstMethod() { return (ConstMethod) constMethod.getValue(this); }
public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
public ConstantPool getConstants() {
return getConstMethod().getConstants();
}
public MethodData getMethodData() { return (MethodData) methodData.getValue(this); }
public TypeArray getExceptionTable() { return getConstMethod().getExceptionTable(); }
/** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
......@@ -281,7 +281,6 @@ public class Method extends Oop {
super.iterateFields(visitor, doVMFields);
if (doVMFields) {
visitor.doOop(constMethod, true);
visitor.doOop(constants, true);
visitor.doCInt(methodSize, true);
visitor.doCInt(maxStack, true);
visitor.doCInt(maxLocals, true);
......
/*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2012, 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
......@@ -490,7 +490,8 @@ address InterpreterGenerator::generate_accessor_entry(void) {
ConstantPoolCacheEntry::size()) * BytesPerWord), G1_scratch);
// get constant pool cache
__ ld_ptr(G5_method, in_bytes(methodOopDesc::constants_offset()), G3_scratch);
__ ld_ptr(G5_method, in_bytes(methodOopDesc::const_offset()), G3_scratch);
__ ld_ptr(G3_scratch, in_bytes(constMethodOopDesc::constants_offset()), G3_scratch);
__ ld_ptr(G3_scratch, constantPoolOopDesc::cache_offset_in_bytes(), G3_scratch);
// get specific constant pool cache entry
......@@ -768,7 +769,8 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
// for static methods insert the mirror argument
const int mirror_offset = in_bytes(Klass::java_mirror_offset());
__ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc:: constants_offset())), O1);
__ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc:: const_offset())), O1);
__ ld_ptr(Address(O1, 0, in_bytes(constMethodOopDesc::constants_offset())), O1);
__ ld_ptr(Address(O1, 0, constantPoolOopDesc::pool_holder_offset_in_bytes()), O1);
__ ld_ptr(O1, mirror_offset, O1);
// where the mirror handle body is allocated:
......@@ -1047,7 +1049,7 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
assert_different_registers(state, prev_state);
assert_different_registers(prev_state, G3_scratch);
const Register Gtmp = G3_scratch;
const Address constants (G5_method, 0, in_bytes(methodOopDesc::constants_offset()));
const Address constMethod (G5_method, 0, in_bytes(methodOopDesc::const_offset()));
const Address access_flags (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset()));
const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset()));
const Address max_stack (G5_method, 0, in_bytes(methodOopDesc::max_stack_offset()));
......@@ -1155,7 +1157,8 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
__ set((int) BytecodeInterpreter::method_entry, O1);
__ st(O1, XXX_STATE(_msg));
__ ld_ptr(constants, O3);
__ ld_ptr(constMethod, O3);
__ ld_ptr(O3, in_bytes(constMethodOopDesc::constants_offset()), O3);
__ ld_ptr(O3, constantPoolOopDesc::cache_offset_in_bytes(), O2);
__ st_ptr(O2, XXX_STATE(_constants));
......@@ -1178,7 +1181,8 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
__ ld_ptr(XXX_STATE(_locals), O1);
__ br( Assembler::zero, true, Assembler::pt, got_obj);
__ delayed()->ld_ptr(O1, 0, O1); // get receiver for not-static case
__ ld_ptr(constants, O1);
__ ld_ptr(constMethod, O1);
__ ld_ptr( O1, in_bytes(constMethodOopDesc::constants_offset()), O1);
__ ld_ptr( O1, constantPoolOopDesc::pool_holder_offset_in_bytes(), O1);
// lock the mirror, not the klassOop
__ ld_ptr( O1, mirror_offset, O1);
......@@ -1536,7 +1540,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
const Register Gtmp1 = G3_scratch;
// const Register Lmirror = L1; // native mirror (native calls only)
const Address constants (G5_method, 0, in_bytes(methodOopDesc::constants_offset()));
const Address constMethod (G5_method, 0, in_bytes(methodOopDesc::const_offset()));
const Address access_flags (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset()));
const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset()));
const Address max_stack (G5_method, 0, in_bytes(methodOopDesc::max_stack_offset()));
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
......@@ -934,8 +934,14 @@ void InterpreterMacroAssembler::index_check(Register array, Register index, int
}
void InterpreterMacroAssembler::get_const(Register Rdst) {
ld_ptr(Lmethod, in_bytes(methodOopDesc::const_offset()), Rdst);
}
void InterpreterMacroAssembler::get_constant_pool(Register Rdst) {
ld_ptr(Lmethod, in_bytes(methodOopDesc::constants_offset()), Rdst);
get_const(Rdst);
ld_ptr(Rdst, in_bytes(constMethodOopDesc::constants_offset()), Rdst);
}
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
......@@ -205,6 +205,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
void index_check(Register array, Register index, int index_shift, Register tmp, Register res);
void index_check_without_pop(Register array, Register index, int index_shift, Register tmp, Register res);
void get_const(Register Rdst);
void get_constant_pool(Register Rdst);
void get_constant_pool_cache(Register Rdst);
void get_cpool_and_tags(Register Rcpool, Register Rtags);
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
......@@ -371,7 +371,8 @@ void InterpreterGenerator::lock_method(void) {
__ br( Assembler::zero, true, Assembler::pt, done);
__ delayed()->ld_ptr(Llocals, Interpreter::local_offset_in_bytes(0), O0); // get receiver for not-static case
__ ld_ptr( Lmethod, in_bytes(methodOopDesc::constants_offset()), O0);
__ ld_ptr( Lmethod, in_bytes(methodOopDesc::const_offset()), O0);
__ ld_ptr( O0, in_bytes(constMethodOopDesc::constants_offset()), O0);
__ ld_ptr( O0, constantPoolOopDesc::pool_holder_offset_in_bytes(), O0);
// lock the mirror, not the klassOop
......@@ -670,7 +671,8 @@ address InterpreterGenerator::generate_accessor_entry(void) {
ConstantPoolCacheEntry::size()) * BytesPerWord), G1_scratch);
// get constant pool cache
__ ld_ptr(G5_method, methodOopDesc::constants_offset(), G3_scratch);
__ ld_ptr(G5_method, methodOopDesc::const_offset(), G3_scratch);
__ ld_ptr(G3_scratch, constMethodOopDesc::constants_offset(), G3_scratch);
__ ld_ptr(G3_scratch, constantPoolOopDesc::cache_offset_in_bytes(), G3_scratch);
// get specific constant pool cache entry
......@@ -993,7 +995,8 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
// for static methods insert the mirror argument
const int mirror_offset = in_bytes(Klass::java_mirror_offset());
__ ld_ptr(Lmethod, methodOopDesc:: constants_offset(), O1);
__ ld_ptr(Lmethod, methodOopDesc:: const_offset(), O1);
__ ld_ptr(O1, constMethodOopDesc::constants_offset(), O1);
__ ld_ptr(O1, constantPoolOopDesc::pool_holder_offset_in_bytes(), O1);
__ ld_ptr(O1, mirror_offset, O1);
#ifdef ASSERT
......
/*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2012, 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
......@@ -481,7 +481,8 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
__ xorptr(rdx, rdx);
__ movptr(STATE(_oop_temp), rdx); // state->_oop_temp = NULL (only really needed for native)
__ movptr(STATE(_mdx), rdx); // state->_mdx = NULL
__ movptr(rdx, Address(rbx, methodOopDesc::constants_offset()));
__ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rdx, Address(rdx, constMethodOopDesc::constants_offset()));
__ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes()));
__ movptr(STATE(_constants), rdx); // state->_constants = constants()
......@@ -516,7 +517,8 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
__ testl(rax, JVM_ACC_STATIC);
__ movptr(rax, Address(locals, 0)); // get receiver (assume this is frequent case)
__ jcc(Assembler::zero, done);
__ movptr(rax, Address(rbx, methodOopDesc::constants_offset()));
__ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
__ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes()));
__ movptr(rax, Address(rax, mirror_offset));
__ bind(done);
......@@ -769,7 +771,8 @@ void InterpreterGenerator::lock_method(void) {
__ testl(rax, JVM_ACC_STATIC);
__ movptr(rax, Address(rdi, 0)); // get receiver (assume this is frequent case)
__ jcc(Assembler::zero, done);
__ movptr(rax, Address(rbx, methodOopDesc::constants_offset()));
__ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
__ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes()));
__ movptr(rax, Address(rax, mirror_offset));
__ bind(done);
......@@ -821,9 +824,9 @@ address InterpreterGenerator::generate_accessor_entry(void) {
__ testptr(rax, rax);
__ jcc(Assembler::zero, slow_path);
__ movptr(rdi, Address(rbx, methodOopDesc::constants_offset()));
// read first instruction word and extract bytecode @ 1 and index @ 2
__ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rdi, Address(rdx, constMethodOopDesc::constants_offset()));
__ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset()));
// Shift codes right to get the index on the right.
// The bytecode fetched looks like <index><0xb4><0x2a>
......@@ -1185,7 +1188,8 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
__ testl(t, JVM_ACC_STATIC);
__ jcc(Assembler::zero, L);
// get mirror
__ movptr(t, Address(method, methodOopDesc:: constants_offset()));
__ movptr(t, Address(method, methodOopDesc:: const_offset()));
__ movptr(t, Address(t, constMethodOopDesc::constants_offset()));
__ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes()));
__ movptr(t, Address(t, mirror_offset));
// copy mirror into activation object
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
......@@ -77,7 +77,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
// Helpers for runtime call arguments/results
void get_method(Register reg) { movptr(reg, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); }
void get_constant_pool(Register reg) { get_method(reg); movptr(reg, Address(reg, methodOopDesc::constants_offset())); }
void get_const(Register reg) { get_method(reg); movptr(reg, Address(reg, methodOopDesc::const_offset())); }
void get_constant_pool(Register reg) { get_const(reg); movptr(reg, Address(reg, constMethodOopDesc::constants_offset())); }
void get_constant_pool_cache(Register reg) { get_constant_pool(reg); movptr(reg, Address(reg, constantPoolOopDesc::cache_offset_in_bytes())); }
void get_cpool_and_tags(Register cpool, Register tags) { get_constant_pool(cpool); movptr(tags, Address(cpool, constantPoolOopDesc::tags_offset_in_bytes()));
}
......
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -84,9 +84,14 @@ class InterpreterMacroAssembler: public MacroAssembler {
movptr(reg, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
}
void get_constant_pool(Register reg) {
void get_const(Register reg) {
get_method(reg);
movptr(reg, Address(reg, methodOopDesc::constants_offset()));
movptr(reg, Address(reg, methodOopDesc::const_offset()));
}
void get_constant_pool(Register reg) {
get_const(reg);
movptr(reg, Address(reg, constMethodOopDesc::constants_offset()));
}
void get_constant_pool_cache(Register reg) {
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
......@@ -566,7 +566,8 @@ void InterpreterGenerator::lock_method(void) {
__ testl(rax, JVM_ACC_STATIC);
__ movptr(rax, Address(rdi, Interpreter::local_offset_in_bytes(0))); // get receiver (assume this is frequent case)
__ jcc(Assembler::zero, done);
__ movptr(rax, Address(rbx, methodOopDesc::constants_offset()));
__ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
__ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes()));
__ movptr(rax, Address(rax, mirror_offset));
__ bind(done);
......@@ -606,7 +607,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ push(0);
}
__ movptr(rdx, Address(rbx, methodOopDesc::constants_offset()));
__ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rdx, Address(rdx, constMethodOopDesc::constants_offset()));
__ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes()));
__ push(rdx); // set constant pool cache
__ push(rdi); // set locals pointer
......@@ -661,9 +663,9 @@ address InterpreterGenerator::generate_accessor_entry(void) {
__ testptr(rax, rax);
__ jcc(Assembler::zero, slow_path);
__ movptr(rdi, Address(rbx, methodOopDesc::constants_offset()));
// read first instruction word and extract bytecode @ 1 and index @ 2
__ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rdi, Address(rdx, constMethodOopDesc::constants_offset()));
__ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset()));
// Shift codes right to get the index on the right.
// The bytecode fetched looks like <index><0xb4><0x2a>
......@@ -1026,7 +1028,8 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
__ testl(t, JVM_ACC_STATIC);
__ jcc(Assembler::zero, L);
// get mirror
__ movptr(t, Address(method, methodOopDesc:: constants_offset()));
__ movptr(t, Address(method, methodOopDesc:: const_offset()));
__ movptr(t, Address(t, constMethodOopDesc::constants_offset()));
__ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes()));
__ movptr(t, Address(t, mirror_offset));
// copy mirror into activation frame
......
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -522,7 +522,8 @@ void InterpreterGenerator::lock_method(void) {
// get receiver (assume this is frequent case)
__ movptr(rax, Address(r14, Interpreter::local_offset_in_bytes(0)));
__ jcc(Assembler::zero, done);
__ movptr(rax, Address(rbx, methodOopDesc::constants_offset()));
__ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
__ movptr(rax, Address(rax,
constantPoolOopDesc::pool_holder_offset_in_bytes()));
__ movptr(rax, Address(rax, mirror_offset));
......@@ -579,7 +580,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ push(0);
}
__ movptr(rdx, Address(rbx, methodOopDesc::constants_offset()));
__ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rdx, Address(rdx, constMethodOopDesc::constants_offset()));
__ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes()));
__ push(rdx); // set constant pool cache
__ push(r14); // set locals pointer
......@@ -629,9 +631,9 @@ address InterpreterGenerator::generate_accessor_entry(void) {
__ testptr(rax, rax);
__ jcc(Assembler::zero, slow_path);
__ movptr(rdi, Address(rbx, methodOopDesc::constants_offset()));
// read first instruction word and extract bytecode @ 1 and index @ 2
__ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
__ movptr(rdi, Address(rdx, constMethodOopDesc::constants_offset()));
__ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset()));
// Shift codes right to get the index on the right.
// The bytecode fetched looks like <index><0xb4><0x2a>
......@@ -1020,7 +1022,8 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
__ testl(t, JVM_ACC_STATIC);
__ jcc(Assembler::zero, L);
// get mirror
__ movptr(t, Address(method, methodOopDesc::constants_offset()));
__ movptr(t, Address(method, methodOopDesc::const_offset()));
__ movptr(t, Address(t, constMethodOopDesc::constants_offset()));
__ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes()));
__ movptr(t, Address(t, mirror_offset));
// copy mirror into activation frame
......
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -220,10 +220,10 @@ int generateJvmOffsets(GEN_variant gen_variant) {
printf("\n");
GEN_OFFS(methodOopDesc, _constMethod);
GEN_OFFS(methodOopDesc, _constants);
GEN_OFFS(methodOopDesc, _access_flags);
printf("\n");
GEN_OFFS(constMethodOopDesc, _constants);
GEN_OFFS(constMethodOopDesc, _flags);
GEN_OFFS(constMethodOopDesc, _code_size);
GEN_OFFS(constMethodOopDesc, _name_index);
......
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -118,7 +118,7 @@ dtrace:helper:ustack:
copyin_offset(OFFSET_Symbol_body);
copyin_offset(OFFSET_methodOopDesc_constMethod);
copyin_offset(OFFSET_methodOopDesc_constants);
copyin_offset(OFFSET_constMethodOopDesc_constants);
copyin_offset(OFFSET_constMethodOopDesc_name_index);
copyin_offset(OFFSET_constMethodOopDesc_signature_index);
......@@ -359,8 +359,8 @@ dtrace:helper:ustack:
this->signatureIndex = copyin_uint16(this->constMethod +
OFFSET_constMethodOopDesc_signature_index);
this->constantPool = copyin_ptr(this->methodOopPtr +
OFFSET_methodOopDesc_constants);
this->constantPool = copyin_ptr(this->constMethod +
OFFSET_constMethodOopDesc_constants);
this->nameSymbol = copyin_ptr(this->constantPool +
this->nameIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
......
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -514,10 +514,10 @@ name_for_methodOop(jvm_agent_t* J, uint64_t methodOopPtr, char * result, size_t
char * signatureString = NULL;
int err;
err = read_pointer(J, methodOopPtr + OFFSET_methodOopDesc_constants, &constantPool);
CHECK_FAIL(err);
err = read_pointer(J, methodOopPtr + OFFSET_methodOopDesc_constMethod, &constMethod);
CHECK_FAIL(err);
err = read_pointer(J->P, constMethod + OFFSET_constMethodOopDesc_constants, &constantPool);
CHECK_FAIL(err);
/* To get name string */
err = ps_pread(J->P, constMethod + OFFSET_constMethodOopDesc_name_index, &nameIndex, 2);
......
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -80,7 +80,7 @@ constMethodOop constMethodKlass::allocate(int byte_code_size,
No_Safepoint_Verifier no_safepoint;
cm->set_interpreter_kind(Interpreter::invalid);
cm->init_fingerprint();
cm->set_method(NULL);
cm->set_constants(NULL);
cm->set_stackmap_data(NULL);
cm->set_exception_table(NULL);
cm->set_code_size(byte_code_size);
......@@ -98,7 +98,7 @@ constMethodOop constMethodKlass::allocate(int byte_code_size,
void constMethodKlass::oop_follow_contents(oop obj) {
assert (obj->is_constMethod(), "object must be constMethod");
constMethodOop cm = constMethodOop(obj);
MarkSweep::mark_and_push(cm->adr_method());
MarkSweep::mark_and_push(cm->adr_constants());
MarkSweep::mark_and_push(cm->adr_stackmap_data());
MarkSweep::mark_and_push(cm->adr_exception_table());
// Performance tweak: We skip iterating over the klass pointer since we
......@@ -110,7 +110,7 @@ void constMethodKlass::oop_follow_contents(ParCompactionManager* cm,
oop obj) {
assert (obj->is_constMethod(), "object must be constMethod");
constMethodOop cm_oop = constMethodOop(obj);
PSParallelCompact::mark_and_push(cm, cm_oop->adr_method());
PSParallelCompact::mark_and_push(cm, cm_oop->adr_constants());
PSParallelCompact::mark_and_push(cm, cm_oop->adr_stackmap_data());
PSParallelCompact::mark_and_push(cm, cm_oop->adr_exception_table());
// Performance tweak: We skip iterating over the klass pointer since we
......@@ -121,7 +121,7 @@ void constMethodKlass::oop_follow_contents(ParCompactionManager* cm,
int constMethodKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
assert (obj->is_constMethod(), "object must be constMethod");
constMethodOop cm = constMethodOop(obj);
blk->do_oop(cm->adr_method());
blk->do_oop(cm->adr_constants());
blk->do_oop(cm->adr_stackmap_data());
blk->do_oop(cm->adr_exception_table());
// Get size before changing pointers.
......@@ -135,7 +135,7 @@ int constMethodKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr)
assert (obj->is_constMethod(), "object must be constMethod");
constMethodOop cm = constMethodOop(obj);
oop* adr;
adr = cm->adr_method();
adr = cm->adr_constants();
if (mr.contains(adr)) blk->do_oop(adr);
adr = cm->adr_stackmap_data();
if (mr.contains(adr)) blk->do_oop(adr);
......@@ -153,7 +153,7 @@ int constMethodKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr)
int constMethodKlass::oop_adjust_pointers(oop obj) {
assert(obj->is_constMethod(), "should be constMethod");
constMethodOop cm = constMethodOop(obj);
MarkSweep::adjust_pointer(cm->adr_method());
MarkSweep::adjust_pointer(cm->adr_constants());
MarkSweep::adjust_pointer(cm->adr_stackmap_data());
MarkSweep::adjust_pointer(cm->adr_exception_table());
// Get size before changing pointers.
......@@ -188,8 +188,8 @@ void constMethodKlass::oop_print_on(oop obj, outputStream* st) {
assert(obj->is_constMethod(), "must be constMethod");
Klass::oop_print_on(obj, st);
constMethodOop m = constMethodOop(obj);
st->print(" - method: " INTPTR_FORMAT " ", (address)m->method());
m->method()->print_value_on(st); st->cr();
st->print(" - constants: " INTPTR_FORMAT " ", (address)m->constants());
m->constants()->print_value_on(st); st->cr();
st->print(" - exceptions: " INTPTR_FORMAT "\n", (address)m->exception_table());
if (m->has_stackmap_table()) {
st->print(" - stackmap data: ");
......@@ -223,8 +223,8 @@ void constMethodKlass::oop_verify_on(oop obj, outputStream* st) {
// Verification can occur during oop construction before the method or
// other fields have been initialized.
if (!obj->partially_loaded()) {
guarantee(m->method()->is_perm(), "should be in permspace");
guarantee(m->method()->is_method(), "should be method");
guarantee(m->constants()->is_perm(), "should be in permspace");
guarantee(m->constants()->is_constantPool(), "should be constant pool");
typeArrayOop stackmap_data = m->stackmap_data();
guarantee(stackmap_data == NULL ||
stackmap_data->is_perm(), "should be in permspace");
......
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -53,6 +53,10 @@ int constMethodOopDesc::object_size(int code_size,
return align_object_size(header_size() + extra_words);
}
methodOop constMethodOopDesc::method() const {
return instanceKlass::cast(_constants->pool_holder())->method_with_idnum(
_method_idnum);
}
// linenumber table - note that length is unknown until decompression,
// see class CompressedLineNumberReadStream.
......
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, 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
......@@ -41,7 +41,7 @@
// |------------------------------------------------------|
// | fingerprint 1 |
// | fingerprint 2 |
// | method (oop) |
// | constants (oop) |
// | stackmap_data (oop) |
// | exception_table (oop) |
// | constMethod_size |
......@@ -113,7 +113,7 @@ private:
volatile bool _is_conc_safe; // if true, safe for concurrent GC processing
public:
oop* oop_block_beg() const { return adr_method(); }
oop* oop_block_beg() const { return adr_constants(); }
oop* oop_block_end() const { return adr_exception_table() + 1; }
private:
......@@ -121,8 +121,7 @@ private:
// The oop block. See comment in klass.hpp before making changes.
//
// Backpointer to non-const methodOop (needed for some JVMTI operations)
methodOop _method;
constantPoolOop _constants; // Constant pool
// Raw stackmap data for the method
typeArrayOop _stackmap_data;
......@@ -167,10 +166,13 @@ public:
void set_interpreter_kind(int kind) { _interpreter_kind = kind; }
int interpreter_kind(void) const { return _interpreter_kind; }
// backpointer to non-const methodOop
methodOop method() const { return _method; }
void set_method(methodOop m) { oop_store_without_check((oop*)&_method, (oop) m); }
// constant pool
constantPoolOop constants() const { return _constants; }
void set_constants(constantPoolOop c) {
oop_store_without_check((oop*)&_constants, (oop)c);
}
methodOop method() const;
// stackmap table data
typeArrayOop stackmap_data() const { return _stackmap_data; }
......@@ -278,11 +280,13 @@ public:
{ return in_ByteSize(sizeof(constMethodOopDesc)); }
// interpreter support
static ByteSize constants_offset()
{ return byte_offset_of(constMethodOopDesc, _constants); }
static ByteSize exception_table_offset()
{ return byte_offset_of(constMethodOopDesc, _exception_table); }
// Garbage collection support
oop* adr_method() const { return (oop*)&_method; }
oop* adr_constants() const { return (oop*)&_constants; }
oop* adr_stackmap_data() const { return (oop*)&_stackmap_data; }
oop* adr_exception_table() const { return (oop*)&_exception_table; }
bool is_conc_safe() { return _is_conc_safe; }
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, 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
......@@ -112,11 +112,6 @@ methodOop methodKlass::allocate(constMethodHandle xconst,
assert(m->is_parsable(), "must be parsable here.");
assert(m->size() == size, "wrong size for object");
// We should not publish an uprasable object's reference
// into one that is parsable, since that presents problems
// for the concurrent parallel marking and precleaning phases
// of concurrent gc (CMS).
xconst->set_method(m);
return m;
}
......@@ -127,7 +122,6 @@ void methodKlass::oop_follow_contents(oop obj) {
// Performance tweak: We skip iterating over the klass pointer since we
// know that Universe::methodKlassObj never moves.
MarkSweep::mark_and_push(m->adr_constMethod());
MarkSweep::mark_and_push(m->adr_constants());
if (m->method_data() != NULL) {
MarkSweep::mark_and_push(m->adr_method_data());
}
......@@ -141,7 +135,6 @@ void methodKlass::oop_follow_contents(ParCompactionManager* cm,
// Performance tweak: We skip iterating over the klass pointer since we
// know that Universe::methodKlassObj never moves.
PSParallelCompact::mark_and_push(cm, m->adr_constMethod());
PSParallelCompact::mark_and_push(cm, m->adr_constants());
#ifdef COMPILER2
if (m->method_data() != NULL) {
PSParallelCompact::mark_and_push(cm, m->adr_method_data());
......@@ -159,7 +152,6 @@ int methodKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
// Performance tweak: We skip iterating over the klass pointer since we
// know that Universe::methodKlassObj never moves
blk->do_oop(m->adr_constMethod());
blk->do_oop(m->adr_constants());
if (m->method_data() != NULL) {
blk->do_oop(m->adr_method_data());
}
......@@ -178,8 +170,6 @@ int methodKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
oop* adr;
adr = m->adr_constMethod();
if (mr.contains(adr)) blk->do_oop(adr);
adr = m->adr_constants();
if (mr.contains(adr)) blk->do_oop(adr);
if (m->method_data() != NULL) {
adr = m->adr_method_data();
if (mr.contains(adr)) blk->do_oop(adr);
......@@ -197,7 +187,6 @@ int methodKlass::oop_adjust_pointers(oop obj) {
// Performance tweak: We skip iterating over the klass pointer since we
// know that Universe::methodKlassObj never moves.
MarkSweep::adjust_pointer(m->adr_constMethod());
MarkSweep::adjust_pointer(m->adr_constants());
if (m->method_data() != NULL) {
MarkSweep::adjust_pointer(m->adr_method_data());
}
......@@ -213,7 +202,6 @@ int methodKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
assert(obj->is_method(), "should be method");
methodOop m = methodOop(obj);
PSParallelCompact::adjust_pointer(m->adr_constMethod());
PSParallelCompact::adjust_pointer(m->adr_constants());
#ifdef COMPILER2
if (m->method_data() != NULL) {
PSParallelCompact::adjust_pointer(m->adr_method_data());
......@@ -339,8 +327,6 @@ void methodKlass::oop_verify_on(oop obj, outputStream* st) {
if (!obj->partially_loaded()) {
methodOop m = methodOop(obj);
guarantee(m->is_perm(), "should be in permspace");
guarantee(m->constants()->is_perm(), "should be in permspace");
guarantee(m->constants()->is_constantPool(), "should be constant pool");
guarantee(m->constMethod()->is_constMethod(), "should be constMethodOop");
guarantee(m->constMethod()->is_perm(), "should be in permspace");
methodDataOop method_data = m->method_data();
......
......@@ -531,9 +531,9 @@ int methodOopDesc::line_number_from_bci(int bci) const {
bool methodOopDesc::is_klass_loaded_by_klass_index(int klass_index) const {
if( _constants->tag_at(klass_index).is_unresolved_klass() ) {
if( constants()->tag_at(klass_index).is_unresolved_klass() ) {
Thread *thread = Thread::current();
Symbol* klass_name = _constants->klass_name_at(klass_index);
Symbol* klass_name = constants()->klass_name_at(klass_index);
Handle loader(thread, instanceKlass::cast(method_holder())->class_loader());
Handle prot (thread, Klass::cast(method_holder())->protection_domain());
return SystemDictionary::find(klass_name, loader, prot, thread) != NULL;
......@@ -544,7 +544,7 @@ bool methodOopDesc::is_klass_loaded_by_klass_index(int klass_index) const {
bool methodOopDesc::is_klass_loaded(int refinfo_index, bool must_be_resolved) const {
int klass_index = _constants->klass_ref_index_at(refinfo_index);
int klass_index = constants()->klass_ref_index_at(refinfo_index);
if (must_be_resolved) {
// Make sure klass is resolved in constantpool.
if (constants()->tag_at(klass_index).is_unresolved_klass()) return false;
......@@ -886,11 +886,13 @@ oop methodOopDesc::method_handle_type() const {
}
jint* methodOopDesc::method_type_offsets_chain() {
static jint pchase[] = { -1, -1, -1 };
static jint pchase[] = { -1, -1, -1, -1 };
if (pchase[0] == -1) {
jint step0 = in_bytes(constants_offset());
jint step1 = (constantPoolOopDesc::header_size() + _imcp_method_type_value) * HeapWordSize;
jint step0 = in_bytes(const_offset());
jint step1 = in_bytes(constMethodOopDesc::constants_offset());
jint step2 = (constantPoolOopDesc::header_size() + _imcp_method_type_value) * HeapWordSize;
// do this in reverse to avoid races:
OrderAccess::release_store(&pchase[2], step2);
OrderAccess::release_store(&pchase[1], step1);
OrderAccess::release_store(&pchase[0], step0);
}
......@@ -1076,9 +1078,7 @@ methodHandle methodOopDesc:: clone_with_new_data(methodHandle m, u_char* new_cod
assert(m->constMethod()->is_parsable(), "Should remain parsable");
// Reset correct method/const method, method size, and parameter info
newcm->set_method(newm());
newm->set_constMethod(newcm);
assert(newcm->method() == newm(), "check");
newm->constMethod()->set_code_size(new_code_length);
newm->constMethod()->set_constMethod_size(new_const_method_size);
newm->set_method_size(new_method_size);
......
......@@ -64,7 +64,6 @@
// | klass |
// |------------------------------------------------------|
// | constMethodOop (oop) |
// | constants (oop) |
// |------------------------------------------------------|
// | methodData (oop) |
// | interp_invocation_count |
......@@ -110,7 +109,6 @@ class methodOopDesc : public oopDesc {
friend class VMStructs;
private:
constMethodOop _constMethod; // Method read-only data.
constantPoolOop _constants; // Constant pool
methodDataOop _method_data;
int _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
AccessFlags _access_flags; // Access flags
......@@ -170,17 +168,17 @@ class methodOopDesc : public oopDesc {
void set_access_flags(AccessFlags flags) { _access_flags = flags; }
// name
Symbol* name() const { return _constants->symbol_at(name_index()); }
Symbol* name() const { return constants()->symbol_at(name_index()); }
int name_index() const { return constMethod()->name_index(); }
void set_name_index(int index) { constMethod()->set_name_index(index); }
// signature
Symbol* signature() const { return _constants->symbol_at(signature_index()); }
Symbol* signature() const { return constants()->symbol_at(signature_index()); }
int signature_index() const { return constMethod()->signature_index(); }
void set_signature_index(int index) { constMethod()->set_signature_index(index); }
// generics support
Symbol* generic_signature() const { int idx = generic_signature_index(); return ((idx != 0) ? _constants->symbol_at(idx) : (Symbol*)NULL); }
Symbol* generic_signature() const { int idx = generic_signature_index(); return ((idx != 0) ? constants()->symbol_at(idx) : (Symbol*)NULL); }
int generic_signature_index() const { return constMethod()->generic_signature_index(); }
void set_generic_signature_index(int index) { constMethod()->set_generic_signature_index(index); }
......@@ -242,8 +240,8 @@ class methodOopDesc : public oopDesc {
}
// constant pool for klassOop holding this method
constantPoolOop constants() const { return _constants; }
void set_constants(constantPoolOop c) { oop_store_without_check((oop*)&_constants, c); }
constantPoolOop constants() const { return constMethod()->constants(); }
void set_constants(constantPoolOop c) { constMethod()->set_constants(c); }
// max stack
int max_stack() const { return _max_stack; }
......@@ -453,7 +451,7 @@ class methodOopDesc : public oopDesc {
{ return constMethod()->compressed_linenumber_table(); }
// method holder (the klassOop holding this method)
klassOop method_holder() const { return _constants->pool_holder(); }
klassOop method_holder() const { return constants()->pool_holder(); }
void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
Symbol* klass_name() const; // returns the name of the method holder
......@@ -544,7 +542,6 @@ class methodOopDesc : public oopDesc {
// interpreter support
static ByteSize const_offset() { return byte_offset_of(methodOopDesc, _constMethod ); }
static ByteSize constants_offset() { return byte_offset_of(methodOopDesc, _constants ); }
static ByteSize access_flags_offset() { return byte_offset_of(methodOopDesc, _access_flags ); }
#ifdef CC_INTERP
static ByteSize result_index_offset() { return byte_offset_of(methodOopDesc, _result_index ); }
......@@ -723,7 +720,6 @@ class methodOopDesc : public oopDesc {
// Garbage collection support
oop* adr_constMethod() const { return (oop*)&_constMethod; }
oop* adr_constants() const { return (oop*)&_constants; }
oop* adr_method_data() const { return (oop*)&_method_data; }
};
......
......@@ -358,7 +358,6 @@ static inline uint64_t cast_uint64_t(size_t x)
nonstatic_field(methodDataOopDesc, _arg_stack, intx) \
nonstatic_field(methodDataOopDesc, _arg_returned, intx) \
nonstatic_field(methodOopDesc, _constMethod, constMethodOop) \
nonstatic_field(methodOopDesc, _constants, constantPoolOop) \
nonstatic_field(methodOopDesc, _method_data, methodDataOop) \
nonstatic_field(methodOopDesc, _interpreter_invocation_count, int) \
nonstatic_field(methodOopDesc, _access_flags, AccessFlags) \
......@@ -378,7 +377,7 @@ static inline uint64_t cast_uint64_t(size_t x)
volatile_nonstatic_field(methodOopDesc, _from_compiled_entry, address) \
volatile_nonstatic_field(methodOopDesc, _from_interpreted_entry, address) \
volatile_nonstatic_field(constMethodOopDesc, _fingerprint, uint64_t) \
nonstatic_field(constMethodOopDesc, _method, methodOop) \
nonstatic_field(constMethodOopDesc, _constants, constantPoolOop) \
nonstatic_field(constMethodOopDesc, _stackmap_data, typeArrayOop) \
nonstatic_field(constMethodOopDesc, _exception_table, typeArrayOop) \
nonstatic_field(constMethodOopDesc, _constMethod_size, int) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册