// Generates code to compute and push the address of a named variable. // vname is the program phrase that names this variable. // currentLevel is the routine level where the vname occurs. // frameSize is the anticipated size of the local stack frame when // the variable is addressed at run-time. void EncodeFetchAddress(Vname vname, Frame frame) { var baseObject = vname.Visit(this, frame) as AddressableEntity; // If indexed = true, code will have been generated to load an index // value. baseObject.EncodeFetchAddress(_emitter, frame, vname); }
// Generates code to fetch the value of a named constant or variable // and push it on to the stack. // currentLevel is the routine level where the vname occurs. // frameSize is the anticipated size of the local stack frame when // the constant or variable is fetched at run-time. // valSize is the size of the constant or variable's value. void EncodeFetch(Vname vname, Frame frame, int valSize) { IFetchableEntity baseObject = vname.Visit(this, frame); // If indexed = true, code will have been generated to load an index // value. if (valSize > 255) { _errorReporter.ReportRestriction("can't load values larger than 255 words"); valSize = 255; // to allow code generation to continue } baseObject.EncodeFetch(_emitter, frame, valSize, vname); }