File tree Expand file tree Collapse file tree 4 files changed +8
-30
lines changed
com.oracle.graal.pointsto/src/com/oracle/graal/pointsto
com.oracle.svm.hosted/src/com/oracle/svm/hosted Expand file tree Collapse file tree 4 files changed +8
-30
lines changed Original file line number Diff line number Diff line change @@ -313,10 +313,6 @@ public boolean platformSupported(AnnotatedElement element) {
313313 return true ;
314314 }
315315
316- public boolean sortFields () {
317- return false ;
318- }
319-
320316 public void clearInThread () {
321317 }
322318
Original file line number Diff line number Diff line change 2828import java .util .ArrayList ;
2929import java .util .Arrays ;
3030import java .util .Collection ;
31- import java .util .Comparator ;
3231import java .util .HashSet ;
3332import java .util .List ;
3433import java .util .Objects ;
@@ -1197,22 +1196,8 @@ private ResolvedJavaField[] initializeInstanceFields(boolean includeSuperclasses
11971196 return result ;
11981197 }
11991198
1200- /**
1201- * Sort fields by the field's name *and* type. Note that sorting by name is not enough as the
1202- * class file format doesn't disallow duplicated names with differing types in the same class.
1203- * Even though you cannot declare duplicated names in source code the class file can be
1204- * manipulated such that two fields will have the same name.
1205- */
1206- static final Comparator <ResolvedJavaField > FIELD_COMPARATOR = Comparator .comparing (ResolvedJavaField ::getName ).thenComparing (f -> f .getType ().toJavaName ());
1207-
12081199 private ResolvedJavaField [] convertFields (ResolvedJavaField [] originals , List <ResolvedJavaField > list , boolean listIncludesSuperClassesFields ) {
1209- ResolvedJavaField [] localOriginals = originals ;
1210- if (universe .hostVM .sortFields ()) {
1211- /* Clone the originals; it is a reference to the wrapped type's instanceFields array. */
1212- localOriginals = originals .clone ();
1213- Arrays .sort (localOriginals , FIELD_COMPARATOR );
1214- }
1215- for (ResolvedJavaField original : localOriginals ) {
1200+ for (ResolvedJavaField original : originals ) {
12161201 if (!original .isInternal () && universe .hostVM .platformSupported (original )) {
12171202 try {
12181203 AnalysisField aField = universe .lookup (original );
Original file line number Diff line number Diff line change @@ -1001,15 +1001,6 @@ private void initializeSharedLayerExcludedFields() {
10011001 sharedLayerExcludedFields .add (lookupOriginalDeclaredField (NativeLibraries .class , "nativeLibraryLockMap" ));
10021002 }
10031003
1004- @ Override
1005- public boolean sortFields () {
1006- /*
1007- * If building layered images sort the fields by kind and name to ensure stable order.
1008- * Sorting fields in general may lead to some issues. (GR-62599)
1009- */
1010- return buildingImageLayer ;
1011- }
1012-
10131004 /** If it's not one of the known builder types it must be an original VM type. */
10141005 private static boolean isOriginalType (ResolvedJavaType type ) {
10151006 return !(type instanceof OriginalClassProvider );
Original file line number Diff line number Diff line change 5151import java .util .function .Supplier ;
5252import java .util .stream .IntStream ;
5353
54- import com .oracle .svm .hosted .substitute .SubstitutionMethod ;
5554import org .graalvm .collections .EconomicMap ;
5655import org .graalvm .nativeimage .AnnotationAccess ;
5756import org .graalvm .nativeimage .ImageSingletons ;
121120import com .oracle .svm .hosted .meta .PatchedWordConstant ;
122121import com .oracle .svm .hosted .reflect .ReflectionFeature ;
123122import com .oracle .svm .hosted .reflect .serialize .SerializationFeature ;
123+ import com .oracle .svm .hosted .substitute .SubstitutionMethod ;
124124import com .oracle .svm .hosted .util .IdentityHashCodeUtil ;
125125import com .oracle .svm .shaded .org .capnproto .PrimitiveList ;
126126import com .oracle .svm .shaded .org .capnproto .StructList ;
@@ -1318,6 +1318,12 @@ public void initializeBaseLayerField(AnalysisField analysisField) {
13181318 });
13191319 registerFlag (fieldData .getIsFolded (), debug -> analysisField .registerAsFolded (PERSISTED ));
13201320 registerFlag (fieldData .getIsUnsafeAccessed (), debug -> analysisField .registerAsUnsafeAccessed (PERSISTED ));
1321+
1322+ /*
1323+ * Inject the base layer position. If the position computed for this layer, either before
1324+ * this step or later, is different this will result in a failed guarantee.
1325+ */
1326+ analysisField .setPosition (fieldData .getPosition ());
13211327 }
13221328
13231329 private PersistedAnalysisField .Reader getFieldData (AnalysisField analysisField ) {
You can’t perform that action at this time.
0 commit comments