Skip to content

Commit 3390961

Browse files
committed
Make distinction between IOS, DARWIN, and MACOS platforms.
1 parent 62f53f3 commit 3390961

File tree

16 files changed

+166
-82
lines changed

16 files changed

+166
-82
lines changed

sdk/src/org.graalvm.nativeimage/snapshot.sigtest

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,21 @@ innr public abstract interface static AARCH64
217217
innr public abstract interface static AMD64
218218
innr public abstract interface static ANDROID
219219
innr public abstract interface static DARWIN
220+
innr public abstract interface static DARWIN_AARCH64
221+
innr public abstract interface static DARWIN_AMD64
220222
innr public abstract interface static IOS
221223
innr public abstract interface static LINUX
224+
innr public abstract interface static LINUX_AARCH64_BASE
225+
innr public abstract interface static LINUX_AMD64_BASE
226+
innr public abstract interface static MACOS
222227
innr public abstract interface static WINDOWS
223228
innr public final static ANDROID_AARCH64
224-
innr public final static DARWIN_AARCH64
225-
innr public final static DARWIN_AMD64
226229
innr public final static HOSTED_ONLY
227230
innr public final static IOS_AARCH64
228231
innr public final static IOS_AMD64
229232
innr public final static LINUX_AARCH64
233+
innr public final static MACOS_AARCH64
234+
innr public final static MACOS_AMD64
230235
innr public final static WINDOWS_AARCH64
231236
innr public final static WINDOWS_AMD64
232237
innr public static LINUX_AMD64
@@ -252,28 +257,23 @@ meth public java.lang.String getOS()
252257
CLSS public final static org.graalvm.nativeimage.Platform$ANDROID_AARCH64
253258
outer org.graalvm.nativeimage.Platform
254259
cons public init()
255-
intf org.graalvm.nativeimage.Platform$AARCH64
256260
intf org.graalvm.nativeimage.Platform$ANDROID
261+
intf org.graalvm.nativeimage.Platform$LINUX_AARCH64_BASE
257262
supr java.lang.Object
258263

259264
CLSS public abstract interface static org.graalvm.nativeimage.Platform$DARWIN
260265
outer org.graalvm.nativeimage.Platform
261266
intf org.graalvm.nativeimage.impl.InternalPlatform$PLATFORM_JNI
262-
meth public java.lang.String getOS()
263267

264-
CLSS public final static org.graalvm.nativeimage.Platform$DARWIN_AARCH64
268+
CLSS public abstract interface static org.graalvm.nativeimage.Platform$DARWIN_AARCH64
265269
outer org.graalvm.nativeimage.Platform
266-
cons public init()
267270
intf org.graalvm.nativeimage.Platform$AARCH64
268271
intf org.graalvm.nativeimage.Platform$DARWIN
269-
supr java.lang.Object
270272

271-
CLSS public final static org.graalvm.nativeimage.Platform$DARWIN_AMD64
273+
CLSS public abstract interface static org.graalvm.nativeimage.Platform$DARWIN_AMD64
272274
outer org.graalvm.nativeimage.Platform
273-
cons public init()
274275
intf org.graalvm.nativeimage.Platform$AMD64
275276
intf org.graalvm.nativeimage.Platform$DARWIN
276-
supr java.lang.Object
277277

278278
CLSS public final static org.graalvm.nativeimage.Platform$HOSTED_ONLY
279279
outer org.graalvm.nativeimage.Platform
@@ -288,14 +288,14 @@ meth public java.lang.String getOS()
288288
CLSS public final static org.graalvm.nativeimage.Platform$IOS_AARCH64
289289
outer org.graalvm.nativeimage.Platform
290290
cons public init()
291-
intf org.graalvm.nativeimage.Platform$AARCH64
291+
intf org.graalvm.nativeimage.Platform$DARWIN_AARCH64
292292
intf org.graalvm.nativeimage.Platform$IOS
293293
supr java.lang.Object
294294

295295
CLSS public final static org.graalvm.nativeimage.Platform$IOS_AMD64
296296
outer org.graalvm.nativeimage.Platform
297297
cons public init()
298-
intf org.graalvm.nativeimage.Platform$AMD64
298+
intf org.graalvm.nativeimage.Platform$DARWIN_AMD64
299299
intf org.graalvm.nativeimage.Platform$IOS
300300
supr java.lang.Object
301301

@@ -307,15 +307,44 @@ meth public java.lang.String getOS()
307307
CLSS public final static org.graalvm.nativeimage.Platform$LINUX_AARCH64
308308
outer org.graalvm.nativeimage.Platform
309309
cons public init()
310-
intf org.graalvm.nativeimage.Platform$AARCH64
311310
intf org.graalvm.nativeimage.Platform$LINUX
311+
intf org.graalvm.nativeimage.Platform$LINUX_AARCH64_BASE
312312
supr java.lang.Object
313313

314+
CLSS public abstract interface static org.graalvm.nativeimage.Platform$LINUX_AARCH64_BASE
315+
outer org.graalvm.nativeimage.Platform
316+
intf org.graalvm.nativeimage.Platform$AARCH64
317+
intf org.graalvm.nativeimage.Platform$LINUX
318+
314319
CLSS public static org.graalvm.nativeimage.Platform$LINUX_AMD64
315320
outer org.graalvm.nativeimage.Platform
316321
cons public init()
322+
intf org.graalvm.nativeimage.Platform$LINUX
323+
intf org.graalvm.nativeimage.Platform$LINUX_AMD64_BASE
324+
supr java.lang.Object
325+
326+
CLSS public abstract interface static org.graalvm.nativeimage.Platform$LINUX_AMD64_BASE
327+
outer org.graalvm.nativeimage.Platform
317328
intf org.graalvm.nativeimage.Platform$AMD64
318329
intf org.graalvm.nativeimage.Platform$LINUX
330+
331+
CLSS public abstract interface static org.graalvm.nativeimage.Platform$MACOS
332+
outer org.graalvm.nativeimage.Platform
333+
intf org.graalvm.nativeimage.Platform$DARWIN
334+
meth public java.lang.String getOS()
335+
336+
CLSS public final static org.graalvm.nativeimage.Platform$MACOS_AARCH64
337+
outer org.graalvm.nativeimage.Platform
338+
cons public init()
339+
intf org.graalvm.nativeimage.Platform$DARWIN_AARCH64
340+
intf org.graalvm.nativeimage.Platform$MACOS
341+
supr java.lang.Object
342+
343+
CLSS public final static org.graalvm.nativeimage.Platform$MACOS_AMD64
344+
outer org.graalvm.nativeimage.Platform
345+
cons public init()
346+
intf org.graalvm.nativeimage.Platform$DARWIN_AMD64
347+
intf org.graalvm.nativeimage.Platform$MACOS
319348
supr java.lang.Object
320349

321350
CLSS public abstract interface static org.graalvm.nativeimage.Platform$WINDOWS
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
org.graalvm.nativeimage.Platform$LINUX_AMD64
22
org.graalvm.nativeimage.Platform$LINUX_AARCH64
33
org.graalvm.nativeimage.Platform$ANDROID_AARCH64
4-
org.graalvm.nativeimage.Platform$DARWIN_AMD64
5-
org.graalvm.nativeimage.Platform$DARWIN_AARCH64
64
org.graalvm.nativeimage.Platform$IOS_AMD64
75
org.graalvm.nativeimage.Platform$IOS_AARCH64
6+
org.graalvm.nativeimage.Platform$MACOS_AMD64
7+
org.graalvm.nativeimage.Platform$MACOS_AARCH64
88
org.graalvm.nativeimage.Platform$WINDOWS_AMD64
99
org.graalvm.nativeimage.Platform$WINDOWS_AARCH64

sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/Platform.java

Lines changed: 72 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -184,36 +184,44 @@ default String getOS() {
184184
}
185185

186186
/**
187-
* Supported operating system: Darwin (MacOS).
187+
* Basis for all Apple operating systems (MacOS and iOS).
188188
*
189189
* @since 19.0
190190
*/
191191
interface DARWIN extends InternalPlatform.PLATFORM_JNI {
192+
}
193+
194+
/**
195+
* Supported operating system: iOS.
196+
*
197+
* @since 21.0
198+
*/
199+
interface IOS extends DARWIN {
192200

193201
/**
194-
* Returns string representing DARWIN OS.
202+
* Returns string representing iOS OS.
195203
*
196204
* @since 21.0
197205
*/
198206
default String getOS() {
199-
return DARWIN.class.getSimpleName().toLowerCase();
207+
return IOS.class.getSimpleName().toLowerCase();
200208
}
201209
}
202210

203211
/**
204-
* Supported operating system: iOS.
212+
* Supported operating system: MacOS.
205213
*
206-
* @since 21.0
214+
* @since 22.1
207215
*/
208-
interface IOS extends DARWIN {
216+
interface MACOS extends DARWIN {
209217

210218
/**
211-
* Returns string representing IOS OS.
219+
* Returns string representing MACOS OS.
212220
*
213221
* @since 21.0
214222
*/
215223
default String getOS() {
216-
return IOS.class.getSimpleName().toLowerCase();
224+
return "darwin";
217225
}
218226
}
219227

@@ -234,6 +242,38 @@ default String getOS() {
234242
}
235243
}
236244

245+
/**
246+
* Basis for all Linux operating systems on AMD64 (LINUX_AMD64).
247+
*
248+
* @since 22.1
249+
*/
250+
interface LINUX_AMD64_BASE extends LINUX, AMD64 {
251+
}
252+
253+
/**
254+
* Basis for all Linux operating systems on AARCH64 (LINUX_AARCH64 & ANDROID_AARCH64).
255+
*
256+
* @since 22.1
257+
*/
258+
interface LINUX_AARCH64_BASE extends LINUX, AARCH64 {
259+
}
260+
261+
/**
262+
* Basis for all Apple operating systems on AMD64 (MACOS_AMD64 & IOS_AMD64).
263+
*
264+
* @since 22.1
265+
*/
266+
interface DARWIN_AMD64 extends DARWIN, AMD64 {
267+
}
268+
269+
/**
270+
* Basis for all Apple operating systems on AMD64 (MACOS_AMD64 & IOS_AMD64).
271+
*
272+
* @since 22.1
273+
*/
274+
interface DARWIN_AARCH64 extends DARWIN, AARCH64 {
275+
}
276+
237277
/*
238278
* The standard leaf platforms, i.e., OS-architecture combinations that we support.
239279
*/
@@ -242,7 +282,7 @@ default String getOS() {
242282
*
243283
* @since 19.0
244284
*/
245-
class LINUX_AMD64 implements LINUX, AMD64 {
285+
class LINUX_AMD64 implements LINUX, LINUX_AMD64_BASE {
246286

247287
/**
248288
* Instantiates a marker instance of this platform.
@@ -259,7 +299,7 @@ public LINUX_AMD64() {
259299
*
260300
* @since 19.0
261301
*/
262-
final class LINUX_AARCH64 implements LINUX, AARCH64 {
302+
final class LINUX_AARCH64 implements LINUX, LINUX_AARCH64_BASE {
263303

264304
/**
265305
* Instantiates a marker instance of this platform.
@@ -276,7 +316,7 @@ public LINUX_AARCH64() {
276316
*
277317
* @since 21.0
278318
*/
279-
final class ANDROID_AARCH64 implements ANDROID, AARCH64 {
319+
final class ANDROID_AARCH64 implements ANDROID, LINUX_AARCH64_BASE {
280320

281321
/**
282322
* Instantiates a marker instance of this platform.
@@ -289,66 +329,66 @@ public ANDROID_AARCH64() {
289329
}
290330

291331
/**
292-
* Supported leaf platform: Darwin (MacOS) on x86 64-bit.
332+
* Supported leaf platform: iOS on x86 64-bit.
293333
*
294-
* @since 19.0
334+
* @since 21.3
295335
*/
296-
final class DARWIN_AMD64 implements DARWIN, AMD64 {
336+
final class IOS_AMD64 implements IOS, DARWIN_AMD64 {
297337

298338
/**
299339
* Instantiates a marker instance of this platform.
300340
*
301-
* @since 19.0
341+
* @since 21.3
302342
*/
303-
public DARWIN_AMD64() {
343+
public IOS_AMD64() {
304344
}
305345
}
306346

307347
/**
308-
* Supported leaf platform: Darwin (MacOS) on AArch 64-bit.
348+
* Supported leaf platform: iOS on AArch 64-bit.
309349
*
310-
* @since 2.0
350+
* @since 21.0
311351
*/
312-
final class DARWIN_AARCH64 implements DARWIN, AARCH64 {
352+
final class IOS_AARCH64 implements IOS, DARWIN_AARCH64 {
313353

314354
/**
315355
* Instantiates a marker instance of this platform.
316356
*
317-
* @since 2.0
357+
* @since 21.0
318358
*/
319-
public DARWIN_AARCH64() {
359+
public IOS_AARCH64() {
320360
}
321361
}
322362

323363
/**
324-
* Supported leaf platform: iOS on AArch 64-bit.
364+
* Supported leaf platform: MacOS on x86 64-bit.
325365
*
326-
* @since 21.0
366+
* @since 22.1
327367
*/
328-
final class IOS_AARCH64 implements IOS, AARCH64 {
368+
final class MACOS_AMD64 implements MACOS, DARWIN_AMD64 {
329369

330370
/**
331371
* Instantiates a marker instance of this platform.
332372
*
333-
* @since 21.0
373+
* @since 22.1
334374
*/
335-
public IOS_AARCH64() {
375+
public MACOS_AMD64() {
336376
}
337377
}
338378

339379
/**
340-
* Supported leaf platform: iOS on x86 64-bit.
380+
* Supported leaf platform: MacOS on AArch 64-bit.
341381
*
342-
* @since 21.3
382+
* @since 22.1
343383
*/
344-
final class IOS_AMD64 implements IOS, AMD64 {
384+
final class MACOS_AARCH64 implements MACOS, DARWIN_AARCH64 {
345385

346386
/**
347387
* Instantiates a marker instance of this platform.
348388
*
349-
* @since 21.3
389+
* @since 22.1
350390
*/
351-
public IOS_AMD64() {
391+
public MACOS_AARCH64() {
352392
}
353393
}
354394

substratevm/src/com.oracle.svm.core.graal.aarch64/src/com/oracle/svm/core/graal/aarch64/SubstrateAArch64RegisterConfig.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
import org.graalvm.compiler.core.common.NumUtil;
7373
import org.graalvm.nativeimage.Platform;
7474

75-
import com.oracle.svm.core.OS;
7675
import com.oracle.svm.core.ReservedRegisters;
7776
import com.oracle.svm.core.config.ObjectLayout;
7877
import com.oracle.svm.core.graal.code.SubstrateCallingConvention;
@@ -157,7 +156,7 @@ public SubstrateAArch64RegisterConfig(ConfigKind config, MetaAccessProvider meta
157156
*
158157
* https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions
159158
*/
160-
if (OS.DARWIN.isCurrent() || OS.WINDOWS.isCurrent()) {
159+
if (Platform.includedIn(Platform.DARWIN.class) || Platform.includedIn(Platform.WINDOWS.class)) {
161160
regs.remove(r18);
162161
}
163162
allocatableRegs = new RegisterArray(regs);

substratevm/src/com.oracle.svm.core.graal.amd64/src/com/oracle/svm/core/graal/amd64/SubstrateAMD64RegisterConfig.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757

5858
import java.util.ArrayList;
5959

60-
import com.oracle.svm.core.OS;
60+
import org.graalvm.nativeimage.Platform;
61+
6162
import com.oracle.svm.core.ReservedRegisters;
6263
import com.oracle.svm.core.config.ObjectLayout;
6364
import com.oracle.svm.core.graal.code.SubstrateCallingConvention;
@@ -102,7 +103,7 @@ public SubstrateAMD64RegisterConfig(ConfigKind config, MetaAccessProvider metaAc
102103
this.metaAccess = metaAccess;
103104
this.useBasePointer = useBasePointer;
104105

105-
if (OS.getCurrent() == OS.WINDOWS) {
106+
if (Platform.includedIn(Platform.WINDOWS.class)) {
106107
// This is the Windows 64-bit ABI for parameters.
107108
// Note that float parameters also "consume" a general register and vice versa.
108109
nativeGeneralParameterRegs = new RegisterArray(rcx, rdx, r8, r9);
@@ -147,7 +148,7 @@ public SubstrateAMD64RegisterConfig(ConfigKind config, MetaAccessProvider metaAc
147148
* rbp must be last in the list, so that it gets the location closest to the saved
148149
* return address.
149150
*/
150-
if (OS.getCurrent() == OS.WINDOWS) {
151+
if (Platform.includedIn(Platform.WINDOWS.class)) {
151152
calleeSaveRegisters = new RegisterArray(rbx, rdi, rsi, r12, r13, r14, r15, rbp,
152153
xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15);
153154
} else {
@@ -238,7 +239,7 @@ public CallingConvention getCallingConvention(Type t, JavaType returnType, JavaT
238239
JavaKind kind = ObjectLayout.getCallSignatureKind(isEntryPoint, (ResolvedJavaType) parameterTypes[i], metaAccess, target);
239240
kinds[i] = kind;
240241

241-
if (type.nativeABI() && OS.getCurrent() == OS.WINDOWS) {
242+
if (type.nativeABI() && Platform.includedIn(Platform.WINDOWS.class)) {
242243
// Strictly positional: float parameters consume a general register and vice versa
243244
currentGeneral = i;
244245
currentXMM = i;

0 commit comments

Comments
 (0)