Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Test What You Ship


Q: I went to the trouble of building a fat (68K and PowerPC code) custom window definition function (WDEF) in anticipation of the day when the Window Manager would be implemented in PowerPC-native code. In Mac OS 8.5, the Window Manager is implemented in PowerPC-native code, but only the 68K code in my WDEF gets called. Why?

A: During the development and testing of Mac OS 8.5, we discovered that some applications with custom WDEFs would crash when attempting to open windows which used those WDEFs. On investigating these crashes, we determined that the common factor was fat WDEFs that request that callers use the current instruction set architecture (ISA -- in other words, PowerPC, 68K, or CFM-68K).


For more information regarding ISA's, see the first paragraph of the Mixed Mode section of Chapter 1 of Inside Macintosh: PowerPC System Software.


For more information on requesting the current ISA, see the Routine Flags section of the constants section of the Mixed Mode Manager Reference section of Chapter 2 of Inside Macintosh: PowerPC System Software.


If a fat WDEF requests the current ISA on a system whose Window Manager is 68K code, the WDEF's 68K code is called. Until Mac OS 8.5, requesting the current ISA would never result in the WDEF's PowerPC code being called, because Window Manager was 68K code. However, since the Window Manager is PowerPC code in Mac OS 8.5, the PowerPC half of a fat WDEF requesting the current ISA is always called.

The PowerPC half of the WDEFs in the crashing applications proved to be catastrophically faulty in some small way or other. Generally, this turned out to be incorrect procInfo in the routine descriptor, which results in all sorts of entertaining misbehavior.

We theorize that some developers built fat WDEFs without testing them fully. This is somewhat understandable, because it was impossible to test a fat WDEF which requested the current ISA when that ISA was PowerPC until Mac OS 8.5.

Given a fat WDEF which requests the current ISA, Window Manager now goes out of its way to call the 68K code, which is more likely to have been tested.

There is a larger lesson to be learned here: be careful not to ship code you haven't tested. In other words, code only what you can test now.

[Nov 02 1998]