Specifying an invariant property (range of addresses) in the annotation in source code of the computer program
AssigneeHewlett-Packard Development Company, L.P.
InventorsCarol L. Thompson, Jeff Littfin
Life of this patent
Estimating the term…
Abstract
Method and apparatus for verifying at runtime an invariant property of a data structure. In various example embodiments, code that verifies whether a runtime value of the data structure is consistent with the invariant property is automatically generated in response to an annotation of the data structure in the source code. In executing the program, the runtime value of the data structure is compared to the invariant property in the automatically generated code. If the runtime property is inconsistent with the invariant property, the program branches to exception handler code.
Claims26
A computer-implemented method for verifying at runtime an invariant property of a data structure of a computer program, comprising:
- automatically generating a first code segment that verifies a runtime value of the data structure is consistent with the invariant property in response to an annotation of the data structure that defines the invariant property of the data structure, wherein the invariant property is a range of addresses specified in the annotation in source code of the computer program;
- comparing the runtime value of the data structure with the invariant property during execution of the program via execution of the first code segment, and verifying that the runtime value of the data structure is within the range of addresses;
- and
- performing a programmed action if the runtime value is inconsistent with the invariant property.
An apparatus for verifying at runtime an invariant property of a data structure of a computer program, comprising:
- means for automatically generating a first code segment that verifies a runtime value of the data structure is consistent with the invariant property in response to an annotation of the data structure that defines the invariant property of the data structure, wherein the invariant property is a range of addresses specified in the annotation in source code of the computer program;
- means for comparing the runtime value of the data structure with the invariant property during execution of the program via execution of the first code segment and for verifying that the runtime value of the data structure is within the range of addresses;
- and
- means for performing a programmed action if the runtime value is inconsistent with the invariant property.
A computer-implemented method for verifying at runtime an invariant property of a data structure of a computer program, comprising:
- determining an invariant property of a data structure from a source code specification of the data structure and an associated specification of the invariant property in the source code, wherein the specification of the invariant property defines the invariant property without checking whether a variable used with the data structure is consistent with the invariant property, and the invariant property is a range of addresses specified in the annotation in source code of the computer program;
- generating from the specification of the invariant property a first executable code segment that determines whether a value of a variable used with the data structure is consistent with the invariant property;
- determining during execution of the first executable code segment whether the value of the variable used with the data structure is within the range of addresses;
- and
- performing a programmed action in response to the value of the variable being outside the range of addresses.
An apparatus stored on a computer readable medium and executing on a computer for verifying at runtime an invariant property of a data structure of a computer program, comprising:
- means for determining an invariant property of a data structure from a source code specification of the data structure and an associated specification of the invariant property in the source code, wherein the specification of the invariant property defines the invariant property without checking whether a variable used with the data structure is consistent with the invariant property, and the invariant property is a range of addresses specified in the annotation in source code of the computer program;
- means for generating from the specification of the invariant property a first executable code segment that determines whether a value of a variable used with the data structure is consistent with the invariant property;
- means for determining during execution of the first executable code segment whether the value of the variable used with the data structure is within the range of addresses;
- and
- means for performing a programmed action in response to the value of the variable being outside the range of addresses.
Dependencies are inferred from the claim text.