/* StoreCode - store the function or method under construction */ void StoreCode(ParseContext *c) { int codeSize; /* check for unterminated blocks */ switch (CurrentBlockType(c)) { case BLOCK_IF: case BLOCK_ELSE: ParseError(c, "expecting END IF"); case BLOCK_FOR: ParseError(c, "expecting NEXT"); case BLOCK_DO: ParseError(c, "expecting LOOP"); case BLOCK_NONE: break; } /* fixup the RESERVE instruction at the start of the code */ if (c->codeType != CODE_TYPE_MAIN) { c->codeBuf[1] = c->localOffset; putcbyte(c, OP_RETURN); } /* make sure all referenced labels were defined */ CheckLabels(c); /* place string literals defined in this function */ PlaceStrings(c); /* determine the code size */ codeSize = (int)(c->cptr - c->codeBuf); #if 0 VM_printf("%s:\n", c->codeName); DecodeFunction((uint8_t *)c->image, (c->image->objectDataSize + GetObjSizeInWords(sizeof(VectorObjectHdr))) * sizeof(VMVALUE), c->codeBuf, codeSize); DumpSymbols(&c->arguments, "arguments"); DumpSymbols(&c->locals, "locals"); VM_printf("\n"); #endif /* store the vector object */ StoreBVectorData(c, c->code, PROTO_CODE, c->codeBuf, codeSize); /* empty the local heap */ c->nextLocal = c->sys->freeTop; InitSymbolTable(&c->arguments); InitSymbolTable(&c->locals); c->labels = NULL; /* reset to compile the next code */ c->codeType = CODE_TYPE_MAIN; c->cptr = c->codeBuf; }
void COMF::Dump(int options) { // Dump file if (options & DUMP_FILEHDR) DumpRecordTypes(); // Dump summary of record types if (options & DUMP_STRINGTB) DumpNames(); // Dump names records if (options & DUMP_SYMTAB) DumpSymbols(); // Dump public/external name records if (options & DUMP_SECTHDR) DumpSegments(); // Dump segment records if (options & DUMP_RELTAB) DumpRelocations(); // Dump fixup records if (options & DUMP_COMMENT) DumpComments(); // Dump coment records }