Skip to content

Commit 8e0b9db

Browse files
[GR-45784] [GR-61965] Reenable all checks regarding @Uninterruptible and other minor changes.
PullRequest: graal/20010
2 parents 0997bc5 + 6f2b7ad commit 8e0b9db

File tree

6 files changed

+23
-12
lines changed

6 files changed

+23
-12
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/deopt/Deoptimizer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,10 +1549,7 @@ static class TargetContent {
15491549
/** All references in deopt frames are compressed when compressed references are enabled. */
15501550
private final int sizeofCompressedReference = ConfigurationValues.getObjectLayout().getReferenceSize();
15511551
private final int sizeofUncompressedReference = FrameAccess.uncompressedReferenceSize();
1552-
/**
1553-
* The offset of the within the array object. I do not have to scale the offsets.
1554-
*/
1555-
private static final int arrayBaseOffset = ConfigurationValues.getObjectLayout().getArrayBaseOffset(JavaKind.Byte);
1552+
private final int arrayBaseOffset = ConfigurationValues.getObjectLayout().getArrayBaseOffset(JavaKind.Byte);
15561553

15571554
private static final ArrayIndexOutOfBoundsException arrayIndexOutOfBoundsException = new ArrayIndexOutOfBoundsException("TargetContent.offsetCheck");
15581555

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Pod.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@
3838
import java.util.function.Supplier;
3939

4040
import org.graalvm.collections.EconomicMap;
41-
import jdk.graal.compiler.api.replacements.Fold;
4241
import org.graalvm.nativeimage.ImageSingletons;
4342
import org.graalvm.nativeimage.Platform;
4443
import org.graalvm.nativeimage.Platforms;
4544
import org.graalvm.word.UnsignedWord;
4645

4746
import com.oracle.svm.core.config.ConfigurationValues;
4847
import com.oracle.svm.core.hub.DynamicHub;
48+
import com.oracle.svm.core.hub.Hybrid;
4949
import com.oracle.svm.core.hub.LayoutEncoding;
5050
import com.oracle.svm.core.util.ImageHeapMap;
5151
import com.oracle.svm.core.util.UnsignedUtils;
5252

53+
import jdk.graal.compiler.api.replacements.Fold;
54+
import jdk.graal.compiler.word.BarrieredAccess;
5355
import jdk.vm.ci.meta.JavaKind;
5456

5557
/**
@@ -58,6 +60,12 @@
5860
* storing "plain old data" without further object-oriented features such as method dispatching or
5961
* type information, apart from having a Java superclass.
6062
*
63+
* Pods are {@link Hybrid} objects. All fields that are not inherited from an actual Java class are
64+
* layouted in the array part of the hybrid object. For object fields, the GC will use the provided
65+
* {@link #referenceMap} to keep all the object references up-to-date. However, be aware that it is
66+
* necessary to manually emit the correct GC read/write barriers (for example via
67+
* {@link BarrieredAccess}) whenever such an object field is accessed.
68+
*
6169
* @param <T> The interface of the {@linkplain #getFactory() factory} that allocates instances.
6270
*/
6371
public final class Pod<T> {

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/StoredContinuation.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232

3333
/**
3434
* Persisted execution state of a yielded continuation, use via {@link StoredContinuationAccess}.
35+
*
36+
* Stored continuations are {@link Hybrid} objects where the array part contains the raw stack data.
37+
* After writing the stack data into the object, we manually emit the correct GC write barriers for
38+
* all the references (see {@link Heap#dirtyAllReferencesOf}).
3539
*/
3640
@Hybrid(componentType = Word.class)
3741
public final class StoredContinuation {

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/Hybrid.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*
4141
* <p>
4242
* The location of the identity hashcode is configuration-dependent and will follow the same
43-
* placement convention as an array. The See {@link ObjectLayout} for more information on where the
43+
* placement convention as an array. See {@link ObjectLayout} for more information on where the
4444
* identity hash can be placed. @Hybrid objects are treated the same way as instance classes for
4545
* determining whether (and where) they have a monitor slot; See {@link MultiThreadedMonitorSupport}
4646
* for more information on monitor slot placement.
@@ -65,6 +65,11 @@
6565
* return {@code true} and {@link Class#isArray()} will return {@code false}, while
6666
* {@link LayoutEncoding#isPureInstance} will return {@code false} and
6767
* {@link LayoutEncoding#isArrayLike} will return {@code true} for hybrid objects.
68+
*
69+
* <p>
70+
* Note that the array part of a hybrid object may only contain primitive data but no object
71+
* references because the GC treats hybrid objects similar to normal instance objects. So, it would
72+
* not be aware of any object references in the array part.
6873
*/
6974
@Retention(RetentionPolicy.RUNTIME)
7075
@Target(ElementType.TYPE)

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/UninterruptibleAnnotationChecker.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,7 @@ private void checkOverrides(HostedMethod method, Uninterruptible methodAnnotatio
184184
Uninterruptible implAnnotation = Uninterruptible.Utils.getAnnotation(impl);
185185
if (implAnnotation != null) {
186186
if (methodAnnotation.callerMustBe() != implAnnotation.callerMustBe()) {
187-
// GR-45784: temporarily disabled so that we can remove legacy code
188-
// violations.add("callerMustBe: " + method.format("%H.%n(%p):%r") + " != " +
189-
// impl.format("%H.%n(%p):%r"));
187+
violations.add("callerMustBe: " + method.format("%H.%n(%p):%r") + " != " + impl.format("%H.%n(%p):%r"));
190188
}
191189
if (methodAnnotation.calleeMustBe() != implAnnotation.calleeMustBe()) {
192190
violations.add("calleeMustBe: " + method.format("%H.%n(%p):%r") + " != " + impl.format("%H.%n(%p):%r"));

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/config/DynamicHubLayout.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@
7474
* </pre>
7575
*
7676
* <p>
77-
* Like {@link Hybrid}, DynamicHub objects have an instance {@link HubType}, but a
78-
* {@link LayoutEncoding} like an array. See the javadoc for {@link Hybrid} more details its
79-
* implications.
77+
* Like {@link Hybrid} objects, DynamicHubs have an instance {@link HubType}, but a
78+
* {@link LayoutEncoding} like an array (see the javadoc for {@link Hybrid}).
8079
*/
8180
public class DynamicHubLayout {
8281

0 commit comments

Comments
 (0)