Browse Prior Art Database

Copying Fragmented Data Structures Into Contiguous Memory

IP.com Disclosure Number: IPCOM000105739D
Original Publication Date: 1993-Sep-01
Included in the Prior Art Database: 2005-Mar-20
Document File: 2 page(s) / 30K

Publishing Venue

IBM

Related People

Fung, ACY: AUTHOR

Abstract

Disclosed is an algorithm to generate code-to-code fragmented data structures to a contiguous memory space. The algorithm can be reversed to copy data in a contiguous memory space to individual fragmented data structures. This algorithm uses the idea that each data structure knows what its internal data organization is an therefore should know how to copy itself onto the contiguous memory. Hence, each data structure has an associated "copy" routine to copy itself. If this idea is applied recursively, then each data structure will copy itself, and for each member call its respective "copy" routines. To generate thesee "copy" routines, we have to create a symbol table for the structures and for each data structure generate a function as such:

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 94% of the total text.

Copying Fragmented Data Structures Into Contiguous Memory

      Disclosed is an algorithm to generate code-to-code fragmented
data structures to a contiguous memory space.  The algorithm can be
reversed to copy data in a contiguous memory space to individual
fragmented data structures.  This algorithm uses the idea that each
data structure knows what its internal data organization is an
therefore should know how to copy itself onto the contiguous memory.
Hence, each data structure has an associated "copy" routine to copy
itself.  If this idea is applied recursively, then each data
structure will copy itself, and for each member call its respective
"copy" routines.  To generate thesee "copy" routines, we have to
create a symbol table for the structures and for each data structure
generate a function as such:

     let X be a type and x be a variable of type X

     let cX be the function to copy the structure X
     let the function flat(vX.s) be a function that returns 1 if s in
vX
          is not a pointer and 0 otherwise.

     function cX ( destination, vX, flat )
     {
       if flat then
         copy X to destination

     for each member m of X
         call cM ( destination, vX.m, flat(vX.m);
     }

      This procedure allows automatic code generation since the
simple rule is applied consistently to all data structures.  It
allows better maintenance since the rule is recursive.  It is quick
and...