Preparing Programs

To debug an application that contains p-code, you must first successfully compile, link, and run the MPC utility on the application. Chapter 3 in the Programming Techniques manual explains how to build p-code applications and how to mix p-code with native machine code.

During compilation into p-code, the compiler saves space by using p-code quoting. P-code quoting reduces program size by minimizing repeated sequences of instructions. It replaces all but one of the sequences with a special quote instruction which calls the retained sequence.

Summary: Turn off quoting with the /Of option.

Quoting makes debugging difficult because each routine jumps to other routines that contain the quoted instructions. When you compile a program for debugging, specify the /Of option to turn quoting off. When you build a release version of the program, specify /Of to turn quoting back on so that the compiler can generate the smallest possible code.

By default, the compiler sorts local variables by frequency of use. It arranges them on the stack so that the program can access the most frequently used variables with the shortest instructions. This optimization is called frame sorting.

Summary: Turn off frame sorting with the /Ov– option.

Frame sorting can make debugging more difficult because local variables do not appear on the stack in the order in which you declared them. You should turn off frame sorting by specifying the /Ov– option to the compiler. When you build a release version, specify /Ov to turn frame sorting on so that the compiler generates the smallest possible code.