{"record":{"id":"9084919950ed1e11","repo":"openjdk/jdk","slug":"warning-threadlocal-instruction-s-should-be-name","errorCode":null,"errorMessage":"Warning: ThreadLocal instruction %s should be named 'tlsLoadP_*'\n","messagePattern":"Warning: ThreadLocal instruction (.+?) should be named 'tlsLoadP_\\*'\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/hotspot/share/adlc/formssel.cpp","lineNumber":304,"sourceCode":"  if (_size != nullptr && strcmp(_size, \"0\") == 0) {\n    return 1;\n  }\n  return 0;\n}\n\nint InstructForm::is_tls_instruction() const {\n  if (_ident != nullptr &&\n      ( ! strcmp( _ident,\"tlsLoadP\") ||\n        ! strncmp(_ident,\"tlsLoadP_\",9)) ) {\n    return 1;\n  }\n\n  if (_matrule != nullptr && _insencode != nullptr) {\n    const char* opType = _matrule->_opType;\n    if (strcmp(opType, \"Set\")==0)\n      opType = _matrule->_rChild->_opType;\n    if (strcmp(opType,\"ThreadLocal\")==0) {\n      fprintf(stderr, \"Warning: ThreadLocal instruction %s should be named 'tlsLoadP_*'\\n\",\n              (_ident == nullptr ? \"nullptr\" : _ident));\n      return 1;\n    }\n  }\n\n  return 0;\n}\n\n\n// Return 'true' if this instruction matches an ideal 'If' node\nbool InstructForm::is_ideal_if() const {\n  if( _matrule == nullptr ) return false;\n\n  return _matrule->is_ideal_if();\n}\n\n// Return 'true' if this instruction matches an ideal 'FastLock' node\nbool InstructForm::is_ideal_fastlock() const {","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/hotspot/share/adlc/formssel.cpp#L286-L322","documentation":"ADLC naming-convention warning from InstructForm::is_tls_instruction(): the instruction's match rule references the ThreadLocal ideal node, but its identifier does not follow the required 'tlsLoadP' / 'tlsLoadP_*' convention. The instruction is still classified as a TLS instruction (returns 1), but the warning flags that downstream generated code relies on the name prefix for TLS handling.","triggerScenarios":"Defining an instruct whose match rule's opType (after unwrapping a 'Set') is 'ThreadLocal' while naming the instruction something other than tlsLoadP or tlsLoadP_something. The check inspects _ident and the matrule/insencode pair.","commonSituations":"Adding or renaming thread-local load instructions during HotSpot porting; naming a new TLS access helper 'loadTLS' instead of 'tlsLoadP_slow'.","solutions":["Rename the instruction to 'tlsLoadP' or with the 'tlsLoadP_' prefix","If the name cannot change, verify the generated matcher still handles the instruction correctly","Rebuild to confirm the warning is gone"],"exampleFix":"// before\ninstruct loadTLS(iRegP reg) %{ match(Set reg (ThreadLocal)); %}\n\n// after\ninstruct tlsLoadP_slow(iRegP reg) %{ match(Set reg (ThreadLocal)); %}","handlingStrategy":"validation","validationCode":"grep -nP 'instruct\\s+(?!tlsLoadP)\\w+.*ThreadLocal' src/hotspot/cpu/x86/x86.ad 2>/dev/null || true # flag instructions matching ThreadLocal with wrong names","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Name TLS-loading instructions 'tlsLoadP' or 'tlsLoadP_*'","Keep the naming prefix when renaming during porting","Rebuild after renames and confirm the warning disappears"],"tags":["adlc","naming-convention","thread-local","build","hotspot"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}