os.arch and universal

Henri Gomez henri.gomez at gmail.com
Wed May 9 07:34:28 PDT 2012


Universal patches updated :

http://openjdk-osx-build.googlecode.com/svn/trunk/patches-jdk7u-osx/universal-build.patch

Now os.arch is reported as i386 if data.model is 32 and as x86_64 is
data.model is 64bits.

It should fix problem with JRuby :

https://github.com/jruby/jruby/commit/9e05b5f1791917cdc3487b3ddfd78956c4bb92c0#commitcomment-1306674


Cheers.



2012/5/9 Henri Gomez <henri.gomez at gmail.com>:
> 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