1 /* |
1 /* |
2 * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2000-2010 Sun Microsystems, Inc. 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. |
40 private static CIntegerField headerSizeField; |
40 private static CIntegerField headerSizeField; |
41 private static CIntegerField relocationSizeField; |
41 private static CIntegerField relocationSizeField; |
42 private static CIntegerField instructionsOffsetField; |
42 private static CIntegerField instructionsOffsetField; |
43 private static CIntegerField frameCompleteOffsetField; |
43 private static CIntegerField frameCompleteOffsetField; |
44 private static CIntegerField dataOffsetField; |
44 private static CIntegerField dataOffsetField; |
45 private static CIntegerField oopsOffsetField; |
|
46 private static CIntegerField oopsLengthField; |
|
47 private static CIntegerField frameSizeField; |
45 private static CIntegerField frameSizeField; |
48 private static AddressField oopMapsField; |
46 private static AddressField oopMapsField; |
49 |
47 |
50 // Only used by server compiler on x86; computed over in SA rather |
48 // Only used by server compiler on x86; computed over in SA rather |
51 // than relying on computation in target VM |
49 // than relying on computation in target VM |
70 headerSizeField = type.getCIntegerField("_header_size"); |
68 headerSizeField = type.getCIntegerField("_header_size"); |
71 relocationSizeField = type.getCIntegerField("_relocation_size"); |
69 relocationSizeField = type.getCIntegerField("_relocation_size"); |
72 frameCompleteOffsetField = type.getCIntegerField("_frame_complete_offset"); |
70 frameCompleteOffsetField = type.getCIntegerField("_frame_complete_offset"); |
73 instructionsOffsetField = type.getCIntegerField("_instructions_offset"); |
71 instructionsOffsetField = type.getCIntegerField("_instructions_offset"); |
74 dataOffsetField = type.getCIntegerField("_data_offset"); |
72 dataOffsetField = type.getCIntegerField("_data_offset"); |
75 oopsOffsetField = type.getCIntegerField("_oops_offset"); |
|
76 oopsLengthField = type.getCIntegerField("_oops_length"); |
|
77 frameSizeField = type.getCIntegerField("_frame_size"); |
73 frameSizeField = type.getCIntegerField("_frame_size"); |
78 oopMapsField = type.getAddressField("_oop_maps"); |
74 oopMapsField = type.getAddressField("_oop_maps"); |
79 |
75 |
80 if (VM.getVM().isServerCompiler()) { |
76 if (VM.getVM().isServerCompiler()) { |
81 matcherInterpreterFramePointerReg = |
77 matcherInterpreterFramePointerReg = |
129 |
125 |
130 public Address dataEnd() { |
126 public Address dataEnd() { |
131 return headerBegin().addOffsetTo(sizeField.getValue(addr)); |
127 return headerBegin().addOffsetTo(sizeField.getValue(addr)); |
132 } |
128 } |
133 |
129 |
134 public Address oopsBegin() { |
|
135 return headerBegin().addOffsetTo(oopsOffsetField.getValue(addr)); |
|
136 } |
|
137 |
|
138 public Address oopsEnd() { |
|
139 return oopsBegin().addOffsetTo(getOopsLength()); |
|
140 } |
|
141 |
|
142 // Offsets |
130 // Offsets |
143 public int getRelocationOffset() { return (int) headerSizeField.getValue(addr); } |
131 public int getRelocationOffset() { return (int) headerSizeField.getValue(addr); } |
144 public int getInstructionsOffset() { return (int) instructionsOffsetField.getValue(addr); } |
132 public int getInstructionsOffset() { return (int) instructionsOffsetField.getValue(addr); } |
145 public int getDataOffset() { return (int) dataOffsetField.getValue(addr); } |
133 public int getDataOffset() { return (int) dataOffsetField.getValue(addr); } |
146 public int getOopsOffset() { return (int) oopsOffsetField.getValue(addr); } |
|
147 |
134 |
148 // Sizes |
135 // Sizes |
149 public int getSize() { return (int) sizeField.getValue(addr); } |
136 public int getSize() { return (int) sizeField.getValue(addr); } |
150 public int getHeaderSize() { return (int) headerSizeField.getValue(addr); } |
137 public int getHeaderSize() { return (int) headerSizeField.getValue(addr); } |
151 // FIXME: add getRelocationSize() |
138 // FIXME: add getRelocationSize() |
155 // Containment |
142 // Containment |
156 public boolean blobContains(Address addr) { return headerBegin().lessThanOrEqual(addr) && dataEnd().greaterThan(addr); } |
143 public boolean blobContains(Address addr) { return headerBegin().lessThanOrEqual(addr) && dataEnd().greaterThan(addr); } |
157 // FIXME: add relocationContains |
144 // FIXME: add relocationContains |
158 public boolean instructionsContains(Address addr) { return instructionsBegin().lessThanOrEqual(addr) && instructionsEnd().greaterThan(addr); } |
145 public boolean instructionsContains(Address addr) { return instructionsBegin().lessThanOrEqual(addr) && instructionsEnd().greaterThan(addr); } |
159 public boolean dataContains(Address addr) { return dataBegin().lessThanOrEqual(addr) && dataEnd().greaterThan(addr); } |
146 public boolean dataContains(Address addr) { return dataBegin().lessThanOrEqual(addr) && dataEnd().greaterThan(addr); } |
160 public boolean oopsContains(Address addr) { return oopsBegin().lessThanOrEqual(addr) && oopsEnd().greaterThan(addr); } |
|
161 public boolean contains(Address addr) { return instructionsContains(addr); } |
147 public boolean contains(Address addr) { return instructionsContains(addr); } |
162 public boolean isFrameCompleteAt(Address a) { return instructionsContains(a) && a.minus(instructionsBegin()) >= frameCompleteOffsetField.getValue(addr); } |
148 public boolean isFrameCompleteAt(Address a) { return instructionsContains(a) && a.minus(instructionsBegin()) >= frameCompleteOffsetField.getValue(addr); } |
163 |
|
164 /** Support for oops in scopes and relocs. Note: index 0 is reserved for null. */ |
|
165 public OopHandle getOopAt(int index) { |
|
166 if (index == 0) return null; |
|
167 if (Assert.ASSERTS_ENABLED) { |
|
168 Assert.that(index > 0 && index <= getOopsLength(), "must be a valid non-zero index"); |
|
169 } |
|
170 return oopsBegin().getOopHandleAt((index - 1) * VM.getVM().getOopSize()); |
|
171 } |
|
172 |
149 |
173 // Reclamation support (really only used by the nmethods, but in order to get asserts to work |
150 // Reclamation support (really only used by the nmethods, but in order to get asserts to work |
174 // in the CodeCache they are defined virtual here) |
151 // in the CodeCache they are defined virtual here) |
175 public boolean isZombie() { return false; } |
152 public boolean isZombie() { return false; } |
176 public boolean isLockedByVM() { return false; } |
153 public boolean isLockedByVM() { return false; } |
221 tty.print(getName()); |
198 tty.print(getName()); |
222 printComponentsOn(tty); |
199 printComponentsOn(tty); |
223 } |
200 } |
224 |
201 |
225 protected void printComponentsOn(PrintStream tty) { |
202 protected void printComponentsOn(PrintStream tty) { |
226 // FIXME: add relocation information |
|
227 tty.println(" instructions: [" + instructionsBegin() + ", " + instructionsEnd() + "), " + |
203 tty.println(" instructions: [" + instructionsBegin() + ", " + instructionsEnd() + "), " + |
228 " data: [" + dataBegin() + ", " + dataEnd() + "), " + |
204 " data: [" + dataBegin() + ", " + dataEnd() + "), " + |
229 " oops: [" + oopsBegin() + ", " + oopsEnd() + "), " + |
|
230 " frame size: " + getFrameSize()); |
205 " frame size: " + getFrameSize()); |
231 } |
206 } |
232 |
|
233 //-------------------------------------------------------------------------------- |
|
234 // Internals only below this point |
|
235 // |
|
236 |
|
237 private int getOopsLength() { |
|
238 return (int) oopsLengthField.getValue(addr); |
|
239 } |
|
240 } |
207 } |