@@ -93,15 +93,15 @@ abstract class TruffleObjectMergedFields<O extends TruffleObject> {
93
93
94
94
95
95
private int objectsCount () { return objects .getObjectsCount (); }
96
- private Iterator <O > objectsIterator () { return objects .getObjectsIterator (); }
96
+ private Iterator <O > objectsIterator () { return new InterruptibleIterator ( objects .getObjectsIterator () ); }
97
97
98
98
private HeapViewerNode createObjectNode (O object ) {
99
99
return (HeapViewerNode )getLanguage ().createObjectNode (object , object .getType (heap ));
100
100
}
101
101
102
102
103
103
HeapViewerNode [] getNodes (HeapViewerNode parent , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) throws InterruptedException {
104
- final Set <FieldDescriptor > fields = getAllObjectsFields (objects , progress );
104
+ final Set <FieldDescriptor > fields = getAllObjectsFields (progress );
105
105
NodesComputer <FieldDescriptor > computer = new NodesComputer <FieldDescriptor >(fields .size (), UIThresholds .MAX_INSTANCE_FIELDS ) {
106
106
protected boolean sorts (DataType dataType ) {
107
107
return true ;
@@ -127,20 +127,16 @@ protected String getNodesContainerString(String firstNodeIdx, String lastNodeIdx
127
127
}
128
128
129
129
130
- private Set <FieldDescriptor > getAllObjectsFields (TruffleObjectsWrapper < O > objects , Progress progress ) throws InterruptedException {
130
+ private Set <FieldDescriptor > getAllObjectsFields (Progress progress ) throws InterruptedException {
131
131
boolean filtersProperties = filtersFields ();
132
132
133
133
Set <FieldDescriptor > allFields = new HashSet ();
134
- Iterator <O > objectsI = objects .getObjectsIterator ();
135
-
136
- Thread worker = Thread .currentThread ();
134
+ Iterator <O > objectsI = objectsIterator ();
137
135
138
136
progress .setupKnownSteps (objects .getObjectsCount ());
139
137
140
138
try {
141
139
while (objectsI .hasNext ()) {
142
- if (worker .isInterrupted ()) throw new InterruptedException ();
143
-
144
140
progress .step ();
145
141
146
142
Collection <FieldValue > fields = getFields (objectsI .next ());
@@ -153,6 +149,7 @@ private Set<FieldDescriptor> getAllObjectsFields(TruffleObjectsWrapper<O> object
153
149
}
154
150
}
155
151
}
152
+ if (Thread .currentThread ().isInterrupted ()) throw new InterruptedException ();
156
153
} finally {
157
154
progress .finish ();
158
155
}
@@ -208,19 +205,16 @@ protected HeapViewerNode[] lazilyComputeChildren(Heap heap, String viewID, HeapV
208
205
209
206
progress .setupKnownSteps (objectsCount ());
210
207
211
- Thread worker = Thread .currentThread ();
212
-
213
208
Iterator <O > objects = objectsIterator ();
214
209
try {
215
210
while (objects .hasNext ()) {
216
- if (worker .isInterrupted ()) throw new InterruptedException ();
217
-
218
211
O o = objects .next ();
219
212
progress .step ();
220
213
FieldValue value = getValueOfField (o , fieldName );
221
214
if (value instanceof ObjectFieldValue )
222
215
values .count (((ObjectFieldValue )value ).getInstance ());
223
216
}
217
+ if (Thread .currentThread ().isInterrupted ()) throw new InterruptedException ();
224
218
} finally {
225
219
progress .finish ();
226
220
}
@@ -275,13 +269,9 @@ protected String getNodesContainerString(String firstNodeIdx, String lastNodeIdx
275
269
276
270
progress .setupKnownSteps (objectsCount ());
277
271
278
- Thread worker = Thread .currentThread ();
279
-
280
272
Iterator <O > objects = objectsIterator ();
281
273
try {
282
274
while (objects .hasNext ()) {
283
- if (worker .isInterrupted ()) throw new InterruptedException ();
284
-
285
275
O o = objects .next ();
286
276
progress .step ();
287
277
FieldValue value = getValueOfField (o , fieldName );
@@ -292,6 +282,7 @@ protected String getNodesContainerString(String firstNodeIdx, String lastNodeIdx
292
282
values .put (val , ++count );
293
283
}
294
284
}
285
+ if (Thread .currentThread ().isInterrupted ()) throw new InterruptedException ();
295
286
} finally {
296
287
progress .finish ();
297
288
}
0 commit comments