openjdk/jdk · warning
*** used_mask is 0 ***
Error message
*** used_mask is 0 ***
What it means
Printed by adlc's pipeline-adventure generator (output_c.cpp, pipeline_res_mask_initializer). For each resource a pipeline class uses, it looks up the resource's mask from the pipeline's resource description; if that mask is 0 the message is printed but generation continues, and the zero mask then skews the lb/ub bit scans (the loops at minimum find lb=0..31 range only if bits set — with mask 0, 'for (lb = 0; (used_mask & (1 << lb)) == 0; lb++);' actually runs off the end of the int, undefined behavior).
Source
Thrown at src/hotspot/share/adlc/output_c.cpp:481
static const char* pipeline_use_element = "Pipeline_Use_Element";
templen = 1 +
(int)(strlen(pipeline_use_cycle_mask) + (int)strlen(pipeline_use_element) +
(cyclemasksize * 12) + masklen + (cycledigit * 2) + 30) * element_count;
// Allocate space for the resource list
const size_t resource_mask_size = templen;
char * resource_mask = new char [resource_mask_size];
char * last_comma = nullptr;
templen = 0;
for (pipeclass->_resUsage.reset();
(piperesource = (const PipeClassResourceForm*)pipeclass->_resUsage.iter()) != nullptr; ) {
int used_mask = pipeline->_resdict[piperesource->_resource]->is_resource()->mask();
if (!used_mask) {
fprintf(stderr, "*** used_mask is 0 ***\n");
}
resources_used |= used_mask;
uint lb, ub;
for (lb = 0; (used_mask & (1 << lb)) == 0; lb++);
for (ub = 31; (used_mask & (1 << ub)) == 0; ub--);
if (lb == ub) {
resources_used_exclusively |= used_mask;
}
int formatlen =
snprintf_checked(&resource_mask[templen], resource_mask_size - templen, " %s(0x%0*x, %*d, %*d, %s %s(",
pipeline_use_element,
masklen, used_mask,
cycledigit, lb, cycledigit, ub,View on GitHub (pinned to 88dfb74bbe)
Solutions
- Open the .ad file's pipeline description and find the resource named in the failing pipe class's resUsage
- Give the resource a non-empty definition, e.g. resources( INS_FLAG='0:1' ) style bit assignments, so its mask is non-zero
- If the resource is intentionally unused, remove it from the pipe class instead of leaving a zero-mask resource
- Re-run the build and confirm adlc stderr no longer prints '*** used_mask is 0 ***'
Example fix
// before
pipe_class myPipe(...) %{ ...; myRes; %}
// resources section declares: resource myRes; // no bits -> mask 0
// after
resources( MYRES='0:1' );
pipe_class myPipe(...) %{ ...; MYRES; %} Defensive patterns
Strategy: validation
Validate before calling
# Check every resource referenced by a pipe class is declared with bits in the
# pipeline description; a quick audit before building:
# 1) list resources used: grep -oE 'resource [A-Za-z0-9_]+' <arch>.ad
# 2) list declared masks: grep -A3 'resources\\(' <arch>.ad
# ensure every used name has a non-empty mask assignment Prevention
- Keep the resources(...) declaration and every pipe_class resource usage in the same edit set
- Treat 'used_mask is 0' as fatal in CI (grep adlc stderr) because the subsequent bit-scan is undefined behavior
- Model unused resources by deleting references, not by leaving zero masks
When it happens
Trigger: A .ad file pipeline section where a resource referenced by a pipe class (resource usage in the instruction's ins_pipe pipe class definition) has an empty/zero mask — i.e. the resource was declared with no stage list, or the resource declaration 'resource <name>' carries no bits (e.g. declared with no functional-unit assignment).
Common situations: Writing a new pipeline model for a port; declaring resources in the 'resources' block of the pipeline description but forgetting to give them stage masks / functional unit bits; referencing an undeclared-shape resource from an ins_pipe class.
Related errors
- Warning: cannot find memory opnd in instr.
- No format defined for %s
- pipeline_res_mask_initializer: semantic error: pipeline stag
- Error: Out of memory in ADLC\n
- %s: Found %d syntax error
AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14).
Data as JSON: /api/errors/a952c9eb62efd048.
Report an issue: GitHub.