Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/oops/Field.java @ 3945:8ed53447f690
Merge
author | iveresov |
---|---|
date | Thu, 15 Sep 2011 12:44:09 -0700 |
parents | f6f3bb0ee072 |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
3929:f94227b6117b | 3945:8ed53447f690 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2000, 2011, 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. |
37 this.isVMField = isVMField; | 37 this.isVMField = isVMField; |
38 } | 38 } |
39 | 39 |
40 /** Constructor for fields that are named in an InstanceKlass's | 40 /** Constructor for fields that are named in an InstanceKlass's |
41 fields array (i.e., named, non-VM fields) */ | 41 fields array (i.e., named, non-VM fields) */ |
42 Field(InstanceKlass holder, int fieldArrayIndex) { | 42 Field(InstanceKlass holder, int fieldIndex) { |
43 this.holder = holder; | 43 this.holder = holder; |
44 this.fieldArrayIndex = fieldArrayIndex; | 44 this.fieldIndex = fieldIndex; |
45 | 45 |
46 ConstantPool cp = holder.getConstants(); | 46 offset = holder.getFieldOffset(fieldIndex); |
47 TypeArray fields = holder.getFields(); | 47 genericSignature = holder.getFieldGenericSignature(fieldIndex); |
48 short access = fields.getShortAt(fieldArrayIndex + InstanceKlass.ACCESS_FLAGS_OFFSET); | 48 |
49 short nameIndex = fields.getShortAt(fieldArrayIndex + InstanceKlass.NAME_INDEX_OFFSET); | 49 Symbol name = holder.getFieldName(fieldIndex); |
50 short signatureIndex = fields.getShortAt(fieldArrayIndex + InstanceKlass.SIGNATURE_INDEX_OFFSET); | |
51 offset = VM.getVM().buildIntFromShorts(fields.getShortAt(fieldArrayIndex + InstanceKlass.LOW_OFFSET), | |
52 fields.getShortAt(fieldArrayIndex + InstanceKlass.HIGH_OFFSET)); | |
53 short genericSignatureIndex = fields.getShortAt(fieldArrayIndex + InstanceKlass.GENERIC_SIGNATURE_INDEX_OFFSET); | |
54 Symbol name = cp.getSymbolAt(nameIndex); | |
55 id = new NamedFieldIdentifier(name.asString()); | 50 id = new NamedFieldIdentifier(name.asString()); |
56 signature = cp.getSymbolAt(signatureIndex); | |
57 if (genericSignatureIndex != 0) { | |
58 genericSignature = cp.getSymbolAt(genericSignatureIndex); | |
59 } else { | |
60 genericSignature = null; | |
61 } | |
62 | 51 |
52 signature = holder.getFieldSignature(fieldIndex); | |
63 fieldType = new FieldType(signature); | 53 fieldType = new FieldType(signature); |
54 | |
55 short access = holder.getFieldAccessFlags(fieldIndex); | |
64 accessFlags = new AccessFlags(access); | 56 accessFlags = new AccessFlags(access); |
65 } | 57 } |
66 | 58 |
67 private long offset; | 59 private long offset; |
68 private FieldIdentifier id; | 60 private FieldIdentifier id; |
71 private InstanceKlass holder; | 63 private InstanceKlass holder; |
72 private FieldType fieldType; | 64 private FieldType fieldType; |
73 private Symbol signature; | 65 private Symbol signature; |
74 private Symbol genericSignature; | 66 private Symbol genericSignature; |
75 private AccessFlags accessFlags; | 67 private AccessFlags accessFlags; |
76 private int fieldArrayIndex; | 68 private int fieldIndex; |
77 | 69 |
78 /** Returns the byte offset of the field within the object or klass */ | 70 /** Returns the byte offset of the field within the object or klass */ |
79 public long getOffset() { return offset; } | 71 public long getOffset() { return offset; } |
80 | 72 |
81 /** Returns the identifier of the field */ | 73 /** Returns the identifier of the field */ |
99 } | 91 } |
100 | 92 |
101 /** (Named, non-VM fields only) Returns the index in the fields | 93 /** (Named, non-VM fields only) Returns the index in the fields |
102 TypeArray for this field. Equivalent to the "index" in the VM's | 94 TypeArray for this field. Equivalent to the "index" in the VM's |
103 fieldDescriptors. */ | 95 fieldDescriptors. */ |
104 public int getFieldArrayIndex() { | 96 public int getFieldIndex() { |
105 return fieldArrayIndex; | 97 return fieldIndex; |
106 } | 98 } |
107 | 99 |
108 /** (Named, non-VM fields only) Retrieves the access flags. */ | 100 /** (Named, non-VM fields only) Retrieves the access flags. */ |
109 public long getAccessFlags() { return accessFlags.getValue(); } | 101 public long getAccessFlags() { return accessFlags.getValue(); } |
110 public AccessFlags getAccessFlagsObj() { return accessFlags; } | 102 public AccessFlags getAccessFlagsObj() { return accessFlags; } |