Standard execution sequence

When you run r-code for the first time, from either an operating system file, a standard procedure library, or an archive, OpenEdge loads and executes the r-code as follows:

  1. Opens the file (.cls, .p, or .r), procedure library (.pl), or archive file (.apl) 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:
    1. Loads the r-code segment at the head of the segment chain in the execution buffer
    2. Adds an r-code segment entry to the segment descriptor table that references the segment in the execution buffer
    3. 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 or archive files 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 procedure 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.