openjdk/jdk · error

No format defined for %s

Error message

No format defined for %s

What it means

The ADL compiler, while emitting the debug/output code for an operand (output_internal_operand), hit an operand class that is neither a register, nor a base constant, nor a stack-slot register class. It emits 'No format defined for <operand>' into both the generated file and stderr, dumps the operand, and then asserts (assert(false, "Internal error...")) — so in release adlc builds it silently produces a broken format function, in debug builds adlc aborts.

Source

Thrown at src/hotspot/share/adlc/formssel.cpp:2571

  if (_matrule && (_matrule->is_base_register(globals) ||
                   strcmp(ideal_type(globalAD->globalNames()), "RegFlags") == 0)) {
    // !!!!! !!!!!
    fprintf(fp,"  { char reg_str[128];\n");
    fprintf(fp,"    ra->dump_register(node,reg_str, sizeof(reg_str));\n");
    fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
    fprintf(fp,"  }\n");
  } else if (_matrule && (dtype = _matrule->is_base_constant(globals)) != Form::none) {
    format_constant( fp, index, dtype );
  } else if (ideal_to_sReg_type(_ident) != Form::none) {
    // Special format for Stack Slot Register
    fprintf(fp,"  { char reg_str[128];\n");
    fprintf(fp,"    ra->dump_register(node,reg_str, sizeof(reg_str));\n");
    fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
    fprintf(fp,"  }\n");
  } else {
    fprintf(fp,"  st->print(\"No format defined for %s\n\");\n", _ident);
    fflush(fp);
    fprintf(stderr,"No format defined for %s\n", _ident);
    dump();
    assert( false,"Internal error:\n  output_internal_operand() attempting to output other than a Register or Constant");
  }
}

// Similar to "int_format" but for cases where data is external to operand
// external access to reg# node->in(idx)->_idx,
void  OperandForm::ext_format(FILE *fp, FormDict &globals, uint index) {
  Form::DataType dtype;
  if (_matrule && (_matrule->is_base_register(globals) ||
                   strcmp(ideal_type(globalAD->globalNames()), "RegFlags") == 0)) {
    fprintf(fp,"  { char reg_str[128];\n");
    fprintf(fp,"    ra->dump_register(node->in(idx");
    if ( index != 0 ) fprintf(fp,              "+%d",index);
    fprintf(fp,                                      "),reg_str,sizeof(reg_str));\n");
    fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
    fprintf(fp,"  }\n");
  } else if (_matrule && (dtype = _matrule->is_base_constant(globals)) != Form::none) {

View on GitHub (pinned to 88dfb74bbe)

Solutions

  1. Look at the dump() output right after the message to identify the offending operand name
  2. Give the operand a proper matrule: a register form (match base register class), a constant form (match constant type), or a stack-slot register (sReg) name
  3. If the operand is only used as an interface/placeholder, make sure it is never passed through int_format/output paths — or model it as a constant/register explicitly
  4. Rebuild the adlc-generated sources; the assert only fires in debug adlc, so also grep the generated ad_<arch>.cpp for 'No format defined' to catch it in release builds

Example fix

// before
operand myOpnd(%g globalReg) %{ match(Reg); %} // malformed/missing matrule

// after
operand myOpnd() %{ match(RegI); op_cost(0); format %{ "%%myOpnd" %} interface(CONST_REG); %}
Defensive patterns

Strategy: validation

Validate before calling

# After codegen, assert the generated formatter has no placeholder:
grep -R "No format defined" build/*/hotspot/variances/*/ad_* || echo OK

Prevention

When it happens

Trigger: Declaring an operand in a .ad file with no matrule, or with a matrule that is not a base register / base constant, and whose name does not map to a special register (sReg) type via ideal_to_sReg_type. Any operand that reaches output_internal_operand without matching one of the three supported shapes triggers it.

Common situations: Adding a new opaque/interface operand (e.g. for a predicate or runtime constant) without giving it a matrule; redefining an existing operand's matrule; typos in ideal type names so the matrule is parsed as 'none'.

Related errors


AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14). Data as JSON: /api/errors/409bb9f17deac225. Report an issue: GitHub.