os.arch and universal
Henri Gomez
henri.gomez at gmail.com
Wed May 9 04:56:20 PDT 2012
I also notice some differences in jni part from has been done in macosx-port :
jdk7 u
/* os properties */
{
#ifdef MACOSX
setOSNameAndVersion(&sprops);
#else
struct utsname name;
uname(&name);
sprops.os_name = strdup(name.sysname);
sprops.os_version = strdup(name.release);
#endif
sprops.os_arch = ARCHPROPNAME;
if (getenv("GNOME_DESKTOP_SESSION_ID") != NULL) {
sprops.desktop = "gnome";
}
else {
sprops.desktop = NULL;
}
}
--
macosx-port
/* os properties */
{
sprops.os_arch = ARCHPROPNAME;
#ifdef MACOSX
setOSNameAndVersion(&sprops);
#ifdef __x86_64__
sprops.os_arch = "x86_64";
#elif defined(__i386__)
sprops.os_arch = "i386";
#endif
#else
struct utsname name;
uname(&name);
sprops.os_name = strdup(name.sysname);
sprops.os_version = strdup(name.release);
#endif
Wondering if here also os_arch shouldn't be set regarding data model,
ie 32/64 bits ?
2012/5/9 Henri Gomez <henri.gomez at gmail.com>:
> I'm searching where os.arch is reported on OpenJDK 7 and 8 to
> complement my patches for universal (32/64bits)
>
> in jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java,
> I could see :
>
> public final class JObjCRuntime {
> static { System.loadLibrary("JObjC"); }
>
> public static enum Arch{ ppc, i386, x86_64 };
> public static enum Width{ W32, W64 };
>
> public static final Arch ARCH = getArch();
> public static final Width WIDTH = getWidth();
>
> private static Arch getArch(){
> String arch = System.getProperty("os.arch");
> if("ppc".equals(arch)) return Arch.ppc;
> if("i386".equals(arch)) return Arch.i386;
> if("x86_64".equals(arch)) return Arch.x86_64;
> if("amd64".equals(arch)) return Arch.x86_64;
> if("universal".equals(arch)) return Arch.x86_64;
> throw new RuntimeException("Did not recognize os.arch system
> property: '" + arch + "'");
> }
>
> Should it be :
>
>
> private static Arch getArch(){
> String arch = System.getProperty("os.arch");
> if("ppc".equals(arch)) return Arch.ppc;
> if("i386".equals(arch)) return Arch.i386;
> if("x86_64".equals(arch)) return Arch.x86_64;
> if("amd64".equals(arch)) return Arch.x86_64;
> if("universal".equals(arch) && getWidth() == Width.W64) return
> Arch.x86_64;
> if("universal".equals(arch) && getWidth() == Width.W32) return
> Arch.i386;
> throw new RuntimeException("Did not recognize os.arch system
> property: '" + arch + "'");
> }
More information about the macosx-port-dev
mailing list