Skip to content

Commit ffe0d77

Browse files
committed
Remove deprecated Layout API and LayoutFactory service provider.
Simplify LayoutFactory.createShape. Remove obsolete internal "since" tags. Remove unnecessary SuppressWarnings("deprecation").
1 parent 06dd221 commit ffe0d77

28 files changed

+59
-357
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/truffle/test/TruffleRuntimeTest.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -29,15 +29,16 @@
2929
import static org.junit.Assert.assertNull;
3030
import static org.junit.Assert.assertTrue;
3131

32-
import jdk.graal.compiler.api.test.Graal;
33-
import jdk.graal.compiler.runtime.RuntimeProvider;
3432
import org.junit.Test;
3533

3634
import com.oracle.truffle.api.Truffle;
3735
import com.oracle.truffle.api.TruffleRuntime;
3836
import com.oracle.truffle.api.impl.DefaultTruffleRuntime;
3937
import com.oracle.truffle.api.impl.TVMCI;
4038

39+
import jdk.graal.compiler.api.test.Graal;
40+
import jdk.graal.compiler.runtime.RuntimeProvider;
41+
4142
public class TruffleRuntimeTest {
4243

4344
@Test
@@ -75,12 +76,4 @@ public void testGetCapabilityObjectClass() {
7576
assertNull("Expected null return value for Object.class", object);
7677
}
7778

78-
@SuppressWarnings("deprecation")
79-
@Test
80-
public void testGetLayoutFactory() {
81-
TruffleRuntime runtime = Truffle.getRuntime();
82-
com.oracle.truffle.api.object.LayoutFactory layoutFactory = runtime.getCapability(com.oracle.truffle.api.object.LayoutFactory.class);
83-
assertNotNull("LayoutFactory not found", layoutFactory);
84-
// Rely on modules to only load trusted service providers
85-
}
8679
}

truffle/mx.truffle/suite.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,6 @@
16331633
],
16341634
"uses" : [
16351635
"com.oracle.truffle.api.impl.TruffleLocator",
1636-
"com.oracle.truffle.api.object.LayoutFactory",
16371636
"com.oracle.truffle.runtime.LoopNodeFactory",
16381637
"com.oracle.truffle.runtime.TruffleTypes",
16391638
"com.oracle.truffle.runtime.EngineCacheSupport",

truffle/src/com.oracle.truffle.api.object/snapshot.sigtest

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -178,36 +178,6 @@ meth public abstract int getInt(com.oracle.truffle.api.object.DynamicObject,com.
178178
meth public abstract void setInt(com.oracle.truffle.api.object.DynamicObject,int,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.FinalLocationException
179179
anno 0 java.lang.Deprecated(boolean forRemoval=false, java.lang.String since="22.2")
180180

181-
CLSS public abstract com.oracle.truffle.api.object.Layout
182-
anno 0 java.lang.Deprecated(boolean forRemoval=false, java.lang.String since="21.1")
183-
cons protected init()
184-
fld public final static java.lang.String OPTION_PREFIX = "truffle.object."
185-
innr protected abstract static Access
186-
meth protected com.oracle.truffle.api.object.Shape buildShape(java.lang.Object,java.lang.Object,int,com.oracle.truffle.api.Assumption)
187-
meth protected static com.oracle.truffle.api.object.LayoutFactory getFactory()
188-
meth public abstract java.lang.Class<? extends com.oracle.truffle.api.object.DynamicObject> getType()
189-
supr java.lang.Object
190-
hfds INT_TO_DOUBLE_FLAG,INT_TO_LONG_FLAG,LAYOUT_FACTORY
191-
192-
CLSS protected abstract static com.oracle.truffle.api.object.Layout$Access
193-
outer com.oracle.truffle.api.object.Layout
194-
cons protected init()
195-
meth public final com.oracle.truffle.api.object.Shape getShape(com.oracle.truffle.api.object.DynamicObject)
196-
meth public final int[] getPrimitiveArray(com.oracle.truffle.api.object.DynamicObject)
197-
meth public final java.lang.Class<? extends java.lang.annotation.Annotation> getDynamicFieldAnnotation()
198-
meth public final java.lang.Object[] getObjectArray(com.oracle.truffle.api.object.DynamicObject)
199-
meth public final void setObjectArray(com.oracle.truffle.api.object.DynamicObject,java.lang.Object[])
200-
meth public final void setPrimitiveArray(com.oracle.truffle.api.object.DynamicObject,int[])
201-
meth public final void setShape(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
202-
supr java.lang.Object
203-
204-
CLSS public abstract interface com.oracle.truffle.api.object.LayoutFactory
205-
anno 0 java.lang.Deprecated(boolean forRemoval=false, java.lang.String since="22.2")
206-
meth public abstract com.oracle.truffle.api.object.Property createProperty(java.lang.Object,com.oracle.truffle.api.object.Location,int)
207-
anno 0 java.lang.Deprecated(boolean forRemoval=false, java.lang.String since="22.2")
208-
meth public abstract int getPriority()
209-
meth public com.oracle.truffle.api.object.Shape createShape(java.lang.Object)
210-
211181
CLSS public abstract com.oracle.truffle.api.object.Location
212182
cons protected init()
213183
meth protected double getDouble(com.oracle.truffle.api.object.DynamicObject,boolean) throws com.oracle.truffle.api.nodes.UnexpectedResultException
@@ -297,8 +267,6 @@ CLSS public abstract com.oracle.truffle.api.object.Shape
297267
cons protected init()
298268
innr public final static Builder
299269
innr public final static DerivedBuilder
300-
meth protected abstract com.oracle.truffle.api.object.Layout getLayout()
301-
anno 0 java.lang.Deprecated(boolean forRemoval=false, java.lang.String since="24.2")
302270
meth protected abstract com.oracle.truffle.api.object.Shape addProperty(com.oracle.truffle.api.object.Property)
303271
meth protected abstract com.oracle.truffle.api.object.Shape defineProperty(java.lang.Object,java.lang.Object,int,int)
304272
meth protected abstract com.oracle.truffle.api.object.Shape removeProperty(com.oracle.truffle.api.object.Property)

truffle/src/com.oracle.truffle.api.object/src/META-INF/services/com.oracle.truffle.api.object.LayoutFactory

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

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/CoreAllocator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161

6262
import sun.misc.Unsafe;
6363

64-
@SuppressWarnings("deprecation")
6564
class CoreAllocator extends ShapeImpl.BaseAllocator {
6665

6766
CoreAllocator(LayoutImpl layout) {

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/CoreLayoutFactory.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@
4040
*/
4141
package com.oracle.truffle.api.object;
4242

43-
import java.lang.invoke.MethodHandles;
4443
import java.lang.invoke.MethodHandles.Lookup;
4544

45+
import org.graalvm.collections.EconomicMap;
4646
import org.graalvm.collections.Pair;
47-
import org.graalvm.collections.UnmodifiableEconomicMap;
4847

4948
import com.oracle.truffle.api.Assumption;
5049

51-
@SuppressWarnings("deprecation")
52-
public class CoreLayoutFactory implements com.oracle.truffle.api.object.LayoutFactory {
50+
class CoreLayoutFactory implements LayoutFactory {
5351

5452
@Override
5553
public final Property createProperty(Object id, Location location, int flags) {
@@ -70,25 +68,22 @@ public LayoutImpl createLayout(Class<? extends DynamicObject> layoutClass, Looku
7068
}
7169

7270
@Override
73-
@SuppressWarnings("unchecked")
74-
public final Shape createShape(Object builderArgs) {
75-
Object[] args = (Object[]) builderArgs;
76-
Class<? extends DynamicObject> layoutClass = (Class<? extends DynamicObject>) args[0];
77-
int implicitCastFlags = (int) args[1];
78-
Object dynamicType = args[2];
79-
Object sharedData = args[3];
80-
int shapeFlags = (int) args[4];
81-
var constantProperties = (UnmodifiableEconomicMap<Object, Pair<Object, Integer>>) args[5];
82-
var singleContextAssumption = (Assumption) args[6];
83-
var layoutLookup = (MethodHandles.Lookup) args[7];
71+
public final Shape createShape(Class<? extends DynamicObject> layoutClass,
72+
int implicitCastFlags,
73+
Object dynamicType,
74+
Object sharedData,
75+
int shapeFlags,
76+
EconomicMap<Object, Pair<Object, Integer>> constantProperties,
77+
Assumption singleContextAssumption,
78+
Lookup layoutLookup) {
8479

8580
LayoutImpl impl = createLayout(layoutClass, layoutLookup, implicitCastFlags);
8681
ShapeImpl shape = impl.newShape(dynamicType, sharedData, shapeFlags, singleContextAssumption);
8782

8883
if (constantProperties != null) {
8984
var cursor = constantProperties.getEntries();
9085
while (cursor.advance()) {
91-
shape = shape.addProperty(Property.create(cursor.getKey(), impl.createAllocator().constantLocation(cursor.getValue().getLeft()), cursor.getValue().getRight()));
86+
shape = shape.addProperty(createProperty(cursor.getKey(), impl.createAllocator().constantLocation(cursor.getValue().getLeft()), cursor.getValue().getRight()));
9287
}
9388
}
9489

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/CoreLocation.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ protected boolean isObjectLocation() {
8080
* For sets to final locations, otherValue.equals(thisValue) seems more beneficial, since we
8181
* usually know more about the value to be set.
8282
*/
83-
@SuppressWarnings("deprecation")
8483
static boolean valueEquals(Object val1, Object val2) {
8584
return val1 == val2 || (val1 != null && equalsBoundary(val1, val2));
8685
}

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DefaultLayout.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
import com.oracle.truffle.api.object.CoreLocations.LongLocation;
5959
import com.oracle.truffle.api.object.CoreLocations.ObjectLocation;
6060

61-
@SuppressWarnings("deprecation")
6261
class DefaultLayout extends LayoutImpl {
6362
private final ObjectLocation[] objectFields;
6463
private final LongLocation[] primitiveFields;

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/ExtAllocator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676

7777
import sun.misc.Unsafe;
7878

79-
@SuppressWarnings("deprecation")
8079
abstract class ExtAllocator extends BaseAllocator {
8180

8281
/** Placeholder for when no value is available or no type speculation should be performed. */

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/ExtDefaultLayoutFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242

4343
import java.lang.invoke.MethodHandles.Lookup;
4444

45-
@SuppressWarnings("deprecation")
46-
public class ExtDefaultLayoutFactory extends ExtLayoutFactory {
45+
class ExtDefaultLayoutFactory extends ExtLayoutFactory {
4746

4847
@Override
4948
public int getPriority() {

0 commit comments

Comments
 (0)