Skip to content

Commit 0c70bd2

Browse files
committed
update jvm.hotspot.code.CodeBlob class
1 parent c401e77 commit 0c70bd2

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

src/hotspot/share/runtime/vmStructs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@
560560
nonstatic_field(CodeBlob, _frame_size, int) \
561561
nonstatic_field(CodeBlob, _oop_maps, ImmutableOopMapSet*) \
562562
nonstatic_field(CodeBlob, _caller_must_gc_arguments, bool) \
563+
nonstatic_field(CodeBlob, _mutable_data, address) \
564+
nonstatic_field(CodeBlob, _mutable_data_size, int) \
563565
\
564566
nonstatic_field(DeoptimizationBlob, _unpack_offset, int) \
565567
\
@@ -592,8 +594,6 @@
592594
nonstatic_field(nmethod, _osr_entry_point, address) \
593595
nonstatic_field(nmethod, _immutable_data, address) \
594596
nonstatic_field(nmethod, _immutable_data_size, int) \
595-
nonstatic_field(nmethod, _mutable_data, address) \
596-
nonstatic_field(nmethod, _mutable_data_size, int) \
597597
nonstatic_field(nmethod, _compile_id, int) \
598598
nonstatic_field(nmethod, _comp_level, CompLevel) \
599599
volatile_nonstatic_field(nmethod, _exception_cache, ExceptionCache*) \

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ public class CodeBlob extends VMObject {
4747
private static CIntField headerSizeField;
4848
private static CIntegerField contentOffsetField;
4949
private static CIntegerField codeOffsetField;
50+
private static CIntegerField codeEndOffsetField;
5051
private static CIntField frameCompleteOffsetField;
51-
private static CIntegerField dataOffsetField;
5252
private static CIntegerField frameSizeField;
5353
private static AddressField oopMapsField;
54+
private static AddressField mutableDataField;
55+
private static CIntegerField mutableDataSizeField;
5456

5557
public CodeBlob(Address addr) {
5658
super(addr);
@@ -68,9 +70,11 @@ private static void initialize(TypeDataBase db) {
6870
contentOffsetField = type.getCIntegerField("_content_offset");
6971
codeOffsetField = type.getCIntegerField("_code_offset");
7072
frameCompleteOffsetField = new CIntField(type.getCIntegerField("_frame_complete_offset"), 0);
71-
dataOffsetField = type.getCIntegerField("_data_offset");
73+
codeEndOffsetField = type.getCIntegerField("_code_end_offset");
7274
frameSizeField = type.getCIntegerField("_frame_size");
7375
oopMapsField = type.getAddressField("_oop_maps");
76+
mutableDataField = type.getAddressField("_mutable_data");
77+
mutableDataSizeField = type.getCIntegerField("_mutable_data_size");
7478

7579
if (VM.getVM().isServerCompiler()) {
7680
matcherInterpreterFramePointerReg =
@@ -92,15 +96,16 @@ public void update(Observable o, Object data) {
9296

9397
public Address contentBegin() { return headerBegin().addOffsetTo(getContentOffset()); }
9498

95-
public Address contentEnd() { return headerBegin().addOffsetTo(getDataOffset()); }
99+
public Address contentEnd() { return headerBegin().addOffsetTo(getCodeEndOffset()); }
96100

97101
public Address codeBegin() { return headerBegin().addOffsetTo(getCodeOffset()); }
98102

99-
public Address codeEnd() { return headerBegin().addOffsetTo(getDataOffset()); }
103+
public Address codeEnd() { return headerBegin().addOffsetTo(getCodeEndOffset()); }
100104

101-
public Address dataBegin() { return headerBegin().addOffsetTo(getDataOffset()); }
105+
public Address dataBegin() { return mutableDataField.getValue(addr); }
102106

103-
public Address dataEnd() { return headerBegin().addOffsetTo(getSize()); }
107+
public Address dataEnd() { return (dataBegin() == null) ? dataBegin() :
108+
dataBegin().addOffsetTo(mutableDataSizeField.getValue(addr)); }
104109

105110
// Offsets
106111
public int getContentOffset() { return (int) contentOffsetField.getValue(addr); }
@@ -109,7 +114,7 @@ public void update(Observable o, Object data) {
109114

110115
public long getFrameCompleteOffset() { return frameCompleteOffsetField.getValue(addr); }
111116

112-
public int getDataOffset() { return (int) dataOffsetField.getValue(addr); }
117+
public int getCodeEndOffset() { return (int) codeEndOffsetField.getValue(addr); }
113118

114119
// Sizes
115120
public int getSize() { return (int) sizeField.getValue(addr); }
@@ -176,14 +181,15 @@ public NMethod asNMethodOrNull() {
176181
public int getDataSize() { return (int) dataEnd() .minus(dataBegin()); }
177182

178183
// Containment
179-
public boolean blobContains(Address addr) { return headerBegin() .lessThanOrEqual(addr) && dataEnd() .greaterThan(addr); }
184+
public boolean blobContains(Address addr) { return headerBegin() .lessThanOrEqual(addr) && codeEnd() .greaterThan(addr); }
180185

181186
// FIXME: add relocationContains
182187
public boolean contentContains(Address addr) { return contentBegin().lessThanOrEqual(addr) && contentEnd().greaterThan(addr); }
183188

184189
public boolean codeContains(Address addr) { return codeBegin() .lessThanOrEqual(addr) && codeEnd() .greaterThan(addr); }
185190

186-
public boolean dataContains(Address addr) { return dataBegin() .lessThanOrEqual(addr) && dataEnd() .greaterThan(addr); }
191+
public boolean dataContains(Address addr) { return (dataBegin() == null) ? false :
192+
dataBegin() .lessThanOrEqual(addr) && dataEnd() .greaterThan(addr); }
187193

188194
public boolean contains(Address addr) { return contentContains(addr); }
189195

0 commit comments

Comments
 (0)