<!DOCTYPE html><html><head><title></title></head><body><div><br></div><div><br></div><div>On Wed, Nov 26, 2025, at 12:46 PM, Archie Cobbs wrote:</div><blockquote type="cite" id="qt" style=""><div class="qt-gmail_quote qt-gmail_quote_container"><div>Rhetorical question: if space really is so precious, then why not get rid of all the "Tag" fields and just use <span class="font" style="font-family:monospace;">instanceof</span> instead?</div><div><br></div><div>I'm assuming the original rationale for "Tag" fields was because instanceof was too slow? If so, is that still true? </div></div></blockquote><div><br></div><div>IIRC, while performance was an issue at one point in the past, it was not the reason to avoid instanceof.</div><div><br></div><div>The performance issue was that field/member access was seen to be faster than virtual method calls, and thus justified the field.</div><div><br></div><div>instanceof was deemed to be less reliable than tag usage. Not unreliable in the determini<i>s</i>tic sense, but because there were some design choices in javac and other similar tools where "poor use of interface inheritance" could mean that instanceof would return the wrong answer compared to examining the tag in some way. I remember fixing those issues in javac.</div><div><br></div><div>Also remember that in the original design, up through JDK 5, javac was "just" a closed batch mode compiler. java files in, class files out; that was it. That definitely affected design choices back then. It was only as we started opening up javac as a software component in JDK 6 onwards that some of those design choices (like end positions) became less than ideal, and were worked around to some degree, </div><div><br></div><div>-- Jon</div><div><br></div><div><br></div></body></html>