When you run r-code for the first time, from either an operating system file or a standard library, OpenEdge loads and executes the r-code as follows:
1. Opens the file (.cls, .p, or .r) or procedure library (.pl), if the library is not already open.
2. Reads the r-code into memory and creates an r-code directory entry for it. OpenEdge first compiles a procedure into r-code, if necessary.
3. Registers each required r-code segment in the execution environment as follows:
a. Loads the r-code segment at the head of the segment chain in the execution buffer
b. Adds an r-code segment entry to the segment descriptor table that references the segment in the execution buffer
c. Inserts a segment descriptor reference in the r-code directory entry for the r-code
If all the required r-code segments do not fit in the execution buffer, OpenEdge attempts to free space by swapping r-code segments already in the buffer to the r-code swap file. If OpenEdge cannot free enough space by swapping segments, it increases the execution buffer ceiling and allocates more space for the execution buffer.
Note: Codepage-converted text segments within standard or memory-mapped procedure libraries are swapped in and out of the r-code swap file, preserving any code page conversions that occurred during the initial load of the text segment. When accessing members stored in a standard library, OpenEdge does not swap r-code segments to the r-code swap file unless you specify the PROLIB Swap (-pls) startup parameter. By default, if OpenEdge needs an r-code segment in a standard library, it reloads the segment into the execution buffer from the library in local memory.
4. Once the required r-code segments are registered in the execution environment, the interpreter begins executing the r-code at the start of the first main action code segment and accesses the remaining segments directly from local memory as required.