Song of The Day: What’d I Say - Artist: Ray Charles

Over the weekend I started a post about OS X Leopard. Thought I’d post a follow-up or two about the features. Most have probably read or heard about the Dock and Finder improvements, which include reflections, Cover Flow and Stacks.
Those alone could be enough for one to justify a purchase, but I thought I’d write a few thoughts about one of the less emphasized features (i.e., at least lately) of OS X Leopard: full 64-bit support in the OS and Xcode 3.0. BTW Xcode 3.0 is offered as an optional install from the OS X Leopard installation disc. From the Apple website Xcode 3.0, Cocoa, and 64-bit blow the ceiling off of memory and data restrictions:
- 64-bit addressing of up to 16 exabytes of virtual memory and 4 terabytes of physical memory
- Full 64-bit arithmetic
- 64-bit development tools
- 64-bit performance monitoring tools
- Seamless deployment
- LP64 data model
- Common source base support
Granted, most probably won’t see much need for it immediately, but its introduction paves a great evolutionary step forward. For example, Leopard applications running on Intel-based Core 2 Duo processors may take advantage of the x86-64 instruction set. One area where this may make a difference is in software rendering for games, etc.
There was an announcement by Apple a while back regarding the use of LLVM with OpenGL for software rendering. When particular hardware features are unavailable LLVM helps fill the gap. Using the 64-bit version could improvement performance substantially.
Furthermore, as mentioned, if an app or OS needs over 4GB of memory, then 64-bit removes that boundary, allowing up to 16 exabytes of VM or 4 TB of physical! Don’t see many reasons a typical consumer laptop or desktop would need such capability; however, intense graphics and video applications (i.e., data intensive in general) could substantially benefit from increased memory and larger file pointer sizes.
As a little test drive for Cocoa and 64-bit, I recompiled my simple Cocoa-based dentp program (i.e., a pinger). It was pretty easy, but I ran into a few initial gotchas due to the way I loaded my Xcode 2.x project with Xcode 3.0.

Initially, I just adjusted the Project Settings within Xcode 3.0 to use Architectures 64-bit and changed the Base SDK Path to point to “/Developer/SDKs/MacOSX10.5.sdk” because it was pointing to the “MacOSX10.4u.sdk” from my previous installation. It built and ran, but after using the file command on the dentp binary, I noticed that it still read:
> file dentp dentp: Mach-O executable i386
Once I switched my “Cross-Develop Using Target SDK” under the General tab under Project Settings to use Mac OS 10.5 (or Current Mac OS) and the Active Target to x86_64, I eventually saw the desired file type:
> file dentp dentp: Mach-O 64-bit executable x86_64

However, I still wasn’t able to compile for multiple architectures together (i.e., i386 and x86_64) as I wanted. For example, if you do the following on the Xcode binary it will display four architectures:
[newton]:/Developer/Applications/Xcode.app/Contents/MacOS]
> file Xcode
Xcode: Mach-O universal binary with 4 architectures
Xcode (for architecture ppc7400): Mach-O executable ppc
Xcode (for architecture ppc64): Mach-O 64-bit executable ppc64
Xcode (for architecture i386): Mach-O executable i386
Xcode (for architecture x86_64): Mach-O 64-bit executable x86_64
To build a universal binary for all four I had to Edit active target “dentp.” I added the the additional 64-bit targets to the default i386 and ppc target Architectures and I was golden:
[newton]:~/code/dentp2/build/Release/dentp.app/Contents/MacOS]
> file dentp
dentp: Mach-O universal binary with 4 architectures
dentp (for architecture i386): Mach-O executable i386
dentp (for architecture ppc7400): Mach-O executable ppc
dentp (for architecture ppc64): Mach-O 64-bit executable ppc64
dentp (for architecture x86_64): Mach-O 64-bit executable x86_64
Overall, it didn’t make my program any noticeably faster or better; however, it was, now, an official 64-bit binary running on OS X Leopard, which is pretty cool. Also, no additional CD requests needed to get 64-bit support with Leopard (umm…like with Vista? :) and no reason to release multiple binaries on the Mac platform! That’s the beauty of universal.
And to think that I would have needed a super computer a few years back!
Perhaps, a few notes on other features in the next few posts…
Tags: Eric O’Laughlen, OS X Leopard, 64-bit
