Review OSX universal mode patch

Charles Oliver Nutter headius at headius.com
Thu May 10 08:33:37 PDT 2012


On Thu, May 10, 2012 at 4:24 AM, David Holmes <david.holmes at oracle.com> wrote:
>> ARCHPROP set to universal activate dual build mode .
>
>
> That seems wrong in itself. ARCHPROP is only supposed to hold the value to
> use for the property os.arch. Anything that actually controls the build
> "architecture" should be using one of the (many) other "arch" flags.

Thought I'd jump in to clarify why having "universal" in os.arch is
undesirable, since I think I triggered this bug fix and discussion
with a bug report from JRuby...

In JRuby, we use the value of os.arch to know whether to load a 32 or
64-bit version of our libffi JNI wrapper, along with 32 or 64-bit
versions of other libraries loaded by the user. When the universal
build started reporting "universal", we had no way to know whether we
were running in 32 or 64-bit mode without looking at
sun.arch.data.model, a nonstandard property. I patched JRuby to use
that when os.arch == "universal", but it's an ugly hack.

I believe os.arch should reflect the data model the JVM is currently
*running*, not the models (like universal) it was built for. Reporting
universal is useful only if every library loaded is a universal
binary, where reporting x86/i386/x86_64/amd64 will work for both
loading appropriate non-universal libraries and for loading universal
libraries (which won't care).

FWIW, the Apple JDK5/6 builds all report actual CPU/data model they're
running, even though they're all universal binaries.

- Charlie



More information about the jdk7u-dev mailing list