Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/debugger/cdbg/basic/BasicArrayType.java @ 1913:3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
Summary: Allow CONSTANT_InvokeDynamic nodes to have any number of extra operands.
Reviewed-by: twisti
author | jrose |
---|---|
date | Sat, 30 Oct 2010 13:08:23 -0700 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.debugger.cdbg.basic; | |
26 | |
27 import sun.jvm.hotspot.debugger.*; | |
28 import sun.jvm.hotspot.debugger.cdbg.*; | |
29 | |
30 public class BasicArrayType extends BasicType implements ArrayType { | |
31 private Type elementType; | |
32 private int length; | |
33 | |
34 public BasicArrayType(String name, Type elementType, int sizeInBytes) { | |
35 this(name, elementType, sizeInBytes, 0, 0); | |
36 } | |
37 | |
38 private BasicArrayType(String name, Type elementType, int sizeInBytes, int length, int cvAttributes) { | |
39 super(name, sizeInBytes, cvAttributes); | |
40 this.elementType = elementType; | |
41 this.length = length; | |
42 } | |
43 | |
44 public ArrayType asArray() { return this; } | |
45 | |
46 public Type getElementType() { return elementType; } | |
47 public int getLength() { return length; } | |
48 | |
49 Type resolveTypes(BasicCDebugInfoDataBase db, ResolveListener listener) { | |
50 super.resolveTypes(db, listener); | |
51 elementType = db.resolveType(this, elementType, listener, "resolving array element type"); | |
52 // FIXME: need to figure out whether we have to align object sizes | |
53 // ourselves (see below) | |
54 if (!((BasicType) elementType).isLazy()) { | |
55 length = getSize() / elementType.getSize(); | |
56 } | |
57 return this; | |
58 } | |
59 | |
60 public void iterateObject(Address a, ObjectVisitor v, FieldIdentifier f) { | |
61 // What kind of iteration are we doing? If the end user requested | |
62 // iteration over a given array at a given address, the field | |
63 // identifier will be null, and we should descend and iterate | |
64 // through the array. Otherwise, we are already iterating through | |
65 // an object, and it is up to the end user whether to descend into | |
66 // the embedded object. | |
67 | |
68 if (f == null) { | |
69 v.enterType(this, a); | |
70 for (int i = 0; i < getLength(); i++) { | |
71 // FIXME: need to figure out whether we need to align object | |
72 // sizes ourselves (i.e., round up to doubleword size) or | |
73 // whether that reported in the debug info is already aligned | |
74 // (in Microsoft's compiler, I think the struct alignment is | |
75 // an option, so it's possible that there is nothing we are | |
76 // allowed to do here) | |
77 ((BasicType) getElementType()).iterateObject(a.addOffsetTo(i * getElementType().getSize()), | |
78 v, | |
79 new BasicIndexableFieldIdentifier(getElementType(), i)); | |
80 } | |
81 v.exitType(); | |
82 } else { | |
83 v.doArray(f, a); | |
84 } | |
85 } | |
86 | |
87 protected Type createCVVariant(int cvAttributes) { | |
88 return new BasicArrayType(getName(), getElementType(), getSize(), getLength(), cvAttributes); | |
89 } | |
90 | |
91 public void visit(TypeVisitor v) { | |
92 v.doArrayType(this); | |
93 } | |
94 } |