comparison agent/src/share/classes/sun/jvm/hotspot/oops/Method.java @ 6123:2fe087c3e814

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
author jiangli
date Wed, 06 Jun 2012 14:33:43 -0400
parents f6f3bb0ee072
children 8150fa46d2ed
comparison
equal deleted inserted replaced
6115:6e2633440960 6123:2fe087c3e814
1 /* 1 /*
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
46 } 46 }
47 47
48 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { 48 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
49 Type type = db.lookupType("methodOopDesc"); 49 Type type = db.lookupType("methodOopDesc");
50 constMethod = new OopField(type.getOopField("_constMethod"), 0); 50 constMethod = new OopField(type.getOopField("_constMethod"), 0);
51 constants = new OopField(type.getOopField("_constants"), 0);
52 methodData = new OopField(type.getOopField("_method_data"), 0); 51 methodData = new OopField(type.getOopField("_method_data"), 0);
53 methodSize = new CIntField(type.getCIntegerField("_method_size"), 0); 52 methodSize = new CIntField(type.getCIntegerField("_method_size"), 0);
54 maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0); 53 maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0);
55 maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0); 54 maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0);
56 sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0); 55 sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0);
81 80
82 public boolean isMethod() { return true; } 81 public boolean isMethod() { return true; }
83 82
84 // Fields 83 // Fields
85 private static OopField constMethod; 84 private static OopField constMethod;
86 private static OopField constants;
87 private static OopField methodData; 85 private static OopField methodData;
88 private static CIntField methodSize; 86 private static CIntField methodSize;
89 private static CIntField maxStack; 87 private static CIntField maxStack;
90 private static CIntField maxLocals; 88 private static CIntField maxLocals;
91 private static CIntField sizeOfParameters; 89 private static CIntField sizeOfParameters;
123 private static AddressCField fromCompiledCodeEntryPoint; 121 private static AddressCField fromCompiledCodeEntryPoint;
124 */ 122 */
125 123
126 // Accessors for declared fields 124 // Accessors for declared fields
127 public ConstMethod getConstMethod() { return (ConstMethod) constMethod.getValue(this); } 125 public ConstMethod getConstMethod() { return (ConstMethod) constMethod.getValue(this); }
128 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } 126 public ConstantPool getConstants() {
127 return getConstMethod().getConstants();
128 }
129 public MethodData getMethodData() { return (MethodData) methodData.getValue(this); } 129 public MethodData getMethodData() { return (MethodData) methodData.getValue(this); }
130 public TypeArray getExceptionTable() { return getConstMethod().getExceptionTable(); } 130 public TypeArray getExceptionTable() { return getConstMethod().getExceptionTable(); }
131 /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */ 131 /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
132 public long getMethodSize() { return methodSize.getValue(this); } 132 public long getMethodSize() { return methodSize.getValue(this); }
133 public long getMaxStack() { return maxStack.getValue(this); } 133 public long getMaxStack() { return maxStack.getValue(this); }
279 279
280 public void iterateFields(OopVisitor visitor, boolean doVMFields) { 280 public void iterateFields(OopVisitor visitor, boolean doVMFields) {
281 super.iterateFields(visitor, doVMFields); 281 super.iterateFields(visitor, doVMFields);
282 if (doVMFields) { 282 if (doVMFields) {
283 visitor.doOop(constMethod, true); 283 visitor.doOop(constMethod, true);
284 visitor.doOop(constants, true);
285 visitor.doCInt(methodSize, true); 284 visitor.doCInt(methodSize, true);
286 visitor.doCInt(maxStack, true); 285 visitor.doCInt(maxStack, true);
287 visitor.doCInt(maxLocals, true); 286 visitor.doCInt(maxLocals, true);
288 visitor.doCInt(sizeOfParameters, true); 287 visitor.doCInt(sizeOfParameters, true);
289 visitor.doCInt(accessFlags, true); 288 visitor.doCInt(accessFlags, true);