Skip to content

Commit 0d3d4b2

Browse files
committed
logical value for JavaScriptNode, SourceSection, SourceImpl$Key, SourceSection fixed
1 parent cf65880 commit 0d3d4b2

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

visualvm/heapviewer.truffle/src/org/graalvm/visualvm/heapviewer/truffle/details/SourceDetailsProvider.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class SourceDetailsProvider extends DetailsProvider.Basic {
4242
private static final String CONTENT_NAME_MASK = "com.oracle.truffle.api.source.Content+"; // NOI18N
4343
private static final String SOURCE_NAME_MASK = "com.oracle.truffle.api.source.Source+"; // NOI18N
4444
private static final String SOURCEIMPL_KEY_MASK = "com.oracle.truffle.api.source.SourceImpl$Key"; // NOI18N
45-
public static final String SOURCE_SECTION_MASK = "com.oracle.truffle.api.source.SourceSection"; // NOI18N
45+
public static final String SOURCE_SECTION_MASK = "com.oracle.truffle.api.source.SourceSection+"; // NOI18N
4646
private static final String ASSUMPTION_MASK = "com.oracle.truffle.api.impl.AbstractAssumption+"; // NOI18N
4747
private static final String HIDDEN_KEY_MASK = "com.oracle.truffle.api.object.HiddenKey"; // NOI18N
4848
private static final String PROPERTY_MASK = "com.oracle.truffle.object.PropertyImpl"; // NOI18N
@@ -137,6 +137,11 @@ public View getDetailsView(String className, Instance instance, Heap heap) {
137137
Instance text = (Instance) val;
138138
return DetailsSupport.getDetailsView(text, heap);
139139
}
140+
val = instance.getValueOfField("content"); // NOI18N
141+
if (val instanceof Instance) {
142+
Instance text = (Instance) val;
143+
return DetailsSupport.getDetailsView(text, heap);
144+
}
140145
return null;
141146
}
142147
if (SOURCE_NAME_MASK.equals(className)) {
@@ -169,6 +174,9 @@ public View getDetailsView(String className, Instance instance, Heap heap) {
169174
Instance key = (Instance) source.getValueOfField("key"); // NOI18N
170175

171176
code = (Instance) key.getValueOfField("characters"); // NOI18N
177+
if (code == null) {
178+
code = (Instance) key.getValueOfField("content"); // NOI18N
179+
}
172180
// Likely a native method
173181
// TODO: handle differently?
174182
if (charLength == -1) code = (Instance) key.getValueOfField("name"); // NOI18N

visualvm/heapviewer.truffle/src/org/graalvm/visualvm/heapviewer/truffle/lang/javascript/JavaScriptDetailsProvider.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ public View getDetailsView(String className, Instance instance, Heap heap) {
177177
}
178178
Integer charIndexInt = (Integer) instance.getValueOfField("charIndex"); // NOI18N
179179
Integer charLengthInt = (Integer) instance.getValueOfField("charLength"); // NOI18N
180-
Instance content = (Instance) source.getValueOfField("content"); // NOI18N
181-
Instance code = (Instance) content.getValueOfField("code"); // NOI18N
180+
Instance code = getCodeString(source);
181+
if (code == null) return null;
182182
int charIndex = charIndexInt.intValue() & 0x3FFFFFFF;
183183
int charLength = charLengthInt.intValue() & 0x3FFFFFFF;
184184

@@ -187,6 +187,18 @@ public View getDetailsView(String className, Instance instance, Heap heap) {
187187
return null;
188188
}
189189

190+
private Instance getCodeString(Instance source) {
191+
Instance content = (Instance) source.getValueOfField("content"); // NOI18N
192+
if (content instanceof Instance) {
193+
return (Instance) content.getValueOfField("code"); // NOI18N
194+
}
195+
Instance key = (Instance) source.getValueOfField("key"); // NOI18N
196+
if (key instanceof Instance) {
197+
return (Instance) key.getValueOfField("content"); // NOI18N
198+
}
199+
return null;
200+
}
201+
190202
private Object getValueOfField(Instance instance, String name, JavaClass jcls) {
191203
Iterator fIt = instance.getFieldValues().iterator();
192204

0 commit comments

Comments
 (0)