Skip to content

Commit 30118e6

Browse files
committed
Remove laying-out cancellations for non-chunked layouters
1 parent 79efd4d commit 30118e6

File tree

4 files changed

+16
-50
lines changed

4 files changed

+16
-50
lines changed

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/ChunkedImageHeapLayouter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ private Error reportHugeObjectError(ImageHeapObject info, String objectTypeMsg,
157157
}
158158
}
159159

160+
@Override
161+
public ImageHeapLayoutInfo layout(ImageHeap imageHeap, int pageSize) {
162+
return layout(imageHeap, pageSize, () -> false);
163+
}
164+
160165
@Override
161166
public ImageHeapLayoutInfo layout(ImageHeap imageHeap, int pageSize, ImageHeapLayingOutController controller) {
162167
ImageHeapLayingOutControl control = new ImageHeapLayingOutControl(controller);

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/image/ImageHeapLayouter.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
package com.oracle.svm.core.image;
2626

27+
import com.oracle.svm.core.util.VMError;
28+
2729
import java.nio.ByteBuffer;
2830

2931
/**
@@ -45,16 +47,16 @@ public interface ImageHeapLayouter {
4547
/**
4648
* Places all heap partitions and assigns objects their final offsets.
4749
*/
48-
default ImageHeapLayoutInfo layout(ImageHeap imageHeap, int pageSize) {
49-
return layout(imageHeap, pageSize, new NonCancellableImageHeapLayingOutController());
50-
}
50+
ImageHeapLayoutInfo layout(ImageHeap imageHeap, int pageSize);
5151

5252
/**
5353
* Cancellable version of {@link ImageHeapLayouter#layout(ImageHeap, int)}. Cancellation is
5454
* performed via {@link ImageHeapLayingOutController}.. If the layout is cancelled, an instance
5555
* of {@link ImageHeapLayingOutCancelledException} is thrown.
5656
*/
57-
ImageHeapLayoutInfo layout(ImageHeap imageHeap, int pageSize, ImageHeapLayingOutController controller);
57+
default ImageHeapLayoutInfo layout(ImageHeap imageHeap, int pageSize, ImageHeapLayingOutController controller) {
58+
throw VMError.unimplemented("This layouter does not support cancellation");
59+
}
5860

5961
/** Hook to run tasks after heap layout is finished. */
6062
@SuppressWarnings("unused")

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/image/NonCancellableImageHeapLayingOutController.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

web-image/src/com.oracle.svm.hosted.webimage/src/com/oracle/svm/hosted/webimage/wasmgc/image/WasmGCHeapLayouter.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
import com.oracle.graal.pointsto.heap.ImageHeapPrimitiveArray;
3232
import com.oracle.svm.core.image.ImageHeap;
33-
import com.oracle.svm.core.image.ImageHeapLayingOutControl;
34-
import com.oracle.svm.core.image.ImageHeapLayingOutController;
3533
import com.oracle.svm.core.image.ImageHeapLayouter;
3634
import com.oracle.svm.core.image.ImageHeapObject;
3735
import com.oracle.svm.core.image.ImageHeapPartition;
@@ -75,37 +73,33 @@ public void assignObjectToPartition(ImageHeapObject info, boolean immutable, boo
7573
}
7674

7775
@Override
78-
public WasmGCImageHeapLayoutInfo layout(ImageHeap imageHeap, int pageSize, ImageHeapLayingOutController controller) {
79-
ImageHeapLayingOutControl control = new ImageHeapLayingOutControl(controller);
80-
81-
layoutPseudoPartition(control);
82-
doLayout(control);
76+
public WasmGCImageHeapLayoutInfo layout(ImageHeap imageHeap, int pageSize) {
77+
layoutPseudoPartition();
78+
doLayout();
8379

8480
long totalSize = StreamSupport.stream(imageHeap.getObjects().spliterator(), false).mapToLong(ImageHeapObject::getSize).sum();
8581
long serializedSize = singlePartition.getStartOffset() + singlePartition.getSize() - startOffset;
8682
return new WasmGCImageHeapLayoutInfo(startOffset, serializedSize, totalSize);
8783
}
8884

89-
private void doLayout(ImageHeapLayingOutControl control) {
85+
private void doLayout() {
9086
int offset = 0;
9187
for (ImageHeapObject info : singlePartition.getObjects()) {
9288
// Only primitive arrays are supposed to be in this partition
9389
ImageHeapPrimitiveArray primitiveArray = (ImageHeapPrimitiveArray) info.getWrapped();
9490
info.setOffsetInPartition(offset);
9591
offset += primitiveArray.getType().getComponentType().getStorageKind().getByteCount() * primitiveArray.getLength();
96-
control.heartbeat();
9792
}
9893

9994
singlePartition.setSize(offset);
10095
}
10196

102-
private void layoutPseudoPartition(ImageHeapLayingOutControl control) {
97+
private void layoutPseudoPartition() {
10398
// Approximate size of the partition (based on the SVM object layout size of the objects)
10499
long pseudoSize = 0;
105100
for (ImageHeapObject info : pseudoPartition.getObjects()) {
106101
info.setOffsetInPartition(0);
107102
pseudoSize = info.getSize();
108-
control.heartbeat();
109103
}
110104

111105
pseudoPartition.setSize(pseudoSize);

0 commit comments

Comments
 (0)