Skip to content

Commit 02641e3

Browse files
committed
Make distinction between IOS, DARWIN, and MACOS platforms.
1 parent 934e3e6 commit 02641e3

File tree

21 files changed

+163
-89
lines changed

21 files changed

+163
-89
lines changed

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

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,19 @@ 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 MACOS
222225
innr public abstract interface static WINDOWS
223226
innr public final static ANDROID_AARCH64
224-
innr public final static DARWIN_AARCH64
225-
innr public final static DARWIN_AMD64
226227
innr public final static HOSTED_ONLY
227228
innr public final static IOS_AARCH64
228229
innr public final static IOS_AMD64
229230
innr public final static LINUX_AARCH64
231+
innr public final static MACOS_AARCH64
232+
innr public final static MACOS_AMD64
230233
innr public final static WINDOWS_AARCH64
231234
innr public final static WINDOWS_AMD64
232235
innr public static LINUX_AMD64
@@ -259,21 +262,16 @@ supr java.lang.Object
259262
CLSS public abstract interface static org.graalvm.nativeimage.Platform$DARWIN
260263
outer org.graalvm.nativeimage.Platform
261264
intf org.graalvm.nativeimage.impl.InternalPlatform$PLATFORM_JNI
262-
meth public java.lang.String getOS()
263265

264-
CLSS public final static org.graalvm.nativeimage.Platform$DARWIN_AARCH64
266+
CLSS public abstract interface static org.graalvm.nativeimage.Platform$DARWIN_AARCH64
265267
outer org.graalvm.nativeimage.Platform
266-
cons public init()
267268
intf org.graalvm.nativeimage.Platform$AARCH64
268269
intf org.graalvm.nativeimage.Platform$DARWIN
269-
supr java.lang.Object
270270

271-
CLSS public final static org.graalvm.nativeimage.Platform$DARWIN_AMD64
271+
CLSS public abstract interface static org.graalvm.nativeimage.Platform$DARWIN_AMD64
272272
outer org.graalvm.nativeimage.Platform
273-
cons public init()
274273
intf org.graalvm.nativeimage.Platform$AMD64
275274
intf org.graalvm.nativeimage.Platform$DARWIN
276-
supr java.lang.Object
277275

278276
CLSS public final static org.graalvm.nativeimage.Platform$HOSTED_ONLY
279277
outer org.graalvm.nativeimage.Platform
@@ -288,14 +286,14 @@ meth public java.lang.String getOS()
288286
CLSS public final static org.graalvm.nativeimage.Platform$IOS_AARCH64
289287
outer org.graalvm.nativeimage.Platform
290288
cons public init()
291-
intf org.graalvm.nativeimage.Platform$AARCH64
289+
intf org.graalvm.nativeimage.Platform$DARWIN_AARCH64
292290
intf org.graalvm.nativeimage.Platform$IOS
293291
supr java.lang.Object
294292

295293
CLSS public final static org.graalvm.nativeimage.Platform$IOS_AMD64
296294
outer org.graalvm.nativeimage.Platform
297295
cons public init()
298-
intf org.graalvm.nativeimage.Platform$AMD64
296+
intf org.graalvm.nativeimage.Platform$DARWIN_AMD64
299297
intf org.graalvm.nativeimage.Platform$IOS
300298
supr java.lang.Object
301299

@@ -318,6 +316,25 @@ intf org.graalvm.nativeimage.Platform$AMD64
318316
intf org.graalvm.nativeimage.Platform$LINUX
319317
supr java.lang.Object
320318

319+
CLSS public abstract interface static org.graalvm.nativeimage.Platform$MACOS
320+
outer org.graalvm.nativeimage.Platform
321+
intf org.graalvm.nativeimage.Platform$DARWIN
322+
meth public java.lang.String getOS()
323+
324+
CLSS public final static org.graalvm.nativeimage.Platform$MACOS_AARCH64
325+
outer org.graalvm.nativeimage.Platform
326+
cons public init()
327+
intf org.graalvm.nativeimage.Platform$DARWIN_AARCH64
328+
intf org.graalvm.nativeimage.Platform$MACOS
329+
supr java.lang.Object
330+
331+
CLSS public final static org.graalvm.nativeimage.Platform$MACOS_AMD64
332+
outer org.graalvm.nativeimage.Platform
333+
cons public init()
334+
intf org.graalvm.nativeimage.Platform$DARWIN_AMD64
335+
intf org.graalvm.nativeimage.Platform$MACOS
336+
supr java.lang.Object
337+
321338
CLSS public abstract interface static org.graalvm.nativeimage.Platform$WINDOWS
322339
outer org.graalvm.nativeimage.Platform
323340
intf org.graalvm.nativeimage.impl.InternalPlatform$PLATFORM_JNI
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_SHARED 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_SHARED 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_SHARED {
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_SHARED {
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_SHARED {
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
import java.util.ArrayList;
7171

7272
import org.graalvm.compiler.core.common.NumUtil;
73+
import org.graalvm.nativeimage.Platform;
7374

74-
import com.oracle.svm.core.OS;
7575
import com.oracle.svm.core.ReservedRegisters;
7676
import com.oracle.svm.core.config.ObjectLayout;
7777
import com.oracle.svm.core.graal.code.SubstrateCallingConvention;
@@ -156,7 +156,7 @@ public SubstrateAArch64RegisterConfig(ConfigKind config, MetaAccessProvider meta
156156
*
157157
* https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions
158158
*/
159-
if (OS.DARWIN.isCurrent() || OS.WINDOWS.isCurrent()) {
159+
if (Platform.includedIn(Platform.DARWIN.class) || Platform.includedIn(Platform.WINDOWS.class)) {
160160
regs.remove(r18);
161161
}
162162
allocatableRegs = new RegisterArray(regs);
@@ -311,7 +311,7 @@ public CallingConvention getCallingConvention(Type t, JavaType returnType, JavaT
311311
if (register != null) {
312312
locations[i] = register.asValue(valueKindFactory.getValueKind(kind.getStackKind()));
313313
} else {
314-
if (type.nativeABI() && OS.DARWIN.isCurrent()) {
314+
if (type.nativeABI() && Platform.includedIn(Platform.DARWIN.class)) {
315315
currentStackOffset = darwinNativeStackParameterAssignment(valueKindFactory, locations, i, kind, currentStackOffset, type.outgoing);
316316
} else {
317317
currentStackOffset = javaStackParameterAssignment(valueKindFactory, locations, i, kind, currentStackOffset, type.outgoing);

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;

substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/aarch64/AArch64DarwinUContextRegisterDumper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
import jdk.vm.ci.aarch64.AArch64;
4646

47-
@Platforms({Platform.DARWIN_AARCH64.class, Platform.IOS_AARCH64.class})
47+
@Platforms({Platform.DARWIN_AARCH64.class})
4848
@AutomaticFeature
4949
class AArch64DarwinUContextRegisterDumperFeature implements Feature {
5050
@Override

substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/aarch64/AArch64LinuxUContextRegisterDumper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
import jdk.vm.ci.aarch64.AArch64;
4848

49-
@Platforms({Platform.LINUX_AARCH64.class, Platform.ANDROID_AARCH64.class})
49+
@Platforms({Platform.LINUX_AARCH64_SHARED.class})
5050
@AutomaticFeature
5151
class AArch64LinuxUContextRegisterDumperFeature implements Feature {
5252
@Override

0 commit comments

Comments
 (0)