Flexible data structure layout for data structure including bit-field data members
First Claim
1. A method for laying out data members of a data structure, the data members including bit-field data members, the method comprising the steps of:
- accepting as input i) an identifier for each data member, ii) a data type for each data member, and iii) a data type size for each data member;
accepting as input the value of a plurality of parameters specified by a user, the parameters including;
a first parameter that indicates a minimum alignment requirement of the structure;
a second parameter that indicates the degree to which the structure is to be packed;
a third parameter that indicates whether or not the allocation unit of a bit-field data member can overlap with the allocation unit of a data member for which memory has already been allocated;
a fourth parameter that indicates, if the structure is an unpacked structure, an increment that defines where a new allocation unit for a bit-field data member will start relative to the allocation unit for the previous data member; and
a fifth parameter that indicates whether to allocate an unused portion of the allocation unit of the last data member for which a member offset was determined;
sequentially determining a member offset for each of the data members, wherein;
the determination of the member offset of each data member is dependent upon whether the data member is a bit-field data member or not; and
the determination of one or more of the member offsets is dependent upon the one or more values of the parameters; and
determining a size of the data structure.
1 Assignment
0 Petitions
Accused Products
Abstract
The invention produces data structure layout in a flexible manner that enables the data structures of a computer program to be layed out in a manner that conforms to constraints imposed by a particular computer system on which the program is implemented and that enables the produced data structure layout to be used with different computer systems having different constraints. Thus, the invention is particularly useful with systems that require close control of data structure layout and that have unique requirements for that layout. Embedded real-time systems, which are often implemented on hardware which is designed and optimized for a particular application, are one example of the type of system with which the invention can advantageously be used. The invention additionally allows a user to specify various parameters that control aspects of the manner in which data structure layout is achieved and, therefore, certain characteristics of the data structure layout. The parameters can be specified to achieve a data layout that provides a desired combination of program execution speed and required memory capacity.
26 Citations
9 Claims
-
1. A method for laying out data members of a data structure, the data members including bit-field data members, the method comprising the steps of:
-
accepting as input i) an identifier for each data member, ii) a data type for each data member, and iii) a data type size for each data member; accepting as input the value of a plurality of parameters specified by a user, the parameters including; a first parameter that indicates a minimum alignment requirement of the structure; a second parameter that indicates the degree to which the structure is to be packed; a third parameter that indicates whether or not the allocation unit of a bit-field data member can overlap with the allocation unit of a data member for which memory has already been allocated; a fourth parameter that indicates, if the structure is an unpacked structure, an increment that defines where a new allocation unit for a bit-field data member will start relative to the allocation unit for the previous data member; and a fifth parameter that indicates whether to allocate an unused portion of the allocation unit of the last data member for which a member offset was determined; sequentially determining a member offset for each of the data members, wherein; the determination of the member offset of each data member is dependent upon whether the data member is a bit-field data member or not; and the determination of one or more of the member offsets is dependent upon the one or more values of the parameters; and determining a size of the data structure.
-
-
2. A method for laying out data members of a data structure, the data members including bit-field data members, the method comprising:
-
accepting as input i) an identifier for each data member, ii) a data type for each data member, and iii) a data type size for each data member; accepting as input the value of a parameter specified by a user, the parameter indicating whether or not the allocation unit of a bit-field data member can overlap with the allocation unit of a data member for which memory has already been allocated; sequentially determining a member offset for each of the data members, wherein; the determination of the member offset of each data member is dependent upon whether the data member is a bit-field data member or not; and the determination of one or more of the member offsets is dependent upon the value of the parameter; and determining a size of the data structure. - View Dependent Claims (3)
-
-
4. A method for laying out the data members of a plurality of hierarchically related data structures, the data members including bit-field data members, the method comprising:
-
accepting as input i) an identifier for each data member, ii) a data type for each data member, iii) a data type size for each data member, and iv) an identifier of the data structure to which the data member corresponds; accepting as input the value of a parameter specified by a user, the parameter indicating whether each data structure is to be packed or not; sequentially determining a member offset for each of the data members of all of the plurality of data structures, wherein; the determination of the member offset of each data member is dependent upon whether the data member is a bit-field data member or not; and the determination of one or more of the member offsets is dependent upon the value of the parameter; and determining a size of the data structure.
-
-
5. A method for laying out data members of a data structure, the data members including bit-field data members, the method comprising:
-
accepting as input i) an identifier for each data member, ii) a data type for each data member, and iii) a data type size for each data member; accepting as input the value of a parameter specified by a user, the parameter indicating whether to allocate an unused portion of the allocation unit of the last data member for which a member offset was determined; sequentially determining a member offset for each of the data members, wherein; the determination of the member offset of each data member is dependent upon whether the data member is a bit-field data member or not; and the determination of one or more of the member offsets is dependent upon the value of the parameter; and determining a size of the data structure.
-
-
6. A method for laying out data members of a data structure, the data members including bit-field data members, the method comprising:
-
accepting as input i) an identifier for each data member, ii) a data type for each data member, and iii) a data type size for each data member; accepting as input the value of a parameter specified by a user, the parameter indicating, if the structure is an unpacked structure, an increment that defines where a new allocation unit for a bit-field data member will start relative to the allocation unit for the previous data member; sequentially determining a member offset for each of the data members, wherein; the determination of the member offset of each data member is dependent upon whether the data member is a bit-field data member or not; and the determination of one or more of the member offsets is dependent upon the value of the parameter; and determining a size of the data structure.
-
-
7. A method for laying out data members of a data structure, the data members including bit-field data members, the method comprising:
-
accepting as input i) an identifier for each data member, ii) a data type for each data member, and iii) a data type size for each data member; accepting as input the value of a parameter that indicates a minimum alignment requirement of the structure; sequentially determining a member offset for each of the data members, wherein; the determination of the member offset of each data member is dependent upon whether the data member is a bit-field data member or not; and the determination of one or more of the member offsets is dependent upon the value of the parameter; and determining a size of the data structure.
-
-
8. A method for laying out data members of a data structure so that the data structure is compatible with different computer system requirements, the data members of the data structure including bit-field data members, the method comprising:
-
accepting as input i) an identifier for each data member, ii) a data type for each data member, and iii) a data type size for each data member; accepting as input the value of one or more parameters specified by a user, the parameters permitting the user the change the layout of the data structure to make it compatible with a particular computer system; and sequentially determining a member offset for each of the data members, wherein; the determination of the member offset of each data member is dependent upon whether the data member is a bit-field data member or not; and the determination of one or more of the member offsets is dependent upon the value of the parameters so that the resultant data structure is compatible with the particular computer system. - View Dependent Claims (9)
-
Specification