At run time, OpenEdge manages the execution of r-code from either an operating system file or a standard procedure library using the following components:
Execution buffer — The portion of local memory that OpenEdge allocates and uses to store the chain of loaded r-code segments for all procedures executing in local memory.
R-code swap file (.rcd) — A file that OpenEdge uses to dynamically swap r-code segments in and out of the execution buffer.
Segment descriptor table — An in-memory table that references the r-code segments required by all executing procedures, including the location of each r-code segment in the execution buffer and usage count information.
R-code directory — An in-memory table that contains information about each executing r-code, including r-code size, usage count, segment descriptions, and a reference to the segment descriptor table for each segment.
OpenEdge uses the segment descriptor table and the r-code directory to manage r-code from operating system files, standard libraries, and memory-mapped libraries.
The following image shows the layout for the standard r-code execution environment.
Figure 15. Standard r-code execution environment
In the above image, OpenEdge located and loaded the cust.r and orders.r files into local memory from either operating system files or standard libraries. The execution buffer is shown with three cust.r segments and two orders.r segments. Note that one orders.r segment is located in the execution buffer, while the other segment is swapped to the r-code swap file (.rcd). When space in the execution buffer is needed for new r-code segments, OpenEdge uses the r-code swap file to swap out the least-recently used segments. When OpenEdge needs a segment that has been swapped to the r-code swap file, it reloads the segment from the r-code swap file into the execution buffer.