os.arch and universal

Henri Gomez henri.gomez at gmail.com
Wed May 9 03:16:33 PDT 2012


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