MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / postProcess

Method postProcess

lib/base-compiler.ts:3854–3902  ·  view source on GitHub ↗
(
        result: CompilationResult,
        outputFilename: string,
        filters: ParseFiltersAndOutputOptions,
        produceOptRemarks = false,
    )

Source from the content-addressed store, hash-verified

3852 }
3853
3854 async postProcess(
3855 result: CompilationResult,
3856 outputFilename: string,
3857 filters: ParseFiltersAndOutputOptions,
3858 produceOptRemarks = false,
3859 ) {
3860 const postProcess = _.compact(this.compiler.postProcess);
3861 const maxSize = this.env.ceProps('max-asm-size', 64 * 1024 * 1024);
3862 const optPromise = produceOptRemarks ? this.processOptOutput(result) : Promise.resolve([] as OptRemark[]);
3863 const stackUsagePromise = result.stackUsagePath
3864 ? this.processStackUsageOutput(result.stackUsagePath)
3865 : ([] as StackUsage.StackUsageInfo[]);
3866 const asmPromise =
3867 (filters.binary || filters.binaryObject) && this.supportsObjdump()
3868 ? this.objdump(
3869 outputFilename,
3870 result,
3871 maxSize,
3872 !!filters.intel,
3873 !!filters.demangle,
3874 filters.binaryObject,
3875 false,
3876 filters,
3877 )
3878 : (async () => {
3879 if (result.validatorTool && result.code === 0) {
3880 // A validator tool is unique because if successful, there will be no asm output
3881 result.asm = '<Validator was successful>';
3882 return result;
3883 }
3884 if (result.asmSize === undefined) {
3885 result.asm = '<No output file>';
3886 return result;
3887 }
3888 if (result.asmSize >= maxSize) {
3889 result.asm =
3890 '<No output: generated assembly was too large' +
3891 ` (${result.asmSize} > ${maxSize} bytes)>`;
3892 return result;
3893 }
3894 if (postProcess.length > 0) {
3895 return await this.execPostProcess(result, postProcess, outputFilename, maxSize);
3896 }
3897 const contents = await fs.readFile(outputFilename);
3898 result.asm = contents.toString();
3899 return result;
3900 })();
3901 return Promise.all([asmPromise, optPromise, stackUsagePromise]);
3902 }
3903
3904 handlePostProcessResult(result, postResult: UnprocessedExecResult): CompilationResult {
3905 result.asm = postResult.stdout;

Callers 1

Calls 8

processOptOutputMethod · 0.95
supportsObjdumpMethod · 0.95
objdumpMethod · 0.95
execPostProcessMethod · 0.95
resolveMethod · 0.80
readFileMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected