{"record":{"id":"4f30ca3765917791","repo":"openjdk/jdk","slug":"pipeline-res-mask-initializer-semantic-error-pip","errorCode":null,"errorMessage":"pipeline_res_mask_initializer: semantic error: pipeline stage undeclared: %s\n","messagePattern":"pipeline_res_mask_initializer: semantic error: pipeline stage undeclared: (.+?)\n","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/hotspot/share/adlc/output_c.cpp","lineNumber":510,"sourceCode":"      resources_used_exclusively |= used_mask;\n    }\n\n    int formatlen =\n      snprintf_checked(&resource_mask[templen], resource_mask_size - templen, \"  %s(0x%0*x, %*d, %*d, %s %s(\",\n        pipeline_use_element,\n        masklen, used_mask,\n        cycledigit, lb, cycledigit, ub,\n        ((used_mask & (used_mask-1)) != 0) ? \"true, \" : \"false,\",\n        pipeline_use_cycle_mask);\n\n    templen += formatlen;\n\n    memset(res_mask, 0, cyclemasksize * sizeof(uint));\n\n    int cycles = piperesource->_cycles;\n    uint stage          = pipeline->_stages.index(piperesource->_stage);\n    if ((uint)NameList::Not_in_list == stage) {\n      fprintf(stderr,\n              \"pipeline_res_mask_initializer: \"\n              \"semantic error: \"\n              \"pipeline stage undeclared: %s\\n\",\n              piperesource->_stage);\n      exit(1);\n    }\n    uint upper_limit    = stage + cycles - 1;\n    uint lower_limit    = stage - 1;\n    uint upper_idx      = upper_limit >> 5;\n    uint lower_idx      = lower_limit >> 5;\n    uint upper_position = upper_limit & 0x1f;\n    uint lower_position = lower_limit & 0x1f;\n\n    uint mask = (((uint)1) << upper_position) - 1;\n\n    while (upper_idx > lower_idx) {\n      res_mask[upper_idx--] |= mask;\n      mask = (uint)-1;","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/hotspot/share/adlc/output_c.cpp#L492-L528","documentation":"A fatal semantic error in adlc's pipeline model processing (pipeline_res_mask_initializer). A pipe class resource usage lists a stage name (piperesource->_stage) that is not present in the pipeline description's declared stage list (pipeline->_stages). adlc prints the error and calls exit(1), aborting the build of the generated matcher/encoder sources.","triggerScenarios":"In the .ad file's pipeline description, a pipe_class's resource usage references a stage (e.g. 'myRes 3' where the cycle/stage syntax names a stage) that was never declared in the pipe_desc stages(...) declaration; or a typo in a stage name between the declaration and its use.","commonSituations":"Hand-editing pipeline descriptions; renaming a stage in stages(...) but not in the pipe classes that use it; porting a pipeline model between architectures where stage names differ.","solutions":["Note the stage name printed at the end of the message; it is exactly the undeclared name","Add that stage to the pipeline description's stage list (stages(...)) or fix the typo in the pipe class resource usage","Keep stage lists and pipe classes in one edit when renaming stages","Re-run make; adlc exits 1 so the build stops at the ad file compile step"],"exampleFix":"// before\npipe_desc( %{ stages(IF, ID, EX, WB); %} );\npipe_class p(...) %{ ...; EX2; %} // EX2 undeclared\n\n// after\npipe_desc( %{ stages(IF, ID, EX, EX2, WB); %} );\npipe_class p(...) %{ ...; EX2; %}","handlingStrategy":"validation","validationCode":"# Verify each stage used in pipe classes is declared:\npython3 - <<'EOF'\nimport re\nsrc = open('src/hotspot/cpu/<arch>/<arch>.ad').read()\ndeclared = set(re.findall(r'stages\\\\(([^)]*)\\\\)', src))\ndeclared = set(s.strip() for m in declared for s in m.replace('\\\\n',' ').split(',') if s.strip())\nused = set(re.findall(r'([A-Z][A-Za-z0-9_]*)\\\\s*\\\\(\\d+\\\\)', src))\nmissing = used - declared\nassert not missing, f'undeclared pipeline stages: {missing}'\nEOF","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Rename stages with search-and-replace across declaration and all usages in one change","Run this validation as a pre-commit hook when touching pipeline sections of .ad files"],"tags":["hotspot","adlc","pipeline-model","ad-file","build-failure"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}