Claims
- 1. A method of generating code for a computer program having instructions and an object, said instructions referencing two or more fields of said object, comprising:
identifying a field pair of the object, said field pair including an integer field and an array field; determining that the field pair has a predefined invariant relationship by reference to one or more instructions that access the field pair; and generating machine code for the computer program in accordance with whether the field pair has the predefined invariant relationship.
- 2. The method of claim 1, wherein the computer program is written in a language having modularity properties, and further comprising:
determining a subset of the computer program that is checked for the one or more instructions that access the field pair in accordance with the modularity properties.
- 3. The method of claim 2, wherein the subset of the computer program comprises a method of the computer program.
- 4. The method of claim 1, wherein the access comprises one of a read of the integer field, a read of the array field, a modification of the integer field, a modification of the array field, and an adjustment of a length of the array field.
- 5. The method of claim 1, wherein said identifying includes
establishing that a modification of only one of the integer field and the array field does not occur between a read of said array field and a read of said integer field.
- 6. The method of claim 5, wherein the modification of only one of the integer field and the array field is presumed when a call to a method of indeterminate content occurs between the read of the said array field and the read of said integer field.
- 7. The method of claim 1, wherein said identifying includes
establishing that when the access comprises the array being set to a newly allocated array, a new length of the array is set by a function of a form: x′=c1*x+c2, said c1 being greater than or equal to 1, said c2 being greater than or equal to 0, said x being one of a length of the array before being set to the newly allocated array and a value of the integer field, and said x′ being a version of said x.
- 8. The method of claim 1, wherein said identifying includes
establishing that when the access comprises the array being set to another array, the integer is set to zero or a new length of the array after the array is set to said another array.
- 9. The method of claim 1, wherein said identifying includes
establishing that when the access comprises the integer field being reduced by an amount, said access takes place in an instruction that is executed after a branch instruction in which the value of said integer field is confirmed to be less than or equal to a length of the array field plus said amount.
- 10. The method of claim 1, wherein said identifying includes
establishing that when the access comprises the integer field being reduced by a first amount and said access takes place in a second instruction that is preceded by a first instruction in which a length of the array field is increased by a second amount, said second amount is greater than or equal to said first amount.
- 11. The method of claim 1, wherein said determining includes determining whether the array field is equal to a null value.
- 12. The method of claim 1, wherein said determining includes
establishing that the integer field is greater than or equal to 0 and that said integer field is less than or equal to a length of the array field upon entry to and upon exit from each method included in the computer program.
- 13. The method of claim 1, wherein said determining includes
applying a standard value-range technique to an index of a reference of the array to establish that the index is non-negative and less than or equal to a length of the array.
- 14. The method of claim 13, wherein said generating includes
bypassing the inclusion of a bounds check in the computer program when it is established that the index is non-negative and less than or equal to a length of the array.
- 15. A method of generating code for a computer program including an object, comprising
proving that an invariant relationship between an array and an integer of the object, in which one of a) said array being equal to a null value and b) said integer being greater than or equal to 0 and said integer being less than or equal to a length of said array, is true upon entry to and upon exit from each method included in the computer program; and generating machine code for the computer program such that a step of including a bounds check corresponding to the array and the integer is bypassed when the invariant relationship is proven.
- 16. The method of claim 15, wherein said proving includes
establishing that a modification of only one of the integer and the array does not occur between a read of the integer and a read of the array.
- 17. The method of claim 16, wherein
the modification of only one of the integer and the array is presumed when a call to a method of the computer program of indeterminate content occurs between the read of said integer and the read of said array.
- 18. The method of claim 17, wherein the modification comprises an adjustment of a length of the array.
- 19. The method of claim 15, wherein said proving includes
establishing that a reduction of the integer by an amount takes place after a confirmation of said integer being less than or equal to said amount plus a length of the array.
- 20. The method of claim 15, wherein the computer program is written in a language having modularity properties, and further comprising
determining a subset of the computer program that is checked to prove the invariant relationship in accordance with the modularity properties.
- 21. The method of claim 20, wherein the subset of the computer program includes a method of the computer program.
- 22. The method of claim 15, said proving includes
applying a standard value-range technique to an index of a reference of the array to establish that the index is non-negative and less than or equal to a length of the array.
- 23. The method of claim 15, said proving includes
establishing that when the array is set to a newly allocated array, a new length of the array is set by a function of a form: x′=c1*x+c2, said c1 being greater than or equal to 1, said c2 being greater than or equal to 0, said x being one of a length of the array before being set to the newly allocated array and a value of the integer field, and said x′ being a version of said x.
- 24. The method of claim 15, wherein said identifying includes
establishing that when the array is set to another array, the integer is set to zero or a new length of the array after the array is set to said another array.
- 25. A method of generating code for a computer program having an object, comprising
establishing a list of one or more possible field pairs, a possible field pair comprising an array field and an integer field of the object; scanning a portion of the computer program for references to the one or more possible field pairs; removing from the list, each possible field pair corresponding to an invalid combination of references, said invalid combination of references precluding confirmation of an invariant relationship of a possible field pair; confirming the invariant relationship of a possible field pair remaining on the list, said possible field pair remaining on the list comprising an actual field pair; and generating machine code for the computer program such that a step of including a bounds check corresponding to the actual field pair is bypassed when the invariant relationship is confirmed.
- 26. The method of claim 25, wherein
the references comprise one of a read of a field from the one or more possible field pairs, a modification of the field, and an adjustment of a length of the array field from the one or more possible field pairs.
- 27. The method of claim 25, wherein
an invalid combination of references comprises a modification of only one field of a possible field pair between a read of the array field and a read of the integer field of said possible field pair.
- 28. The method of claim 27, wherein
the modification of the only one field of the possible field pair is presumed when a call to a method of the computer program of indeterminate content occurs between the read of the array field and the read of the integer field of said possible field pair.
- 29. The method of claim 25, wherein
an invalid combination of references comprises a reduction of the integer field of a possible field pair by an amount taking place after a confirmation of said integer field being greater than said amount plus a length of the array field of said possible field pair.
- 30. The method of claim 25, wherein
an invalid combination of references comprises a reduction of the integer field of a possible field pair by a first amount being preceded by an increase in a length of the array field of said possible field pair by a second amount when said second amount is less than said first amount.
- 31. The method of claim 25, wherein
an invalid combination of references comprises the array being set to a newly allocated array and one of a call to a method of indeterminate content, a branch instruction, a write to the array, and an assignment to the array or the integers, when combination is not separated by a new length of the array being set by a function of a form: x′=c1*x+c2, said c1 being greater than or equal to 1, said c2 being greater than or equal to 0, said x being one of a length of the array.
- 32. The method of claim 25, wherein
an invalid combination of references comprises the array being set to another array and one of a call to a method of indeterminate content, a branch instruction, a write to the array, and an assignment to the array or the integer, when the combination is not separated by the integer being set to zero or a new length of the array after the array is set to said another array.
- 33. The method of claim 25, wherein said confirming includes determining whether the array field of a possible field pair is equal to a null value.
- 34. The method of claim 25, wherein said confirming includes
establishing that the integer field of a possible field pair is greater than or equal to 0 and that said integer field is less than or equal to a length of the array field of said possible field pair.
- 35. The method of claim 25, wherein said confirming includes
applying a standard value-range technique to an index of a reference of the array to establish that the index is non-negative and less than or equal to a length of the array.
- 36. The method of claim 25, wherein the computer program is written in a language having modularity properties, and further comprising
determining the portion of the computer program that is subject to said scanning in accordance with the modularity properties.
- 37. The method of claim 36, wherein
the portion of the computer program includes a method of the computer program.
- 38. A computer program product for use in conjunction with a computer system, the computer program product comprising a computer readable storage medium and a computer program mechanism embedded therein, the computer program mechanism comprising:
instructions that identify a field pair of an object included in a computer program, said field pair including an integer field and an array field; instructions that determine that the field pair has a predefined invariant relationship by reference to one or more instructions that access the field pair; and instructions that generate machine code for the computer program in accordance with whether the field pair has the predefined invariant relationship.
- 39. A computer program product for use in conjunction with a computer system the computer program product comprising a computer readable storage medium and a computer program mechanism embedded therein, the computer program mechanism comprising:
instructions that prove an invariant relationship between an array and an integer of an object included in a computer program in which one of a) said array being equal to a null value and b) said integer being greater than or equal to 0 and said integer being less than or equal to a length of said array is true; and instructions that generate machine code for the computer program such that a step of including a bounds check corresponding to the array and the integer is bypassed when the invariant relationship is proven.
- 40. A computer program product for use in conjunction with a computer system, the computer program product comprising a computer readable storage medium and a computer program mechanism embedded therein, the computer program mechanism comprising:
instructions that establish a list of one or more possible field pairs, a possible field pair comprising an array field and an integer field of an object included in a computer program; instructions that scan a portion of the computer program for references to the one or more possible field pairs; instructions that remove from the list, each possible field pair corresponding to an invalid combination of references, said invalid combination of references precluding confirmation of an invariant relationship of a possible field pair; instructions that confirm the invariant relationship of a possible field pair remaining on the list, said possible field pair remaining on the list comprising an actual field pair; and instructions that generate machine code for the computer program such that a step of including a bounds check corresponding to the actual field pair is bypassed when the invariant relationship is confirmed.
- 41. A computer system for generating code for a computer program having instructions, the instructions referencing one or more fields of one or more objects comprising:
a memory to store instructions and data; a processor to execute the instructions stored in the memory; the memory storing
instructions that identify a field pair of an object included in a computer program, said field pair including an integer field and an array field; instructions that determine that the field pair has a predefined invariant relationship by reference to one or more instructions that access the field pair; and instructions that generate machine code for the computer program in accordance with whether the field pair has the predefined invariant relationship.
- 42. A computer system for generating code for a computer program having instructions, the instructions referencing one or more fields of one or more objects comprising:
a memory to store instructions and data; a processor to execute the instructions stored in the memory; the memory storing
instructions that prove an invariant relationship between an array and an integer of an object included in a computer program in which one of a) said array being equal to a null value and b) said integer being greater than or equal to 0 and said integer being less than or equal to a length of said array is true; and instructions that generate machine code for the computer program such that a step of including a bounds check corresponding to the array and the integer is bypassed when the invariant relationship is proven.
- 43. A computer system for generating code for a computer program having instructions, the instructions referencing one or more fields of one or more objects comprising:
a memory to store instructions and data; a processor to execute the instructions stored in the memory; the memory storing
instructions that establish a list of one or more possible field pairs, a possible field pair comprising an array field and an integer field of an object included in a computer program; instructions that scan a portion of the computer program for references to the one or more possible field pairs; instructions that remove from the list, each possible field pair corresponding to an invalid combination of references, said invalid combination of references precluding confirmation of an invariant relationship of a possible field pair; instructions that confirm the invariant relationship of a possible field pair remaining on the list, said possible field pair remaining on the list comprising an actual field pair; and instructions that generate machine code for the computer program such that a step of including a bounds check corresponding to the actual field pair is bypassed when the invariant relationship is confirmed.
Parent Case Info
[0001] This application claims priority to a provisional patent application entitled “A SYSTEM AND METHOD FOR IDENTIFYING RELATED FIELDS” bearing Ser. No. 60/389,506, attorney docket number 9772-0319-888, and a Jun. 17, 2002 filing date, which is incorporated herein by reference.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60389506 |
Jun 2002 |
US |