(12) United States Patent ao) Patent No.: us 6,256,658 Bi
Mourey et al. (45) Date of Patent: Jul. 3,2001
(54) APPARATUS FOR EXECUTING A
PLURALITY OF PROGRAM SEGMENTS
HAVING DIFFERENT OBJECT CODE TYPES
IN A SINGLE PROGRAM OR PROCESSOR
(75) Inventors: Jean-Charles D. Mourey, Cupertino;
Sean R. Parent, Morgan Hill; Bruce
K. Jones, Cupertino; Alan W. Lillich,
Los Gatos; Erik L. Eidt, Campbell;
Eric P. Traut, Mountain View, all of
(73) Assignee: Apple Computer, Inc., Cupertino, CA (US)
( * ) Notice: Subject to any disclaimer, the term of this patent is extended or adjusted under 35 U.S.C. 154(b) by 0 days.
(21) Appl. No.: 08/409,477
(22) Filed: Mar. 22, 1995
Related U.S. Application Data
(63) Continuation of application No. 07/993,923, filed on Dec. 18, 1992, now Pat. No. 5,452,456.
(51) Int. CI. G06F 9 00
(52) U.S. CI 709/100; 709/102; 709/108
(58) Field of Search 709/100, 101,
709/104, 106, 102, 103, 108; 712/244, 245; 703/26
(56) References Cited
U.S. PATENT DOCUMENTS
4,084,235 4/1978 Hirtle et al 364/200
4,589,087 5/1986 Auslander et al 364/768
4,766,566 8/1988 Chuang 364/900
4,779,187 10/1988 Letwin 364/200
4,812,975 3/1989 Adachi et al 364/300
4,825,358 4/1989 Letwin 364/200
4,974,159 11/1990 Hargrove et al 364/200
5,027,273 6/1991 Letwin 364/200
5,274,831 * 12/1993 Katsuta 712/1
5,754,855 * 5/1998 Miller et al 709/106
IBM J. Res. Develop., vol. 34, No. 1, (01/90), "Managing programs and libraries in AIX Version 3 for RISC SYSTEM/ 6000 processors", by Auslander, pp. 98-104.
The invention provides a method and apparatus for switching between execution of a plurality of object code types having different conventions for invoking program procedures and performing stack manipulations. The invention may also be used to switch between different calling conventions within a single object code type. Briefly according to the invention, a computer system comprises a routine descriptor, a stack switch frame, a mode switching mechanism for switching from a first processor, code or calling convention type to a second processor, code or calling convention type and means for executing instructions in various code types.
A routine descriptor describes a program or code segment and its code type and calling conventions. A routine descriptor contains, among other information, a "mixed mode" field which is set to a specific, predetermined value such as a value indicating an instruction which is not legal in the runtime environment of a first processor, code or calling convention type. When that instruction is encountered, control is transferred to the mode switching mechanism. A routine descriptor also contains a "procedure information" field which is set to a value indicating the convention for invoking a program segment and performing appropriate stack manipulations.
When a routine calls a routine having a different stack model, the mode switching mechanism uses a stack switch frame to provide a transition between the two different stack types.