Claims
- 1. A method for statically allocating a procedure return address, comprising:
separating a software program into a cyclic part and an acyclic part, said software program comprising a plurality of procedures; allocating a static address for a procedure return address; and modifying at least one of said plurality of procedures to refer to said static address for said procedure return address.
- 2. The method of claim 1 wherein
said method further comprises analyzing said acyclic part to determine the maximum depth of said procedure return address in all possible call stack configurations; and said allocating further comprises allocating a static address for said procedure return address based upon said maximum depth.
- 3. The method of claim 1 wherein said analyzing is performed by a compiler.
- 4. The method of claim 1 wherein said modifying is performed automatically by a tool.
- 5. The method of claim 1 wherein said static address comprises the address of said call stack configuration at said maximum depth.
- 6. The method of claim 1 wherein said separating further comprises building an acyclic call graph.
- 7. The method of claim 1 wherein said acyclic part is non-recursive.
- 8. The method of claim 2, further comprising allocating an area of memory for at least one procedure return address, said area of memory being private to a processor, the size of said area of memory based on said maximum depth.
- 9. The method of claim 8, further comprising using a return instruction to return from said at least one of said plurality of procedures, said return instruction configured to accept an operand that contains said static address in said area of memory for said at least one of said plurality of procedures.
- 10. The method of claim 8, further comprising using a return instruction to return from said at least one of said plurality of procedures, said return instruction configured to accept an operand that contains an index into said area of memory for said at least one of said plurality of procedures.
- 11. The method of claim 8, further comprising using a return instruction to return from said at least one of said plurality of procedures, said return instruction including a static address encoded in said return instruction, said static address referring to a location in area of memory containing a return address for said at least one of said plurality of procedures.
- 12. The method of claim 8, further comprising using a return instruction to return from said at least one of said plurality of procedures, said return instruction including an index encoded in said return instruction, said index referring to a location in area of memory containing a return address for said at least one of said plurality of procedures.
- 13. The method of claim 2 wherein said modifying further comprises modifying said software program to indicate said maximum depth.
- 14. The method of claim 13 wherein said modifying further comprises modifying said software program to include a parameter in said software program, said parameter to indicate said maximum depth.
- 15. The method of claim 13 wherein said modifying further comprises modifying said software program to include an instruction in said software program, said instruction to indicate said maximum depth.
- 16. A program storage device readable by a machine, embodying a program of instructions executable by the machine to perform a method for statically allocating a procedure return address, the method comprising:
separating a software program into a cyclic part and an acyclic part, said software program comprising a plurality of procedures; allocating a static address for a procedure return address; and modifying at least one of said plurality of procedures to refer to said static address for said procedure return address.
- 17. The program storage device of claim 16 wherein
said method further comprises analyzing said acyclic part to determine the maximum depth of said procedure return address in all possible call stack configurations; and said allocating further comprises allocating a static address for said procedure return address based upon said maximum depth.
- 18. The program storage device of claim 16 wherein said static address comprises the address of said call stack configuration at said maximum depth.
- 19. The program storage device of claim 16 wherein said separating further comprises building an acyclic call graph.
- 20. The program storage device of claim 16 wherein said acyclic part is non-recursive.
- 21. The program storage device of claim 17 wherein said method further comprises allocating an area of memory for at least one procedure return address, said area of memory being private to a processor, the size of said area of memory based on said maximum depth.
- 22. The program storage device of claim 21 wherein said method further comprises using a return instruction to return from said at least one of said plurality of procedures, said return instruction configured to accept an operand that contains said static address in said area of memory for said at least one of said plurality of procedures.
- 23. The program storage device of claim 21 wherein said method further comprises using a return instruction to return from said at least one of said plurality of procedures, said return instruction configured to accept an operand that contains an index into said area of memory for said at least one of said plurality of procedures.
- 24. The program storage device of claim 21 wherein said method further comprises using a return instruction to return from said at least one of said plurality of procedures, said return instruction including a static address encoded in said return instruction, said static address referring to a location in area of memory containing a return address for said at least one of said plurality of procedures.
- 25. The program storage device of claim 21 wherein said method further comprises using a return instruction to return from said at least one of said plurality of procedures, said return instruction including an index encoded in said return instruction, said index referring to a location in area of memory containing a return address for said at least one of said plurality of procedures.
- 26. The program storage device of claim 17 wherein said modifying further comprises modifying said software program to indicate said maximum depth.
- 27. The program storage device of claim 26 wherein said modifying further comprises modifying said software program to include a parameter in said software program, said parameter to indicate said maximum depth.
- 28. The program storage device of claim 26 wherein said modifying further comprises modifying said software program to include an instruction in said software program, said instruction to indicate said maximum depth.
- 29. An apparatus for statically allocating a procedure return address, comprising:
means for separating a software program into a cyclic part and an acyclic part, said software program comprising a plurality of procedures; means for allocating a static address for a procedure return address; and means for modifying at least one of said plurality of procedures to refer to said static address for said procedure return address.
- 30. The apparatus of claim 29 wherein
said apparatus further comprises means for analyzing said acyclic part to determine the maximum depth of said procedure return address in all possible call stack configurations; and said means for allocating further comprises means for allocating a static address for said procedure return address based upon said maximum depth.
- 31. The apparatus of claim 29 wherein said means for analyzing comprises a compiler.
- 32. The apparatus of claim 29 wherein said means for modifying comprises an automated tool.
- 33. The apparatus of claim 29 wherein said static address comprises the address of said call stack configuration at said maximum depth.
- 34. The apparatus of claim 29 wherein said means for separating further comprises means for building an acyclic call graph.
- 35. The apparatus of claim 29 wherein said acyclic part is non-recursive.
- 36. The apparatus of claim 30, further comprising means for allocating an area of memory for at least one procedure return address, said area of memory being private to a processor, the size of said area of memory based on said maximum depth.
- 37. The apparatus of claim 36, further comprising means for using a return instruction to return from said at least one of said plurality of procedures, said return instruction configured to accept an operand that contains said static address in said area of memory for said at least one of said plurality of procedures.
- 38. The apparatus of claim 36, further comprising means for using a return instruction to return from said at least one of said plurality of procedures, said return instruction configured to accept an operand that contains an index into said area of memory for said at least one of said plurality of procedures.
- 39. The apparatus of claim 36, further comprising means for using a return instruction to return from said at least one of said plurality of procedures, said return instruction including a static address encoded in said return instruction, said static address referring to a location in area of memory containing a return address for said at least one of said plurality of procedures.
- 40. The apparatus of claim 36, further comprising means for using a return instruction to return from said at least one of said plurality of procedures, said return instruction including an index encoded in said return instruction, said index referring to a location in area of memory containing a return address for said at least one of said plurality of procedures.
- 41. The apparatus of claim 30 wherein said means for modifying further comprises means for modifying said software program to indicate said maximum depth.
- 42. The apparatus of claim 41 wherein said means for modifying further comprises means for modifying said software program to include a parameter in said software program, said parameter to indicate said maximum depth.
- 43. The apparatus of claim 41 wherein said means for modifying further comprises means for modifying said software program to include an instruction in said software program, said instruction to indicate said maximum depth.
- 44. An apparatus for statically allocating a procedure return address, comprising:
a call stack tool configured to receive a program implementation, said program implementation comprising a plurality of procedures, said call stack tool further configured to separate said software program into a cyclic part and an acyclic part, said call stack tool further configured to allocate a static address for a procedure return address, said call stack tool further configured to modify at least one of said plurality of procedures to refer to said static address for said procedure return address.
- 45. An apparatus comprising:
a processor; and a memory coupled to said processor, said memory comprising a program, said program comprising a plurality of procedures, each of said procedures comprising at least one executable instruction, said at least one executable instruction including a procedure return instruction to transfer program control to a calling procedure, said procedure return instruction referring to a static address for a procedure return address.
- 46. The apparatus of claim 45 wherein said apparatus comprises a smart card.
- 47. The apparatus of claim 46 wherein said smart card comprises a Java Card™ technology-enabled smart card.
- 48. An apparatus to execute a plurality of instructions comprising a computer program, the apparatus comprising:
a memory; a processor coupled to said memory, said processor configured to receive said plurality of instructions, said plurality of instructions including an indication of the maximum call stack size for execution of said program, said processor configured to allocate a portion of said memory for at least one procedure return address, the size of said memory portion based upon said indication, said processor further configured to execute said program.
- 49. The apparatus of claim 48 wherein said indication comprises a parameter.
- 50. The apparatus of claim 48 wherein said indication comprises an instruction.
- 51. The apparatus of claim 48 wherein said apparatus comprises a smart card.
- 52. The apparatus of claim 51 wherein
said apparatus comprises a Java Card™ technology-enabled smart card; and said processor comprises a virtual machine.
- 53. A memory for storing data for access by an application program being executed on a data processing system, comprising:
a data structure stored in said memory, said data structure comprising at least one procedure return address referenced by an index encoded in an instruction of said program.
- 54. The memory of claim 53 wherein said instruction comprises 8 bits.
- 55. The memory of claim 54 wherein
said index comprises 4 bits; and said data structure comprises sixteen return addresses.
CROSS REFERENCE TO RELATED APPLICATIONS
[0001] This application is related to the following:
[0002] U.S. patent application Ser. No.______ ,filed Mar. 18, 2002 in the name of Eduard de Jong, entitled “Method and Apparatus for Deployment of High Integrity Software Using Initialization Order and Calling Order Constraints”, Attorney Docket No. SUN-P6957, commonly assigned herewith.
[0003] U.S. patent application Ser. No.______. ,filed Mar. 18, 2002 in the name of Eduard de Jong, entitled “Method and Apparatus for Deployment of High Integrity Software Using Reduced Dynamic Memory Allocation”, Attorney Docket No. SUN-P6958, commonly assigned herewith.