{"id":121084,"date":"2026-11-02T02:16:57","date_gmt":"2026-11-01T18:16:57","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/121084.html"},"modified":"2026-11-02T02:16:57","modified_gmt":"2026-11-01T18:16:57","slug":"java%e5%ad%97%e8%8a%82%e7%a0%81%e5%ad%a6%e4%b9%a0%e6%80%bb%e7%bb%93%ef%bc%9a%e5%ad%97%e8%8a%82%e7%a0%81%e5%a6%82%e4%bd%95%e5%8a%a0%e8%bd%bd%e3%80%81%e8%a7%a3%e6%9e%90%e5%92%8c%e6%89%a7%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/121084.html","title":{"rendered":"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c"},"content":{"rendered":"<\/p>\n<h4>Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3-\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c<\/h4>\n<ul>\n<li>\u524d\u8a00<\/li>\n<li>Class\u6587\u4ef6\u4e2d\u7684\u5b57\u8282\u7801\u5982\u4f55\u88abJVM\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c<\/li>\n<li>\n<ul>\n<li>\u4e00\u3001\u5b66\u4e60\u76ee\u6807<\/li>\n<li>\u4e8c\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u52a0\u8f7d&#xff1f;<\/li>\n<li>\n<ul>\n<li>2.1 Class \u6587\u4ef6\u7684\u57fa\u672c\u7ed3\u6784<\/li>\n<li>2.2 \u7c7b\u52a0\u8f7d\u5668\u5982\u4f55\u83b7\u53d6 Class \u6587\u4ef6&#xff1f;<\/li>\n<li>2.3 HotSpot \u7c7b\u52a0\u8f7d\u6e90\u7801\u5206\u6790<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u89e3\u6790&#xff1f;<\/li>\n<li>\n<ul>\n<li>3.1 ClassFileParser \u7684\u6838\u5fc3\u804c\u8d23<\/li>\n<li>3.2 \u5e38\u91cf\u6c60\u89e3\u6790\u6e90\u7801\u793a\u610f<\/li>\n<li>3.3 \u5b57\u8282\u7801\u89e3\u6790\u4e0e\u65b9\u6cd5 Code \u5c5e\u6027<\/li>\n<\/ul>\n<\/li>\n<li>\u56db\u3001JVM \u5982\u4f55\u9a8c\u8bc1\u3001\u51c6\u5907\u548c\u89e3\u6790 Class \u6587\u4ef6&#xff1f;<\/li>\n<li>\n<ul>\n<li>4.1 \u9a8c\u8bc1&#xff1a;Verification<\/li>\n<li>4.2 \u51c6\u5907&#xff1a;Preparation<\/li>\n<li>4.3 \u89e3\u6790&#xff1a;Resolution<\/li>\n<\/ul>\n<\/li>\n<li>\u4e94\u3001JVM \u89e3\u91ca\u5668\u5982\u4f55\u6267\u884c\u5b57\u8282\u7801&#xff1f;<\/li>\n<li>\n<ul>\n<li>5.1 Template Interpreter \u7684\u5de5\u4f5c\u539f\u7406<\/li>\n<li>5.2 TemplateTable \u6e90\u7801\u5206\u6790<\/li>\n<li>5.3 TemplateInterpreter \u6e90\u7801\u5206\u6790<\/li>\n<li>5.4 \u65b9\u6cd5\u6267\u884c\u5e27\u5982\u4f55\u5de5\u4f5c&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>\u516d\u3001JVM \u5982\u4f55\u901a\u8fc7 JIT \u5c06\u5b57\u8282\u7801\u7f16\u8bd1\u4e3a\u673a\u5668\u7801&#xff1f;<\/li>\n<li>\n<ul>\n<li>6.1 JIT \u7684\u57fa\u672c\u5de5\u4f5c\u6d41\u7a0b<\/li>\n<li>6.2 CompileBroker \u6e90\u7801\u5206\u6790<\/li>\n<li>6.3 C1 \u548c C2 \u7f16\u8bd1\u5668\u7684\u533a\u522b<\/li>\n<li>6.4 JIT \u5982\u4f55\u4f18\u5316\u5b57\u8282\u7801&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>\u4e03\u3001\u5b57\u8282\u7801\u6700\u7ec8\u5982\u4f55\u88ab CPU \u6267\u884c&#xff1f;<\/li>\n<li>\n<ul>\n<li>7.1 \u5b57\u8282\u7801\u4e0e\u673a\u5668\u7801\u7684\u533a\u522b<\/li>\n<li>7.2 \u89e3\u91ca\u5668\u548c JIT \u4e24\u6761\u6267\u884c\u8def\u5f84<\/li>\n<li>7.3 \u4e0d\u540c CPU \u67b6\u6784\u7684\u6267\u884c\u5dee\u5f02<\/li>\n<\/ul>\n<\/li>\n<li>\u516b\u3001\u901a\u8fc7 JVM \u53c2\u6570\u89c2\u5bdf\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\u8fc7\u7a0b<\/li>\n<li>\n<ul>\n<li>8.1 \u67e5\u770b Class \u6587\u4ef6\u7ed3\u6784<\/li>\n<li>8.2 \u89c2\u5bdf\u7c7b\u52a0\u8f7d\u8fc7\u7a0b<\/li>\n<li>8.3 \u89c2\u5bdf\u89e3\u91ca\u5668\u548c JIT \u7f16\u8bd1<\/li>\n<li>8.4 \u89c2\u5bdf JIT \u751f\u6210\u7684\u673a\u5668\u7801<\/li>\n<\/ul>\n<\/li>\n<li>\u4e5d\u3001OpenJDK \u6e90\u7801\u9605\u8bfb\u8def\u7ebf<\/li>\n<li>\u5341\u3001\u5efa\u8bae\u5f62\u6210\u7684\u5b66\u4e60\u6210\u679c<\/li>\n<li>\n<ul>\n<li>\u63a8\u8350\u8fdb\u4e00\u6b65\u8fdb\u884c\u7684\u5b9e\u9a8c<\/li>\n<\/ul>\n<\/li>\n<li>\u5341\u4e00\u3001\u6700\u7ec8\u5b66\u4e60\u603b\u7ed3&#xff1a;\u7cfb\u7edf\u5de5\u7a0b\u5e08\u5fc5\u987b\u638c\u63e1\u7684\u6838\u5fc3\u7ed3\u8bba<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>\u524d\u8a00<\/h2>\n<p>\u672c\u6587\u65e8\u5728\u8bb0\u5f55\u8fd1\u671f\u7814\u8bfbJava\u6e90\u7801\u7684\u5b66\u4e60\u5fc3\u5f97\u4e0e\u7591\u96be\u95ee\u9898\u3002\u7531\u4e8e\u4e2a\u4eba\u7406\u89e3\u6c34\u5e73\u6709\u9650&#xff0c;\u6587\u4e2d\u5185\u5bb9\u96be\u514d\u5b58\u5728\u758f\u6f0f&#xff0c;\u6073\u8bf7\u8bfb\u8005\u4e0d\u541d\u6307\u6b63\u3002<\/p>\n<h2>Class\u6587\u4ef6\u4e2d\u7684\u5b57\u8282\u7801\u5982\u4f55\u88abJVM\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c<\/h2>\n<h3>\u4e00\u3001\u5b66\u4e60\u76ee\u6807<\/h3>\n<p>\u672c\u6b21\u5b66\u4e60\u56f4\u7ed5 JVM \u6267\u884c\u5f15\u64ce\u5c55\u5f00&#xff0c;\u91cd\u70b9\u7406\u89e3 Class \u6587\u4ef6\u4ece\u8fdb\u5165 JVM \u5230\u6700\u7ec8\u88ab CPU \u6267\u884c\u7684\u5b8c\u6574\u8fc7\u7a0b\u3002<\/p>\n<p>\u4ece\u7cfb\u7edf\u5de5\u7a0b\u5e08\u89d2\u5ea6&#xff0c;\u4e0d\u80fd\u4ec5\u4ec5\u7406\u89e3 ClassLoader \u5982\u4f55\u52a0\u8f7d .class \u6587\u4ef6&#xff0c;\u8fd8\u9700\u8981\u6df1\u5165 HotSpot \u6e90\u7801&#xff0c;\u7406\u89e3&#xff1a;<\/p>\n<li>\n<p>Class \u6587\u4ef6\u5982\u4f55\u88ab\u7c7b\u52a0\u8f7d\u5668\u8bfb\u53d6\u5e76\u8f6c\u6362\u4e3a JVM \u5185\u90e8\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<\/li>\n<li>\n<p>JVM \u5982\u4f55\u89e3\u6790\u5e38\u91cf\u6c60\u3001\u5b57\u6bb5\u3001\u65b9\u6cd5\u548c Code \u5c5e\u6027\u3002<\/p>\n<\/li>\n<li>\n<p>JVM \u5982\u4f55\u9a8c\u8bc1\u5b57\u8282\u7801\u7684\u5408\u6cd5\u6027\u548c\u7c7b\u578b\u5b89\u5168\u3002<\/p>\n<\/li>\n<li>\n<p>JVM \u5982\u4f55\u5c06\u7b26\u53f7\u5f15\u7528\u89e3\u6790\u4e3a\u8fd0\u884c\u65f6\u53ef\u4ee5\u4f7f\u7528\u7684\u5f15\u7528\u3002<\/p>\n<\/li>\n<li>\n<p>\u89e3\u91ca\u5668\u5982\u4f55\u901a\u8fc7\u6a21\u677f\u5206\u6d3e\u673a\u5236\u6267\u884c\u5b57\u8282\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>JIT \u5982\u4f55\u5c06\u70ed\u70b9\u5b57\u8282\u7801\u7f16\u8bd1\u4e3a\u672c\u5730\u673a\u5668\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>CPU \u6700\u7ec8\u5982\u4f55\u6267\u884c JVM \u751f\u6210\u7684\u672c\u5730\u673a\u5668\u6307\u4ee4\u3002<\/p>\n<\/li>\n<p>\u672c\u6b21\u5b66\u4e60\u7684\u6838\u5fc3\u662f\u5efa\u7acb\u4ee5\u4e0b\u8ba4\u77e5&#xff1a; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101181656-6ae7821818862.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u6838\u5fc3\u7ed3\u8bba&#xff1a;Class \u6587\u4ef6\u4e2d\u7684\u5b57\u8282\u7801\u662f JVM \u7684\u6307\u4ee4&#xff0c;\u4e0d\u662f CPU \u7684\u539f\u751f\u6307\u4ee4\u3002JVM \u901a\u8fc7\u89e3\u91ca\u6267\u884c\u6216\u5373\u65f6\u7f16\u8bd1&#xff0c;\u5c06\u5b57\u8282\u7801\u843d\u5b9e\u4e3a\u5f53\u524d\u786c\u4ef6\u5e73\u53f0\u53ef\u4ee5\u6267\u884c\u7684\u673a\u5668\u6307\u4ee4\u3002<\/p>\n<h3>\u4e8c\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u52a0\u8f7d&#xff1f;<\/h3>\n<h4>2.1 Class \u6587\u4ef6\u7684\u57fa\u672c\u7ed3\u6784<\/h4>\n<p>Java \u6e90\u4ee3\u7801\u7ecf\u8fc7 javac \u7f16\u8bd1\u540e\u751f\u6210 .class \u6587\u4ef6\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>public class BytecodeDemo {<\/p>\n<p>    public static int add(int a, int b) {<br \/>\n        return a &#043; b;<br \/>\n    }<\/p>\n<p>    public static void main(String[] args) {<br \/>\n        int result &#061; add(10, 20);<br \/>\n        System.out.println(result);<br \/>\n    }<br \/>\n}<\/p>\n<p>\u7f16\u8bd1&#xff1a;<\/p>\n<p>javac BytecodeDemo.java<\/p>\n<p>\u751f\u6210&#xff1a;<\/p>\n<p>BytecodeDemo.class<\/p>\n<p>Class \u6587\u4ef6\u4e0d\u662f\u666e\u901a\u6587\u672c\u6587\u4ef6&#xff0c;\u800c\u662f\u4e00\u79cd\u6309\u7167 JVM \u89c4\u8303\u7ec4\u7ec7\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002<\/p>\n<p>\u4e3b\u8981\u7ed3\u6784\u5982\u4e0b&#xff1a;<\/p>\n<table>\n<tr>\u7ec4\u6210\u90e8\u5206\u804c\u8d23<\/tr>\n<tbody>\n<tr>\n<td>Magic<\/td>\n<td>Class \u6587\u4ef6\u6807\u8bc6&#xff0c;\u56fa\u5b9a\u4e3a 0xCAFEBABE<\/td>\n<\/tr>\n<tr>\n<td>Minor Version<\/td>\n<td>\u6b21\u7248\u672c\u53f7<\/td>\n<\/tr>\n<tr>\n<td>Major Version<\/td>\n<td>\u4e3b\u7248\u672c\u53f7<\/td>\n<\/tr>\n<tr>\n<td>Constant Pool<\/td>\n<td>\u4fdd\u5b58\u5e38\u91cf\u548c\u7b26\u53f7\u5f15\u7528<\/td>\n<\/tr>\n<tr>\n<td>Access Flags<\/td>\n<td>\u7c7b\u7684\u8bbf\u95ee\u6807\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>This Class<\/td>\n<td>\u5f53\u524d\u7c7b\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>Super Class<\/td>\n<td>\u7236\u7c7b\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>Interfaces<\/td>\n<td>\u63a5\u53e3\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>Fields<\/td>\n<td>\u5b57\u6bb5\u5b9a\u4e49<\/td>\n<\/tr>\n<tr>\n<td>Methods<\/td>\n<td>\u65b9\u6cd5\u5b9a\u4e49<\/td>\n<\/tr>\n<tr>\n<td>Attributes<\/td>\n<td>\u7c7b\u7ea7\u522b\u53ca\u5176\u4ed6\u5c5e\u6027<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5176\u4e2d&#xff0c;Methods \u4e2d\u7684\u65b9\u6cd5\u53ef\u80fd\u5305\u542b Code \u5c5e\u6027\u3002<\/p>\n<p>Code \u5c5e\u6027\u4fdd\u5b58&#xff1a;<\/p>\n<ul>\n<li>\n<p>max_stack&#xff1a;\u64cd\u4f5c\u6570\u6808\u6700\u5927\u6df1\u5ea6\u3002<\/p>\n<\/li>\n<li>\n<p>max_locals&#xff1a;\u5c40\u90e8\u53d8\u91cf\u8868\u6240\u9700\u69fd\u4f4d\u6570\u91cf\u3002<\/p>\n<\/li>\n<li>\n<p>code_length&#xff1a;\u5b57\u8282\u7801\u957f\u5ea6\u3002<\/p>\n<\/li>\n<li>\n<p>code[]&#xff1a;\u5b57\u8282\u7801\u6307\u4ee4\u5e8f\u5217\u3002<\/p>\n<\/li>\n<li>\n<p>exception_table&#xff1a;\u5f02\u5e38\u5904\u7406\u8868\u3002<\/p>\n<\/li>\n<li>\n<p>attributes&#xff1a;\u65b9\u6cd5\u76f8\u5173\u7684\u9644\u52a0\u5c5e\u6027\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5b66\u4e60\u91cd\u70b9&#xff1a;Class \u6587\u4ef6\u4fdd\u5b58\u7684\u662f JVM \u53ef\u4ee5\u8bc6\u522b\u7684\u7a0b\u5e8f\u7ed3\u6784\u548c\u6307\u4ee4&#xff0c;\u800c\u4e0d\u662f Java \u6e90\u4ee3\u7801\u7684\u7b80\u5355\u590d\u5236\u3002<\/p>\n<h4>2.2 \u7c7b\u52a0\u8f7d\u5668\u5982\u4f55\u83b7\u53d6 Class \u6587\u4ef6&#xff1f;<\/h4>\n<p>Java \u63d0\u4f9b\u4e86\u7c7b\u52a0\u8f7d\u5668\u4f53\u7cfb&#xff1a;<\/p>\n<table>\n<tr>\u7c7b\u52a0\u8f7d\u5668\u804c\u8d23<\/tr>\n<tbody>\n<tr>\n<td>Bootstrap ClassLoader<\/td>\n<td>\u52a0\u8f7d\u6838\u5fc3\u8fd0\u884c\u65f6\u7c7b<\/td>\n<\/tr>\n<tr>\n<td>Platform ClassLoader<\/td>\n<td>\u52a0\u8f7d\u5e73\u53f0\u7c7b\u5e93<\/td>\n<\/tr>\n<tr>\n<td>Application ClassLoader<\/td>\n<td>\u52a0\u8f7d\u5e94\u7528\u7a0b\u5e8f\u7c7b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u901a\u8fc7 Java \u4ee3\u7801\u89c2\u5bdf&#xff1a;<\/p>\n<p>public class ClassLoaderDemo {<\/p>\n<p>    public static void main(String[] args) {<\/p>\n<p>        \/\/ \u83b7\u53d6\u5f53\u524d\u7c7b\u7684 Class \u5bf9\u8c61<br \/>\n        Class&lt;?&gt; clazz &#061; BytecodeDemo.class;<\/p>\n<p>        \/\/ \u83b7\u53d6\u5b9a\u4e49\u5f53\u524d\u7c7b\u7684\u7c7b\u52a0\u8f7d\u5668<br \/>\n        ClassLoader loader &#061; clazz.getClassLoader();<\/p>\n<p>        \/\/ \u8f93\u51fa\u7c7b\u52a0\u8f7d\u5668<br \/>\n        System.out.println(loader);<\/p>\n<p>        \/\/ \u8f93\u51fa\u7236\u7c7b\u52a0\u8f7d\u5668<br \/>\n        System.out.println(loader.getParent());<br \/>\n    }<br \/>\n}<\/p>\n<p>\u9700\u8981\u7406\u89e3\u4e24\u4e2a\u6982\u5ff5&#xff1a;<\/p>\n<ul>\n<li>\n<p>ClassLoader \u8d1f\u8d23\u83b7\u53d6\u7c7b\u7684\u4e8c\u8fdb\u5236\u6570\u636e\u3002<\/p>\n<\/li>\n<li>\n<p>JVM \u8d1f\u8d23\u5c06\u7c7b\u6570\u636e\u89e3\u6790\u4e3a\u8fd0\u884c\u65f6\u7c7b\u7ed3\u6784\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u7c7b\u7684\u8eab\u4efd\u7531\u7c7b\u52a0\u8f7d\u5668\u548c\u7c7b\u7684\u4e8c\u8fdb\u5236\u540d\u79f0\u5171\u540c\u786e\u5b9a\u3002\u56e0\u6b64&#xff0c;\u4e24\u4e2a\u4e0d\u540c\u7c7b\u52a0\u8f7d\u5668\u52a0\u8f7d\u7684\u540c\u540d\u7c7b&#xff0c;\u53ef\u4ee5\u662f\u4e24\u4e2a\u5b8c\u5168\u4e0d\u540c\u7684 JVM \u7c7b\u578b\u3002<\/p>\n<h4>2.3 HotSpot \u7c7b\u52a0\u8f7d\u6e90\u7801\u5206\u6790<\/h4>\n<p>\u91cd\u70b9\u6e90\u7801&#xff1a;<\/p>\n<p>src\/hotspot\/share\/classfile\/<br \/>\n    classLoader.cpp<br \/>\n    classLoader.hpp<br \/>\n    systemDictionary.cpp<br \/>\n    classFileParser.cpp<\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p>ClassLoader&#xff1a;\u8d1f\u8d23\u7c7b\u6587\u4ef6\u67e5\u627e\u548c\u8bfb\u53d6\u3002<\/p>\n<\/li>\n<li>\n<p>SystemDictionary&#xff1a;\u53c2\u4e0e\u7c7b\u52a0\u8f7d\u3001\u7c7b\u67e5\u627e\u53ca\u52a0\u8f7d\u5668\u7ea6\u675f\u7ba1\u7406\u3002<\/p>\n<\/li>\n<li>\n<p>ClassFileParser&#xff1a;\u8d1f\u8d23\u89e3\u6790 Class \u6587\u4ef6\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4ece\u7cfb\u7edf\u5de5\u7a0b\u5e08\u89d2\u5ea6&#xff0c;\u9700\u8981\u533a\u5206 Java \u5c42\u7684\u7c7b\u52a0\u8f7d\u5668\u63a5\u53e3\u548c HotSpot \u5185\u90e8\u7684\u7c7b\u52a0\u8f7d\u5b9e\u73b0\u3002\u4e24\u8005\u534f\u540c\u5de5\u4f5c&#xff0c;\u4f46\u4e0d\u662f\u540c\u4e00\u4e2a\u7ec4\u4ef6\u3002<\/p>\n<h3>\u4e09\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u89e3\u6790&#xff1f;<\/h3>\n<p>Class \u6587\u4ef6\u52a0\u8f7d\u540e&#xff0c;HotSpot \u9700\u8981\u89e3\u6790\u5176\u4e8c\u8fdb\u5236\u7ed3\u6784&#xff0c;\u5efa\u7acb JVM \u5185\u90e8\u7684\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<h4>3.1 ClassFileParser \u7684\u6838\u5fc3\u804c\u8d23<\/h4>\n<p>\u6e90\u7801\u4f4d\u7f6e&#xff1a;<\/p>\n<p>src\/hotspot\/share\/classfile\/classFileParser.cpp<\/p>\n<p>\u4e3b\u8981\u5de5\u4f5c&#xff1a;<\/p>\n<li>\n<p>\u8bfb\u53d6 Class \u6587\u4ef6\u5934\u3002<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5 Class \u6587\u4ef6\u7248\u672c\u3002<\/p>\n<\/li>\n<li>\n<p>\u89e3\u6790\u5e38\u91cf\u6c60\u3002<\/p>\n<\/li>\n<li>\n<p>\u89e3\u6790\u7c7b\u548c\u7236\u7c7b\u4fe1\u606f\u3002<\/p>\n<\/li>\n<li>\n<p>\u89e3\u6790\u5b57\u6bb5\u548c\u65b9\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>\u89e3\u6790 Code \u5c5e\u6027\u3002<\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa JVM \u5185\u90e8\u7c7b\u5143\u6570\u636e\u3002<\/p>\n<\/li>\n<p>\u4f8b\u5982&#xff0c;\u5e38\u91cf\u6c60\u4e2d\u53ef\u80fd\u5305\u542b&#xff1a;<\/p>\n<p>CONSTANT_Class<br \/>\nCONSTANT_Fieldref<br \/>\nCONSTANT_Methodref<br \/>\nCONSTANT_InterfaceMethodref<br \/>\nCONSTANT_String<br \/>\nCONSTANT_NameAndType<\/p>\n<p>\u8fd9\u4e9b\u5e38\u91cf\u63cf\u8ff0\u4e86\u7c7b\u3001\u5b57\u6bb5\u3001\u65b9\u6cd5\u548c\u5b57\u7b26\u4e32\u7b49\u4fe1\u606f\u3002<\/p>\n<h4>3.2 \u5e38\u91cf\u6c60\u89e3\u6790\u6e90\u7801\u793a\u610f<\/h4>\n<p>\/\/ \u5bf9\u5e94 HotSpot&#xff1a;<br \/>\n\/\/ src\/hotspot\/share\/classfile\/classFileParser.cpp<br \/>\n\/\/<br \/>\n\/\/ \u4e0b\u9762\u662f\u5e38\u91cf\u6c60\u89e3\u6790\u903b\u8f91\u7684\u6559\u5b66\u793a\u610f&#xff0c;<br \/>\n\/\/ \u4e0d\u662f\u5b8c\u6574\u7684 OpenJDK \u539f\u59cb\u5b9e\u73b0\u3002<\/p>\n<p>for (int index &#061; 1; index &lt; length; index&#043;&#043;) {<\/p>\n<p>    \/\/ \u8bfb\u53d6\u5f53\u524d\u5e38\u91cf\u6c60\u6761\u76ee\u7684\u7c7b\u578b\u6807\u8bb0<br \/>\n    const u1 tag &#061; cfs-&gt;get_u1_fast();<\/p>\n<p>    switch (tag) {<\/p>\n<p>        case JVM_CONSTANT_Class: {<\/p>\n<p>            \/\/ \u8bfb\u53d6\u7c7b\u540d\u5bf9\u5e94\u7684\u5e38\u91cf\u6c60\u7d22\u5f15<br \/>\n            const u2 name_index &#061; cfs-&gt;get_u2_fast();<\/p>\n<p>            \/\/ \u5c06 Class \u5e38\u91cf\u8bb0\u5f55\u5230 JVM \u5185\u90e8\u5e38\u91cf\u6c60<br \/>\n            cp-&gt;klass_index_at_put(index, name_index);<\/p>\n<p>            break;<br \/>\n        }<\/p>\n<p>        case JVM_CONSTANT_Fieldref: {<\/p>\n<p>            \/\/ \u83b7\u53d6\u5b57\u6bb5\u6240\u5c5e\u7c7b\u7684\u7d22\u5f15<br \/>\n            const u2 class_index &#061; cfs-&gt;get_u2_fast();<\/p>\n<p>            \/\/ \u83b7\u53d6\u5b57\u6bb5\u540d\u79f0\u548c\u63cf\u8ff0\u7b26\u7684\u7d22\u5f15<br \/>\n            const u2 name_and_type_index &#061; cfs-&gt;get_u2_fast();<\/p>\n<p>            \/\/ \u4fdd\u5b58\u5b57\u6bb5\u7b26\u53f7\u5f15\u7528<br \/>\n            cp-&gt;field_at_put(<br \/>\n                index,<br \/>\n                class_index,<br \/>\n                name_and_type_index<br \/>\n            );<\/p>\n<p>            break;<br \/>\n        }<\/p>\n<p>        case JVM_CONSTANT_Methodref: {<\/p>\n<p>            \/\/ \u83b7\u53d6\u65b9\u6cd5\u6240\u5c5e\u7c7b\u7684\u7d22\u5f15<br \/>\n            const u2 class_index &#061; cfs-&gt;get_u2_fast();<\/p>\n<p>            \/\/ \u83b7\u53d6\u65b9\u6cd5\u540d\u79f0\u548c\u63cf\u8ff0\u7b26\u7684\u7d22\u5f15<br \/>\n            const u2 name_and_type_index &#061; cfs-&gt;get_u2_fast();<\/p>\n<p>            \/\/ \u4fdd\u5b58\u65b9\u6cd5\u7b26\u53f7\u5f15\u7528<br \/>\n            cp-&gt;method_at_put(<br \/>\n                index,<br \/>\n                class_index,<br \/>\n                name_and_type_index<br \/>\n            );<\/p>\n<p>            break;<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8bf4\u660e&#xff1a;\u4ee5\u4e0a\u4ee3\u7801\u7528\u4e8e\u89e3\u91ca\u89e3\u6790\u6d41\u7a0b&#xff0c;\u7701\u7565\u4e86\u5176\u4ed6\u5e38\u91cf\u7c7b\u578b\u3001\u8fb9\u754c\u68c0\u67e5\u548c\u5f02\u5e38\u5904\u7406\u3002\u9605\u8bfb\u5177\u4f53 JDK \u7248\u672c\u65f6&#xff0c;\u5e94\u4ee5\u5bf9\u5e94\u7248\u672c\u7684 classFileParser.cpp \u4e3a\u51c6\u3002<\/p>\n<p>\u5b66\u4e60\u603b\u7ed3&#xff1a;<\/p>\n<p>\u5e38\u91cf\u6c60\u4e0d\u662f\u7b80\u5355\u7684\u5b57\u7b26\u4e32\u8868&#xff0c;\u800c\u662f JVM \u8fdb\u884c\u7c7b\u578b\u8bc6\u522b\u3001\u5b57\u6bb5\u5b9a\u4f4d\u3001\u65b9\u6cd5\u8c03\u7528\u548c\u52a8\u6001\u94fe\u63a5\u7684\u57fa\u7840\u3002<\/p>\n<h4>3.3 \u5b57\u8282\u7801\u89e3\u6790\u4e0e\u65b9\u6cd5 Code \u5c5e\u6027<\/h4>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>public class AddDemo {<\/p>\n<p>    public static int add(int a, int b) {<br \/>\n        \/\/ javac \u5c06\u6574\u6570\u52a0\u6cd5\u8f6c\u6362\u4e3a JVM \u5b57\u8282\u7801<br \/>\n        return a &#043; b;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u6267\u884c&#xff1a;<\/p>\n<p>javap -c -v AddDemo<\/p>\n<p>\u53ef\u4ee5\u770b\u5230\u7c7b\u4f3c\u7ed3\u679c&#xff1a;<\/p>\n<p>public static int add(int, int);<br \/>\n  descriptor: (II)I<br \/>\n  Code:<br \/>\n    stack&#061;2, locals&#061;2, args_size&#061;2<br \/>\n       0: iload_0<br \/>\n       1: iload_1<br \/>\n       2: iadd<br \/>\n       3: ireturn<\/p>\n<p>\u9010\u6761\u5206\u6790&#xff1a;<\/p>\n<table>\n<tr>\u6307\u4ee4\u542b\u4e49\u6267\u884c\u6548\u679c<\/tr>\n<tbody>\n<tr>\n<td>iload_0<\/td>\n<td>\u52a0\u8f7d\u5c40\u90e8\u53d8\u91cf 0<\/td>\n<td>\u5c06 a \u538b\u5165\u64cd\u4f5c\u6570\u6808<\/td>\n<\/tr>\n<tr>\n<td>iload_1<\/td>\n<td>\u52a0\u8f7d\u5c40\u90e8\u53d8\u91cf 1<\/td>\n<td>\u5c06 b \u538b\u5165\u64cd\u4f5c\u6570\u6808<\/td>\n<\/tr>\n<tr>\n<td>iadd<\/td>\n<td>\u6574\u6570\u52a0\u6cd5<\/td>\n<td>\u5f39\u51fa\u4e24\u4e2a\u6574\u6570&#xff0c;\u8ba1\u7b97\u540e\u5c06\u7ed3\u679c\u538b\u6808<\/td>\n<\/tr>\n<tr>\n<td>ireturn<\/td>\n<td>\u6574\u6570\u8fd4\u56de<\/td>\n<td>\u5c06\u8ba1\u7b97\u7ed3\u679c\u8fd4\u56de\u8c03\u7528\u8005<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982&#xff0c;\u8c03\u7528 add(10, 20)&#xff1a; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101181656-6ae782184995d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fd9\u91cc\u8981\u7279\u522b\u7406\u89e3&#xff1a;<\/p>\n<ul>\n<li>\n<p>Code \u5c5e\u6027\u4fdd\u5b58\u65b9\u6cd5\u7684\u5b57\u8282\u7801\u6307\u4ee4\u5e8f\u5217\u3002<\/p>\n<\/li>\n<li>\n<p>max_stack \u63cf\u8ff0\u64cd\u4f5c\u6570\u6808\u6240\u9700\u7684\u6700\u5927\u6df1\u5ea6\u3002<\/p>\n<\/li>\n<li>\n<p>max_locals \u63cf\u8ff0\u5c40\u90e8\u53d8\u91cf\u8868\u6240\u9700\u7684\u69fd\u4f4d\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>descriptor \u63cf\u8ff0\u65b9\u6cd5\u53c2\u6570\u548c\u8fd4\u56de\u503c\u7c7b\u578b\u3002<\/p>\n<\/li>\n<\/ul>\n<p>HotSpot \u89e3\u6790\u5668\u8d1f\u8d23\u89e3\u6790\u548c\u4fdd\u5b58\u8fd9\u4e9b\u4fe1\u606f&#xff0c;\u800c\u5b57\u8282\u7801\u9a8c\u8bc1\u5668\u8d1f\u8d23\u8fdb\u4e00\u6b65\u68c0\u67e5\u6307\u4ee4\u5e8f\u5217\u662f\u5426\u5408\u6cd5\u3002<\/p>\n<p>\u5b66\u4e60\u603b\u7ed3&#xff1a;\u5b57\u8282\u7801\u662f JVM \u7684\u62bd\u8c61\u6307\u4ee4&#xff0c;\u64cd\u4f5c\u6570\u6808\u548c\u5c40\u90e8\u53d8\u91cf\u8868\u662f\u5b57\u8282\u7801\u6267\u884c\u7684\u57fa\u7840\u73af\u5883\u3002<\/p>\n<h3>\u56db\u3001JVM \u5982\u4f55\u9a8c\u8bc1\u3001\u51c6\u5907\u548c\u89e3\u6790 Class \u6587\u4ef6&#xff1f;<\/h3>\n<p>Class \u6587\u4ef6\u88ab\u89e3\u6790\u4e4b\u540e&#xff0c;\u8fd8\u9700\u8981\u7ecf\u8fc7\u94fe\u63a5\u8fc7\u7a0b\u3002<\/p>\n<p>\u6839\u636e JVMS \u7b2c 5 \u7ae0&#xff0c;\u7c7b\u7684\u94fe\u63a5\u4e3b\u8981\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\n<p>Verification&#xff08;\u9a8c\u8bc1&#xff09;<\/p>\n<\/li>\n<li>\n<p>Preparation&#xff08;\u51c6\u5907&#xff09;<\/p>\n<\/li>\n<li>\n<p>Resolution&#xff08;\u89e3\u6790&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h4>4.1 \u9a8c\u8bc1&#xff1a;Verification<\/h4>\n<p>\u9a8c\u8bc1\u7684\u76ee\u7684\u662f\u786e\u4fdd Class \u6587\u4ef6\u7b26\u5408 JVM \u89c4\u8303&#xff0c;\u5e76\u4e14\u5b57\u8282\u7801\u4e0d\u4f1a\u7834\u574f JVM \u8fd0\u884c\u65f6\u7684\u7c7b\u578b\u5b89\u5168\u7ea6\u675f\u3002<\/p>\n<p>\u4e3b\u8981\u5305\u62ec\u56db\u4e2a\u65b9\u9762&#xff1a;<\/p>\n<table>\n<tr>\u9a8c\u8bc1\u7c7b\u578b\u68c0\u67e5\u5185\u5bb9<\/tr>\n<tbody>\n<tr>\n<td>\u6587\u4ef6\u683c\u5f0f\u9a8c\u8bc1<\/td>\n<td>Magic\u3001\u7248\u672c\u3001\u5e38\u91cf\u6c60\u7ed3\u6784\u662f\u5426\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>\u5143\u6570\u636e\u9a8c\u8bc1<\/td>\n<td>\u7c7b\u7ee7\u627f\u5173\u7cfb\u3001\u63a5\u53e3\u5173\u7cfb\u662f\u5426\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>\u5b57\u8282\u7801\u9a8c\u8bc1<\/td>\n<td>\u64cd\u4f5c\u6570\u6808\u3001\u5c40\u90e8\u53d8\u91cf\u7c7b\u578b\u3001\u63a7\u5236\u6d41\u662f\u5426\u5408\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>\u7b26\u53f7\u5f15\u7528\u9a8c\u8bc1<\/td>\n<td>\u7c7b\u3001\u5b57\u6bb5\u3001\u65b9\u6cd5\u7684\u8bbf\u95ee\u662f\u5426\u5408\u6cd5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>HotSpot \u6e90\u7801&#xff1a;<\/p>\n<p>src\/hotspot\/share\/classfile\/verifier.cpp<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>public class VerifyDemo {<\/p>\n<p>    public static int calculate(int a, int b) {<\/p>\n<p>        \/\/ \u4e24\u4e2a int \u7c7b\u578b\u6570\u636e\u5165\u6808<br \/>\n        int result &#061; a &#043; b;<\/p>\n<p>        \/\/ \u8fd4\u56de\u503c\u7c7b\u578b\u5fc5\u987b\u7b26\u5408\u65b9\u6cd5\u63cf\u8ff0\u7b26<br \/>\n        return result;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5b57\u8282\u7801\u9a8c\u8bc1\u5668\u9700\u8981\u68c0\u67e5&#xff1a;<\/p>\n<li>\n<p>\u5c40\u90e8\u53d8\u91cf\u8bbf\u95ee\u662f\u5426\u7b26\u5408\u7c7b\u578b\u8981\u6c42\u3002<\/p>\n<\/li>\n<li>\n<p>iadd \u4e24\u4fa7\u662f\u5426\u4e3a\u5408\u6cd5\u7684\u6574\u6570\u64cd\u4f5c\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u540c\u63a7\u5236\u6d41\u5206\u652f\u5408\u5e76\u65f6&#xff0c;\u64cd\u4f5c\u6570\u6808\u72b6\u6001\u662f\u5426\u517c\u5bb9\u3002<\/p>\n<\/li>\n<li>\n<p>\u65b9\u6cd5\u8fd4\u56de\u6307\u4ee4\u662f\u5426\u7b26\u5408\u8fd4\u56de\u7c7b\u578b\u8981\u6c42\u3002<\/p>\n<\/li>\n<li>\n<p>\u64cd\u4f5c\u6570\u6808\u6df1\u5ea6\u662f\u5426\u8d85\u51fa\u65b9\u6cd5\u58f0\u660e\u7684\u9650\u5236\u3002<\/p>\n<\/li>\n<p>\u5176\u4e2d\u4e00\u4e2a\u91cd\u8981\u673a\u5236\u662f StackMapTable\u3002<\/p>\n<p>StackMapTable \u4fdd\u5b58\u9a8c\u8bc1\u6240\u9700\u7684\u7c7b\u578b\u72b6\u6001\u4fe1\u606f&#xff0c;\u53ef\u4ee5\u5e2e\u52a9 JVM \u9a8c\u8bc1\u63a7\u5236\u6d41\u4e2d\u7684\u5c40\u90e8\u53d8\u91cf\u548c\u64cd\u4f5c\u6570\u6808\u7c7b\u578b\u3002<\/p>\n<p>\u7cfb\u7edf\u5de5\u7a0b\u5e08\u5b66\u4e60\u91cd\u70b9&#xff1a;<\/p>\n<p>\u5b57\u8282\u7801\u9a8c\u8bc1\u4e0d\u4ec5\u662f\u68c0\u67e5\u6307\u4ee4\u662f\u5426\u5408\u6cd5&#xff0c;\u8fd8\u6d89\u53ca\u63a7\u5236\u6d41\u5206\u6790\u548c\u6570\u636e\u6d41\u7c7b\u578b\u5206\u6790\u3002<\/p>\n<h4>4.2 \u51c6\u5907&#xff1a;Preparation<\/h4>\n<p>\u51c6\u5907\u9636\u6bb5\u4e3b\u8981\u4e3a\u7c7b\u7684\u9759\u6001\u5b57\u6bb5\u5206\u914d\u5b58\u50a8\u7a7a\u95f4&#xff0c;\u5e76\u8bbe\u7f6e\u9ed8\u8ba4\u521d\u59cb\u503c\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>public class StaticDemo {<\/p>\n<p>    \/\/ \u666e\u901a\u9759\u6001\u53d8\u91cf<br \/>\n    static int count &#061; 100;<\/p>\n<p>    \/\/ \u7f16\u8bd1\u671f\u5e38\u91cf<br \/>\n    static final int MAX &#061; 200;<\/p>\n<p>    static final String NAME &#061; &#034;JVM&#034;;<br \/>\n}<\/p>\n<p>\u5bf9\u4e8e\u666e\u901a\u9759\u6001\u53d8\u91cf&#xff1a;<\/p>\n<p>\u51c6\u5907\u9636\u6bb5&#xff1a;<\/p>\n<p>count &#061; 0<\/p>\n<p>\u540e\u7eed\u7c7b\u521d\u59cb\u5316\u9636\u6bb5\u6267\u884c &lt;clinit&gt;()&#xff0c;\u5b8c\u6210&#xff1a;<\/p>\n<p>count &#061; 100<\/p>\n<p>\u9700\u8981\u6ce8\u610f&#xff1a;<\/p>\n<ul>\n<li>\n<p>static final \u7f16\u8bd1\u671f\u5e38\u91cf\u53ef\u80fd\u5728\u51c6\u5907\u9636\u6bb5\u5c31\u5177\u6709\u5176 ConstantValue \u6307\u5b9a\u7684\u503c\u3002<\/p>\n<\/li>\n<li>\n<p>\u666e\u901a\u9759\u6001\u5b57\u6bb5\u901a\u5e38\u5728\u51c6\u5907\u9636\u6bb5\u83b7\u5f97\u9ed8\u8ba4\u503c\u3002<\/p>\n<\/li>\n<li>\n<p>\u9759\u6001\u5b57\u6bb5\u7684\u5b9e\u9645\u5b58\u50a8\u5b9e\u73b0\u4e0e HotSpot \u7248\u672c\u3001\u5b57\u6bb5\u7c7b\u578b\u53ca\u8fd0\u884c\u65f6\u8868\u793a\u6709\u5173\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>4.3 \u89e3\u6790&#xff1a;Resolution<\/h4>\n<p>\u89e3\u6790\u662f\u5c06 Class \u6587\u4ef6\u4e2d\u7684\u7b26\u53f7\u5f15\u7528\u8f6c\u6362\u4e3a JVM \u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7684\u8fd0\u884c\u65f6\u5f15\u7528\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>public class User {<\/p>\n<p>    public void say() {<br \/>\n        System.out.println(&#034;Hello JVM&#034;);<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8c03\u7528&#xff1a;<\/p>\n<p>User user &#061; new User();<\/p>\n<p>\/\/ invokevirtual \u5bf9\u5e94\u7684\u865a\u65b9\u6cd5\u8c03\u7528<br \/>\nuser.say();<\/p>\n<p>Class \u6587\u4ef6\u5e38\u91cf\u6c60\u4e2d\u4f1a\u8bb0\u5f55\u7c7b\u4f3c\u4ee5\u4e0b\u4fe1\u606f&#xff1a;<\/p>\n<p>CONSTANT_Class:<br \/>\n    User<\/p>\n<p>CONSTANT_Methodref:<br \/>\n    User.say:()V<\/p>\n<p>\u8fd9\u4e9b\u4fe1\u606f\u662f\u7b26\u53f7\u5f15\u7528&#xff0c;\u4e0d\u662f CPU \u5185\u5b58\u5730\u5740\u3002<\/p>\n<p>JVM \u5728\u89e3\u6790\u65f6\u9700\u8981\u5b8c\u6210&#xff1a;<\/p>\n<li>\n<p>\u786e\u5b9a\u76ee\u6807\u7c7b\u3002<\/p>\n<\/li>\n<li>\n<p>\u6839\u636e\u65b9\u6cd5\u540d\u79f0\u67e5\u627e\u65b9\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>\u6839\u636e\u65b9\u6cd5\u63cf\u8ff0\u7b26\u5339\u914d\u65b9\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u65b9\u6cd5\u8c03\u7528\u7c7b\u578b\u662f\u5426\u5408\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>\u5efa\u7acb\u540e\u7eed\u8c03\u7528\u9700\u8981\u7684\u8fd0\u884c\u65f6\u4fe1\u606f\u3002<\/p>\n<\/li>\n<p>HotSpot \u6e90\u7801&#xff1a;<\/p>\n<p>src\/hotspot\/share\/interpreter\/linkResolver.cpp<\/p>\n<p>\u5176\u65b9\u6cd5\u89e3\u6790\u8fc7\u7a0b\u53ef\u4ee5\u7b80\u5316\u4e3a&#xff1a;<\/p>\n<p>\/\/ \u5bf9\u5e94 HotSpot LinkResolver \u7684\u65b9\u6cd5\u89e3\u6790\u601d\u60f3<br \/>\n\/\/ \u4ec5\u4e3a\u6559\u5b66\u793a\u610f&#xff0c;\u4e0d\u662f\u5b8c\u6574\u6e90\u7801\u3002<\/p>\n<p>\/\/ \u4ece\u5e38\u91cf\u6c60\u89e3\u6790\u76ee\u6807\u7c7b<br \/>\nKlass* resolved_klass &#061; resolve_target_klass(&#8230;);<\/p>\n<p>\/\/ \u4ece\u5e38\u91cf\u6c60\u83b7\u53d6\u65b9\u6cd5\u540d\u79f0<br \/>\nSymbol* method_name &#061; pool-&gt;name_ref_at(index);<\/p>\n<p>\/\/ \u83b7\u53d6\u65b9\u6cd5\u63cf\u8ff0\u7b26<br \/>\nSymbol* signature &#061; pool-&gt;signature_ref_at(index);<\/p>\n<p>\/\/ \u6839\u636e\u5b57\u8282\u7801\u6307\u4ee4\u9009\u62e9\u89e3\u6790\u903b\u8f91<br \/>\nif (code &#061;&#061; Bytecodes::_invokeinterface) {<\/p>\n<p>    \/\/ \u89e3\u6790\u63a5\u53e3\u65b9\u6cd5\u5f15\u7528<br \/>\n    resolve_interface_method(&#8230;);<\/p>\n<p>} else {<\/p>\n<p>    \/\/ \u89e3\u6790\u7c7b\u65b9\u6cd5\u5f15\u7528<br \/>\n    resolve_method(&#8230;);<br \/>\n}<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<table>\n<tr>\u5b57\u8282\u7801\u89e3\u6790\u548c\u8c03\u7528\u7279\u70b9<\/tr>\n<tbody>\n<tr>\n<td>invokestatic<\/td>\n<td>\u9759\u6001\u65b9\u6cd5\u8c03\u7528<\/td>\n<\/tr>\n<tr>\n<td>invokespecial<\/td>\n<td>\u6784\u9020\u65b9\u6cd5\u3001\u79c1\u6709\u65b9\u6cd5\u53ca\u7279\u5b9a\u7236\u7c7b\u8c03\u7528<\/td>\n<\/tr>\n<tr>\n<td>invokevirtual<\/td>\n<td>\u666e\u901a\u5b9e\u4f8b\u865a\u65b9\u6cd5\u8c03\u7528<\/td>\n<\/tr>\n<tr>\n<td>invokeinterface<\/td>\n<td>\u63a5\u53e3\u65b9\u6cd5\u8c03\u7528<\/td>\n<\/tr>\n<tr>\n<td>invokedynamic<\/td>\n<td>\u901a\u8fc7\u52a8\u6001\u8c03\u7528\u70b9\u673a\u5236\u94fe\u63a5\u76ee\u6807<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7279\u522b\u6ce8\u610f&#xff1a;\u65b9\u6cd5\u7b26\u53f7\u5f15\u7528\u89e3\u6790\u548c\u8fd0\u884c\u65f6\u52a8\u6001\u5206\u6d3e\u662f\u4e24\u4e2a\u4e0d\u540c\u7684\u6982\u5ff5\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>class Parent {<\/p>\n<p>    void print() {<br \/>\n        System.out.println(&#034;Parent&#034;);<br \/>\n    }<br \/>\n}<\/p>\n<p>class Child extends Parent {<\/p>\n<p>    &#064;Override<br \/>\n    void print() {<br \/>\n        System.out.println(&#034;Child&#034;);<br \/>\n    }<br \/>\n}<\/p>\n<p>public class DispatchDemo {<\/p>\n<p>    public static void main(String[] args) {<\/p>\n<p>        \/\/ \u7f16\u8bd1\u671f\u5f15\u7528\u7c7b\u578b\u662f Parent<br \/>\n        \/\/ \u5b9e\u9645\u5bf9\u8c61\u7c7b\u578b\u662f Child<br \/>\n        Parent obj &#061; new Child();<\/p>\n<p>        \/\/ invokevirtual \u6839\u636e\u5b9e\u9645\u5bf9\u8c61\u7c7b\u578b\u8fdb\u884c\u52a8\u6001\u5206\u6d3e<br \/>\n        obj.print();<br \/>\n    }<br \/>\n}<\/p>\n<p>\u6700\u7ec8\u8f93\u51fa&#xff1a;<\/p>\n<p>Child<\/p>\n<p>\u5b66\u4e60\u603b\u7ed3&#xff1a;<\/p>\n<p>\u89e3\u6790\u8d1f\u8d23\u5efa\u7acb\u7b26\u53f7\u5f15\u7528\u4e0e\u8fd0\u884c\u65f6\u5b9e\u4f53\u4e4b\u95f4\u7684\u8054\u7cfb&#xff1b;\u52a8\u6001\u5206\u6d3e\u8d1f\u8d23\u6839\u636e\u5b9e\u9645\u5bf9\u8c61\u7c7b\u578b\u786e\u5b9a\u9700\u8981\u6267\u884c\u7684\u65b9\u6cd5\u3002\u4e24\u8005\u4e0d\u80fd\u6df7\u4e3a\u4e00\u8c08\u3002<\/p>\n<p>\u6b64\u5916&#xff0c;\u89e3\u6790\u53ef\u4ee5\u91c7\u7528\u5ef6\u8fdf\u65b9\u5f0f&#xff0c;\u5728\u5b9e\u9645\u4f7f\u7528\u7b26\u53f7\u5f15\u7528\u65f6\u624d\u5b8c\u6210&#xff0c;\u56e0\u6b64\u4e0d\u80fd\u7b80\u5355\u7406\u89e3\u4e3a\u6240\u6709\u7b26\u53f7\u5f15\u7528\u90fd\u5728\u7c7b\u52a0\u8f7d\u65f6\u4e00\u6b21\u6027\u89e3\u6790\u5b8c\u6bd5\u3002<\/p>\n<h3>\u4e94\u3001JVM \u89e3\u91ca\u5668\u5982\u4f55\u6267\u884c\u5b57\u8282\u7801&#xff1f;<\/h3>\n<p>\u5b8c\u6210\u7c7b\u52a0\u8f7d\u548c\u5fc5\u8981\u7684\u94fe\u63a5\u540e&#xff0c;JVM \u5c31\u53ef\u4ee5\u6267\u884c\u65b9\u6cd5\u3002<\/p>\n<p>HotSpot \u89e3\u91ca\u5668\u7684\u91cd\u70b9\u6e90\u7801&#xff1a;<\/p>\n<p>src\/hotspot\/share\/interpreter\/<br \/>\n    templateInterpreter.cpp<br \/>\n    templateInterpreter.hpp<br \/>\n    templateTable.cpp<br \/>\n    templateTable.hpp<br \/>\n    interpreterRuntime.cpp<\/p>\n<h4>5.1 Template Interpreter \u7684\u5de5\u4f5c\u539f\u7406<\/h4>\n<p>HotSpot \u4f7f\u7528\u6a21\u677f\u89e3\u91ca\u5668&#xff08;Template Interpreter&#xff09;\u3002<\/p>\n<p>\u5176\u57fa\u672c\u6267\u884c\u673a\u5236&#xff1a;<\/p>\n<li>\n<p>\u4e3a\u5b57\u8282\u7801\u6307\u4ee4\u751f\u6210\u5bf9\u5e94\u7684\u6267\u884c\u6a21\u677f\u3002<\/p>\n<\/li>\n<li>\n<p>\u751f\u6210\u5f53\u524d CPU \u67b6\u6784\u5bf9\u5e94\u7684\u672c\u5730\u673a\u5668\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>\u5efa\u7acb\u5b57\u8282\u7801\u4e0e\u6a21\u677f\u6267\u884c\u5165\u53e3\u4e4b\u95f4\u7684\u5206\u6d3e\u5173\u7cfb\u3002<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c\u5f53\u524d\u5b57\u8282\u7801\u5bf9\u5e94\u7684\u6a21\u677f\u3002<\/p>\n<\/li>\n<li>\n<p>\u66f4\u65b0\u5b57\u8282\u7801\u4f4d\u7f6e\u548c\u6267\u884c\u72b6\u6001\u3002<\/p>\n<\/li>\n<li>\n<p>\u7ee7\u7eed\u6267\u884c\u4e0b\u4e00\u6761\u6307\u4ee4\u3002<\/p>\n<\/li>\n<p>\u53ef\u4ee5\u7b80\u5316\u4e3a&#xff1a;<\/p>\n<p>\u8bfb\u53d6\u5b57\u8282\u7801<br \/>\n    |<br \/>\n    v<br \/>\n\u8bc6\u522b\u5b57\u8282\u7801\u64cd\u4f5c\u7801<br \/>\n    |<br \/>\n    v<br \/>\n\u67e5\u627e\u5bf9\u5e94\u7684\u89e3\u91ca\u5668\u6267\u884c\u5165\u53e3<br \/>\n    |<br \/>\n    v<br \/>\n\u6267\u884c\u6a21\u677f\u751f\u6210\u7684\u672c\u5730\u673a\u5668\u7801<br \/>\n    |<br \/>\n    v<br \/>\n\u66f4\u65b0\u64cd\u4f5c\u6570\u6808\u548c\u6267\u884c\u4f4d\u7f6e<br \/>\n    |<br \/>\n    v<br \/>\n\u5206\u6d3e\u4e0b\u4e00\u6761\u5b57\u8282\u7801<\/p>\n<h4>5.2 TemplateTable \u6e90\u7801\u5206\u6790<\/h4>\n<p>\u6e90\u7801\u4f4d\u7f6e&#xff1a;<\/p>\n<p>src\/hotspot\/share\/interpreter\/templateTable.cpp<\/p>\n<p>TemplateTable \u8d1f\u8d23\u5efa\u7acb\u5b57\u8282\u7801\u548c\u89e3\u91ca\u5668\u6a21\u677f\u4e4b\u95f4\u7684\u5173\u8054\u3002<\/p>\n<p>\u4ee5 iadd \u4e3a\u4f8b&#xff0c;HotSpot \u4e3a\u6574\u6570\u52a0\u6cd5\u51c6\u5907\u76f8\u5e94\u7684\u89e3\u91ca\u5668\u6267\u884c\u6a21\u677f\u3002<\/p>\n<p>\u9700\u8981\u533a\u5206&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5b57\u8282\u7801\u5b9a\u4e49\u63cf\u8ff0 iadd \u7684\u8bed\u4e49\u3002<\/p>\n<\/li>\n<li>\n<p>TemplateTable \u4e3a\u6307\u4ee4\u751f\u6210\u89e3\u91ca\u5668\u6267\u884c\u4ee3\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>\u5177\u4f53\u673a\u5668\u7801\u751f\u6210\u4e0e CPU \u67b6\u6784\u76f8\u5173\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5b57\u8282\u7801\u5b9a\u4e49\u53ef\u53c2\u8003&#xff1a;<\/p>\n<p>OpenJDK bytecodes.cpp&#xff1a;iadd \u7b49\u6307\u4ee4\u5b9a\u4e49\u3002<\/p>\n<h4>5.3 TemplateInterpreter \u6e90\u7801\u5206\u6790<\/h4>\n<p>\u91cd\u70b9\u6e90\u7801&#xff1a;<\/p>\n<p>src\/hotspot\/share\/interpreter\/templateInterpreter.cpp<\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p>void TemplateInterpreter::initialize_code() {<\/p>\n<p>    \/\/ \u521d\u59cb\u5316\u62bd\u8c61\u89e3\u91ca\u5668\u76f8\u5173\u7ed3\u6784<br \/>\n    AbstractInterpreter::initialize();<\/p>\n<p>    \/\/ \u521d\u59cb\u5316\u5b57\u8282\u7801\u6a21\u677f<br \/>\n    TemplateTable::initialize();<\/p>\n<p>    \/\/ \u540e\u7eed\u751f\u6210\u89e3\u91ca\u5668\u4ee3\u7801\u548c\u6267\u884c\u5165\u53e3<br \/>\n    \/\/ \u5177\u4f53\u5b9e\u73b0\u8fd8\u5305\u62ec\u5165\u53e3\u3001\u8fd4\u56de\u5165\u53e3\u3001\u5f02\u5e38\u5165\u53e3\u7b49<br \/>\n}<\/p>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u89e3\u91ca\u5668\u9700\u8981\u521d\u59cb\u5316\u81ea\u5df1\u7684\u8fd0\u884c\u73af\u5883\u3002<\/p>\n<\/li>\n<li>\n<p>\u5b57\u8282\u7801\u6a21\u677f\u9700\u8981\u63d0\u524d\u5efa\u7acb\u3002<\/p>\n<\/li>\n<li>\n<p>JVM \u4f1a\u751f\u6210\u89e3\u91ca\u5668\u4f7f\u7528\u7684\u672c\u5730\u4ee3\u7801\u5165\u53e3\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u7ed3\u8bba&#xff1a;<\/p>\n<p>HotSpot \u6a21\u677f\u89e3\u91ca\u5668\u672c\u8eab\u5c31\u662f\u672c\u5730\u673a\u5668\u7801\u5b9e\u73b0\u7684\u6267\u884c\u5f15\u64ce\u3002<\/p>\n<p>\u56e0\u6b64&#xff0c;CPU \u5e76\u4e0d\u662f\u76f4\u63a5\u7406\u89e3 iload\u3001iadd \u8fd9\u4e9b Java \u5b57\u8282\u7801&#xff0c;\u800c\u662f\u5728\u6267\u884c\u89e3\u91ca\u5668\u751f\u6210\u7684\u673a\u5668\u7801\u3002<\/p>\n<p>\u6e90\u7801\u53c2\u8003&#xff1a;OpenJDK TemplateInterpreter.cpp\u3002<\/p>\n<h4>5.4 \u65b9\u6cd5\u6267\u884c\u5e27\u5982\u4f55\u5de5\u4f5c&#xff1f;<\/h4>\n<p>\u6bcf\u6b21 Java \u65b9\u6cd5\u8c03\u7528&#xff0c;\u90fd\u9700\u8981\u5efa\u7acb\u76f8\u5e94\u7684\u6808\u5e27\u3002<\/p>\n<p>\u6808\u5e27\u4e3b\u8981\u5305\u62ec&#xff1a;<\/p>\n<table>\n<tr>\u7ec4\u6210\u90e8\u5206\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>\u5c40\u90e8\u53d8\u91cf\u8868<\/td>\n<td>\u4fdd\u5b58\u53c2\u6570\u548c\u5c40\u90e8\u53d8\u91cf<\/td>\n<\/tr>\n<tr>\n<td>\u64cd\u4f5c\u6570\u6808<\/td>\n<td>\u4fdd\u5b58\u6307\u4ee4\u6267\u884c\u65f6\u7684\u64cd\u4f5c\u6570<\/td>\n<\/tr>\n<tr>\n<td>\u52a8\u6001\u94fe\u63a5<\/td>\n<td>\u652f\u6301\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u5f15\u7528\u7684\u89e3\u6790<\/td>\n<\/tr>\n<tr>\n<td>\u8fd4\u56de\u4fe1\u606f<\/td>\n<td>\u652f\u6301\u65b9\u6cd5\u8fd4\u56de\u548c\u8c03\u7528\u8005\u6062\u590d\u6267\u884c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>public class StackFrameDemo {<\/p>\n<p>    public static int add(int a, int b) {<\/p>\n<p>        \/\/ a\u3001b \u5bf9\u5e94\u5c40\u90e8\u53d8\u91cf\u8868\u4e2d\u7684\u69fd\u4f4d<br \/>\n        int result &#061; a &#043; b;<\/p>\n<p>        \/\/ \u6267\u884c ireturn \u8fd4\u56de\u6574\u6570<br \/>\n        return result;<br \/>\n    }<\/p>\n<p>    public static void main(String[] args) {<\/p>\n<p>        \/\/ \u8c03\u7528 add \u65f6\u5efa\u7acb\u65b0\u7684\u65b9\u6cd5\u6267\u884c\u5e27<br \/>\n        int result &#061; add(10, 20);<\/p>\n<p>        System.out.println(result);<br \/>\n    }<br \/>\n}<\/p>\n<p>\u6267\u884c\u8fc7\u7a0b&#xff1a;<\/p>\n<p>main() \u6808\u5e27<br \/>\n    |<br \/>\n    | \u8c03\u7528 add(10, 20)<br \/>\n    v<br \/>\nadd() \u6808\u5e27<br \/>\n    |<br \/>\n    | \u5c40\u90e8\u53d8\u91cf\u8868<br \/>\n    | a &#061; 10<br \/>\n    | b &#061; 20<br \/>\n    |<br \/>\n    | \u64cd\u4f5c\u6570\u6808<br \/>\n    | 10 &#043; 20<br \/>\n    | \u7ed3\u679c &#061; 30<br \/>\n    |<br \/>\n    | ireturn<br \/>\n    v<br \/>\n\u8fd4\u56de main()<br \/>\n    |<br \/>\n    | result &#061; 30<br \/>\n    v<br \/>\n\u7ee7\u7eed\u6267\u884c<\/p>\n<p>\u6ce8\u610f&#xff1a;\u6808\u5e27\u662f JVM \u89c4\u8303\u5b9a\u4e49\u7684\u62bd\u8c61\u6267\u884c\u7ed3\u6784\u3002HotSpot \u89e3\u91ca\u6267\u884c\u65f6\u6709\u5bf9\u5e94\u7684\u89e3\u91ca\u5668\u6808\u5e27\u5b9e\u73b0&#xff1b;JIT \u7f16\u8bd1\u540e&#xff0c;\u90e8\u5206\u53d8\u91cf\u53ef\u80fd\u88ab\u5206\u914d\u5230\u5bc4\u5b58\u5668&#xff0c;\u6216\u8005\u901a\u8fc7\u4f18\u5316\u6d88\u9664&#xff0c;\u5e76\u4e0d\u4e00\u5b9a\u4fdd\u7559\u5b8c\u5168\u76f8\u540c\u7684\u7269\u7406\u5e03\u5c40\u3002<\/p>\n<h3>\u516d\u3001JVM \u5982\u4f55\u901a\u8fc7 JIT \u5c06\u5b57\u8282\u7801\u7f16\u8bd1\u4e3a\u673a\u5668\u7801&#xff1f;<\/h3>\n<p>\u89e3\u91ca\u5668\u80fd\u591f\u6267\u884c\u6240\u6709\u5408\u6cd5\u7684\u5b57\u8282\u7801&#xff0c;\u4f46\u5bf9\u4e8e\u957f\u671f\u8fd0\u884c\u3001\u9891\u7e41\u8c03\u7528\u7684\u65b9\u6cd5&#xff0c;\u9010\u6761\u89e3\u91ca\u901a\u5e38\u4f1a\u5e26\u6765\u989d\u5916\u5f00\u9500\u3002<\/p>\n<p>HotSpot \u56e0\u6b64\u5f15\u5165\u5373\u65f6\u7f16\u8bd1&#xff08;JIT&#xff09;\u3002<\/p>\n<h4>6.1 JIT \u7684\u57fa\u672c\u5de5\u4f5c\u6d41\u7a0b<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101181656-6ae78218680b8.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f&#xff1a;<\/p>\n<ul>\n<li>\n<p>C1 \u548c C2 \u662f HotSpot \u7684\u4e24\u79cd\u4e3b\u8981\u7f16\u8bd1\u5668\u5b9e\u73b0\u3002<\/p>\n<\/li>\n<li>\n<p>\u5206\u5c42\u7f16\u8bd1\u53ef\u4ee5\u6839\u636e\u4ee3\u7801\u8fd0\u884c\u60c5\u51b5\u9009\u62e9\u4e0d\u540c\u7f16\u8bd1\u7ea7\u522b\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u662f\u6bcf\u4e2a\u65b9\u6cd5\u90fd\u4f1a\u7ecf\u8fc7 C1 \u548c C2\u3002<\/p>\n<\/li>\n<li>\n<p>\u7f16\u8bd1\u5b8c\u6210\u540e&#xff0c;\u5982\u679c\u4f18\u5316\u5047\u8bbe\u5931\u6548&#xff0c;JVM \u8fd8\u53ef\u80fd\u6267\u884c\u53bb\u4f18\u5316&#xff08;Deoptimization&#xff09;&#xff0c;\u8fd4\u56de\u89e3\u91ca\u6267\u884c\u6216\u5176\u4ed6\u9002\u5f53\u7684\u6267\u884c\u72b6\u6001\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>6.2 CompileBroker \u6e90\u7801\u5206\u6790<\/h4>\n<p>\u6e90\u7801\u4f4d\u7f6e&#xff1a;<\/p>\n<p>src\/hotspot\/share\/compiler\/compileBroker.cpp<\/p>\n<p>CompileBroker \u662f HotSpot JIT \u7f16\u8bd1\u4efb\u52a1\u7ba1\u7406\u7684\u6838\u5fc3\u7ec4\u4ef6\u3002<\/p>\n<p>\u4e3b\u8981\u8d1f\u8d23&#xff1a;<\/p>\n<li>\n<p>\u63a5\u6536\u7f16\u8bd1\u8bf7\u6c42\u3002<\/p>\n<\/li>\n<li>\n<p>\u7ba1\u7406\u7f16\u8bd1\u4efb\u52a1\u3002<\/p>\n<\/li>\n<li>\n<p>\u7ef4\u62a4\u7f16\u8bd1\u4efb\u52a1\u961f\u5217\u3002<\/p>\n<\/li>\n<li>\n<p>\u8c03\u5ea6\u7f16\u8bd1\u7ebf\u7a0b\u3002<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528\u5bf9\u5e94\u7f16\u8bd1\u5668\u3002<\/p>\n<\/li>\n<li>\n<p>\u5904\u7406\u7f16\u8bd1\u7ed3\u679c\u3002<\/p>\n<\/li>\n<p>\u4f8b\u5982&#xff0c;\u5f53\u524d OpenJDK \u6e90\u7801\u4e2d\u7684\u521d\u59cb\u5316\u903b\u8f91&#xff1a;<\/p>\n<p>\/\/ src\/hotspot\/share\/compiler\/compileBroker.cpp<br \/>\n\/\/ CompileBroker::compilation_init<\/p>\n<p>void CompileBroker::compilation_init(JavaThread* THREAD) {<\/p>\n<p>    \/\/ \u672a\u542f\u7528 JIT \u65f6&#xff0c;\u4e0d\u521d\u59cb\u5316\u7f16\u8bd1\u7cfb\u7edf<br \/>\n    if (!UseCompiler) {<br \/>\n        return;<br \/>\n    }<\/p>\n<p>    \/\/ \u6ce8\u518c\u7f16\u8bd1\u5668\u548c\u76f8\u5173\u7f16\u8bd1\u8fd0\u884c\u73af\u5883<br \/>\n    \/\/ \u540e\u7eed\u6839\u636e\u7f16\u8bd1\u914d\u7f6e\u521d\u59cb\u5316\u7f16\u8bd1\u7ebf\u7a0b\u7b49\u8d44\u6e90<\/p>\n<p>    \/\/ \u521d\u59cb\u5316\u7f16\u8bd1\u7ebf\u7a0b<br \/>\n    init_compiler_threads();<br \/>\n}<\/p>\n<p>\u8bf4\u660e&#xff1a;\u6b64\u5904\u6458\u53d6\u5f53\u524d\u6e90\u7801\u4e2d\u7684\u6838\u5fc3\u521d\u59cb\u5316\u903b\u8f91&#xff0c;\u7701\u7565\u4e86\u7f16\u8bd1\u5668\u6ce8\u518c\u3001\u7f16\u8bd1\u7ebf\u7a0b\u6570\u91cf\u5224\u65ad\u53ca\u5176\u4ed6\u521d\u59cb\u5316\u7ec6\u8282\u3002C1\/C2 \u7684\u5177\u4f53\u521d\u59cb\u5316\u8def\u5f84\u9700\u8981\u7ed3\u5408\u7f16\u8bd1\u5668\u6784\u5efa\u914d\u7f6e\u9605\u8bfb\u3002<\/p>\n<p>\u6e90\u7801\u53c2\u8003&#xff1a;OpenJDK CompileBroker.cpp\u3002<\/p>\n<h4>6.3 C1 \u548c C2 \u7f16\u8bd1\u5668\u7684\u533a\u522b<\/h4>\n<table>\n<tr>\u6bd4\u8f83\u9879\u76eeC1 \u7f16\u8bd1\u5668C2 \u7f16\u8bd1\u5668<\/tr>\n<tbody>\n<tr>\n<td>\u4e3b\u8981\u76ee\u6807<\/td>\n<td>\u8f83\u5feb\u5b8c\u6210\u7f16\u8bd1<\/td>\n<td>\u751f\u6210\u9ad8\u8d28\u91cf\u4f18\u5316\u4ee3\u7801<\/td>\n<\/tr>\n<tr>\n<td>\u7f16\u8bd1\u5f00\u9500<\/td>\n<td>\u76f8\u5bf9\u8f83\u4f4e<\/td>\n<td>\u76f8\u5bf9\u8f83\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u4f18\u5316\u7a0b\u5ea6<\/td>\n<td>\u76f8\u5bf9\u9002\u4e2d<\/td>\n<td>\u901a\u5e38\u66f4\u6df1\u5165<\/td>\n<\/tr>\n<tr>\n<td>\u5178\u578b\u7528\u9014<\/td>\n<td>\u8f83\u65e9\u671f\u7f16\u8bd1\u7ea7\u522b<\/td>\n<td>\u9ad8\u4f18\u5316\u7ea7\u522b<\/td>\n<\/tr>\n<tr>\n<td>\u6838\u5fc3\u6e90\u7801<\/td>\n<td>c1\/<\/td>\n<td>opto\/<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u76f8\u5173\u6e90\u7801&#xff1a;<\/p>\n<p>src\/hotspot\/share\/c1\/<br \/>\n    c1_Compiler.cpp<\/p>\n<p>src\/hotspot\/share\/opto\/<br \/>\n    c2compiler.cpp<\/p>\n<h4>6.4 JIT \u5982\u4f55\u4f18\u5316\u5b57\u8282\u7801&#xff1f;<\/h4>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>public class InlineDemo {<\/p>\n<p>    \/\/ \u666e\u901a\u65b9\u6cd5<br \/>\n    public static int square(int value) {<br \/>\n        return value * value;<br \/>\n    }<\/p>\n<p>    public static int calculate() {<\/p>\n<p>        \/\/ JIT \u5728\u6ee1\u8db3\u6761\u4ef6\u65f6\u53ef\u80fd\u5c06 square \u65b9\u6cd5\u5185\u8054<br \/>\n        return square(10);<br \/>\n    }<br \/>\n}<\/p>\n<p>\u539f\u59cb\u8c03\u7528\u5173\u7cfb&#xff1a;<\/p>\n<p>calculate()<br \/>\n    |<br \/>\n    v<br \/>\nsquare(10)<br \/>\n    |<br \/>\n    v<br \/>\nreturn 10 * 10<\/p>\n<p>\u7ecf\u8fc7\u65b9\u6cd5\u5185\u8054\u548c\u5e38\u91cf\u4f20\u64ad\u7b49\u4f18\u5316\u540e&#xff0c;\u53ef\u80fd\u7b80\u5316\u4e3a&#xff1a;<\/p>\n<p>calculate()<br \/>\n    |<br \/>\n    v<br \/>\nreturn 100<\/p>\n<p>\u8fd9\u53ea\u662f\u8bf4\u660e\u4f18\u5316\u539f\u7406\u7684\u793a\u610f&#xff0c;\u5b9e\u9645\u4f18\u5316\u8fd8\u53d7\u7f16\u8bd1\u4e0a\u4e0b\u6587\u3001\u7c7b\u578b\u4fe1\u606f\u548c\u8fd0\u884c\u65f6\u5047\u8bbe\u5f71\u54cd\u3002<\/p>\n<p>\u91cd\u70b9\u638c\u63e1\u4ee5\u4e0b\u4f18\u5316\u6280\u672f&#xff1a;<\/p>\n<table>\n<tr>\u4f18\u5316\u6280\u672f\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>\u65b9\u6cd5\u5185\u8054<\/td>\n<td>\u51cf\u5c11\u65b9\u6cd5\u8c03\u7528\u5f00\u9500&#xff0c;\u6269\u5927\u4f18\u5316\u8303\u56f4<\/td>\n<\/tr>\n<tr>\n<td>\u5e38\u91cf\u4f20\u64ad<\/td>\n<td>\u5229\u7528\u5df2\u77e5\u5e38\u91cf\u7b80\u5316\u8868\u8fbe\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>\u6b7b\u4ee3\u7801\u6d88\u9664<\/td>\n<td>\u5220\u9664\u65e0\u6548\u8ba1\u7b97<\/td>\n<\/tr>\n<tr>\n<td>\u5faa\u73af\u4f18\u5316<\/td>\n<td>\u6539\u5584\u5faa\u73af\u6267\u884c\u6548\u7387<\/td>\n<\/tr>\n<tr>\n<td>\u9003\u9038\u5206\u6790<\/td>\n<td>\u5206\u6790\u5bf9\u8c61\u662f\u5426\u9003\u9038\u51fa\u7279\u5b9a\u4f5c\u7528\u57df<\/td>\n<\/tr>\n<tr>\n<td>\u6807\u91cf\u66ff\u6362<\/td>\n<td>\u5728\u9002\u7528\u60c5\u51b5\u4e0b\u6d88\u9664\u5bf9\u8c61\u5206\u914d<\/td>\n<\/tr>\n<tr>\n<td>\u53bb\u865a\u62df\u5316<\/td>\n<td>\u5c06\u90e8\u5206\u52a8\u6001\u8c03\u7528\u8f6c\u4e3a\u66f4\u5bb9\u6613\u4f18\u5316\u7684\u8c03\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b66\u4e60\u603b\u7ed3&#xff1a;JIT \u4e0d\u53ea\u662f\u5c06\u5b57\u8282\u7801\u7ffb\u8bd1\u6210\u673a\u5668\u7801&#xff0c;\u8fd8\u4f1a\u5229\u7528\u8fd0\u884c\u65f6\u4fe1\u606f\u5bf9\u7a0b\u5e8f\u8fdb\u884c\u52a8\u6001\u4f18\u5316\u3002<\/p>\n<h3>\u4e03\u3001\u5b57\u8282\u7801\u6700\u7ec8\u5982\u4f55\u88ab CPU \u6267\u884c&#xff1f;<\/h3>\n<p>\u8fd9\u662f\u4ece JVM \u8f6f\u4ef6\u5b9e\u73b0\u5ef6\u4f38\u5230\u786c\u4ef6\u4f53\u7cfb\u7ed3\u6784\u7684\u5173\u952e\u90e8\u5206\u3002<\/p>\n<h4>7.1 \u5b57\u8282\u7801\u4e0e\u673a\u5668\u7801\u7684\u533a\u522b<\/h4>\n<p>\u5047\u8bbe Java \u4ee3\u7801&#xff1a;<\/p>\n<p>public class CpuDemo {<\/p>\n<p>    public static int add(int a, int b) {<\/p>\n<p>        \/\/ JVM \u5b57\u8282\u7801\u5c42\u9762\u7684\u6574\u6570\u52a0\u6cd5<br \/>\n        return a &#043; b;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5bf9\u5e94\u5b57\u8282\u7801&#xff1a;<\/p>\n<p>iload_0<br \/>\niload_1<br \/>\niadd<br \/>\nireturn<\/p>\n<p>\u5047\u8bbe\u5728\u67d0\u4e2a x86-64 \u5e73\u53f0\u4e0a&#xff0c;JIT \u6700\u7ec8\u751f\u6210\u7c7b\u4f3c\u4ee5\u4e0b\u673a\u5668\u6307\u4ee4&#xff1a;<\/p>\n<p>; x86-64 \u793a\u610f\u4ee3\u7801<br \/>\n; \u5047\u8bbe\u4f7f\u7528 System V AMD64 \u8c03\u7528\u7ea6\u5b9a<\/p>\n<p>mov eax, edi    ; \u8bfb\u53d6\u7b2c\u4e00\u4e2a int \u53c2\u6570<br \/>\nadd eax, esi    ; \u5c06\u7b2c\u4e8c\u4e2a int \u53c2\u6570\u52a0\u5230 eax<br \/>\nret             ; \u8fd4\u56de\u8ba1\u7b97\u7ed3\u679c<\/p>\n<p>\u4e0a\u8ff0\u4ee3\u7801\u4ec5\u7528\u4e8e\u7406\u89e3&#xff0c;\u4e0d\u4ee3\u8868 HotSpot \u5fc5\u7136\u751f\u6210\u5b8c\u5168\u76f8\u540c\u7684\u6307\u4ee4\u3002<\/p>\n<p>\u5982\u679c\u8fd0\u884c\u5728 AArch64 \u5e73\u53f0&#xff0c;\u53ef\u80fd\u751f\u6210\u7c7b\u4f3c&#xff1a;<\/p>\n<p>; AArch64 \u793a\u610f\u4ee3\u7801<\/p>\n<p>add w0, w0, w1  ; \u4e24\u4e2a int \u53c2\u6570\u76f8\u52a0&#xff0c;\u7ed3\u679c\u5199\u5165 w0<br \/>\nret             ; \u8fd4\u56de<\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u540c\u4e00\u4efd Class \u6587\u4ef6\u53ef\u4ee5\u5728\u4e0d\u540c\u67b6\u6784\u4e0a\u8fd0\u884c\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u540c JVM \u5b9e\u73b0\u53ef\u4ee5\u91c7\u7528\u4e0d\u540c\u6267\u884c\u7b56\u7565\u3002<\/p>\n<\/li>\n<li>\n<p>\u540c\u4e00\u4e2a Java \u65b9\u6cd5\u53ef\u80fd\u751f\u6210\u4e0d\u540c\u7684\u673a\u5668\u6307\u4ee4\u3002<\/p>\n<\/li>\n<li>\n<p>\u673a\u5668\u6307\u4ee4\u7684\u6570\u91cf\u548c\u6392\u5217\u4e0d\u5fc5\u4e0e\u5b57\u8282\u7801\u4e00\u4e00\u5bf9\u5e94\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>7.2 \u89e3\u91ca\u5668\u548c JIT \u4e24\u6761\u6267\u884c\u8def\u5f84<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101181656-6ae782188e36c.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e2a\u5bb9\u6613\u5ffd\u7565\u7684\u533a\u522b&#xff1a;<\/p>\n<p>\u89e3\u91ca\u5668\u6267\u884c\u65f6&#xff0c;CPU \u6267\u884c\u7684\u662f\u89e3\u91ca\u5668\u6a21\u677f\u751f\u6210\u7684\u673a\u5668\u7801&#xff1b;JIT \u6267\u884c\u65f6&#xff0c;CPU \u6267\u884c\u7684\u662f\u7f16\u8bd1\u540e\u7684 Java \u65b9\u6cd5\u673a\u5668\u7801\u3002<\/p>\n<h4>7.3 \u4e0d\u540c CPU \u67b6\u6784\u7684\u6267\u884c\u5dee\u5f02<\/h4>\n<table>\n<tr>\u6bd4\u8f83\u9879\u76eex86-64AArch64<\/tr>\n<tbody>\n<tr>\n<td>\u6307\u4ee4\u96c6\u67b6\u6784<\/td>\n<td>x86-64<\/td>\n<td>ARM 64 \u4f4d<\/td>\n<\/tr>\n<tr>\n<td>\u6307\u4ee4\u957f\u5ea6<\/td>\n<td>\u53ef\u53d8\u957f\u5ea6<\/td>\n<td>\u56fa\u5b9a 32 \u4f4d<\/td>\n<\/tr>\n<tr>\n<td>\u901a\u7528\u5bc4\u5b58\u5668<\/td>\n<td>RAX\u3001RBX \u7b49<\/td>\n<td>X0-X30<\/td>\n<\/tr>\n<tr>\n<td>\u6307\u4ee4\u751f\u6210<\/td>\n<td>x86-64 \u540e\u7aef<\/td>\n<td>AArch64 \u540e\u7aef<\/td>\n<\/tr>\n<tr>\n<td>\u672c\u5730\u673a\u5668\u7801<\/td>\n<td>x86-64 \u6307\u4ee4<\/td>\n<td>AArch64 \u6307\u4ee4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5bf9\u4e8e\u7cfb\u7edf\u5de5\u7a0b\u5e08&#xff0c;\u8fd8\u9700\u8981\u7ee7\u7eed\u7814\u7a76&#xff1a;<\/p>\n<ul>\n<li>\n<p>CPU \u6307\u4ee4\u89e3\u7801\u4e0e\u6267\u884c\u3002<\/p>\n<\/li>\n<li>\n<p>\u5bc4\u5b58\u5668\u5206\u914d\u3002<\/p>\n<\/li>\n<li>\n<p>\u5185\u5b58\u8bbf\u95ee\u4e0e\u7f13\u5b58\u884c\u4e3a\u3002<\/p>\n<\/li>\n<li>\n<p>\u5206\u652f\u9884\u6d4b\u3002<\/p>\n<\/li>\n<li>\n<p>\u5185\u5b58\u5c4f\u969c\u3002<\/p>\n<\/li>\n<li>\n<p>JIT \u751f\u6210\u4ee3\u7801\u7684\u6307\u4ee4\u7f13\u5b58\u4e00\u81f4\u6027\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u77e5\u8bc6\u80fd\u591f\u5e2e\u52a9\u5206\u6790\u4e3a\u4ec0\u4e48\u540c\u4e00\u4efd Java \u7a0b\u5e8f\u5728\u4e0d\u540c CPU\u3001\u4e0d\u540c JVM \u548c\u4e0d\u540c\u8fd0\u884c\u53c2\u6570\u4e0b\u5177\u6709\u4e0d\u540c\u7684\u6027\u80fd\u8868\u73b0\u3002<\/p>\n<h3>\u516b\u3001\u901a\u8fc7 JVM \u53c2\u6570\u89c2\u5bdf\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\u8fc7\u7a0b<\/h3>\n<p>\u5efa\u8bae\u4f7f\u7528\u5b9e\u9645\u547d\u4ee4\u9a8c\u8bc1\u524d\u9762\u5b66\u4e60\u7684\u77e5\u8bc6\u3002<\/p>\n<h4>8.1 \u67e5\u770b Class \u6587\u4ef6\u7ed3\u6784<\/h4>\n<p># \u67e5\u770b\u53cd\u6c47\u7f16\u6307\u4ee4<br \/>\njavap -c BytecodeDemo<\/p>\n<p># \u67e5\u770b\u5b8c\u6574 Class \u6587\u4ef6\u7ed3\u6784<br \/>\njavap -v BytecodeDemo<\/p>\n<p># \u67e5\u770b\u65b9\u6cd5\u7b7e\u540d<br \/>\njavap -s BytecodeDemo<\/p>\n<p>\u91cd\u70b9\u89c2\u5bdf&#xff1a;<\/p>\n<ul>\n<li>\n<p>Constant Pool<\/p>\n<\/li>\n<li>\n<p>Method Descriptor<\/p>\n<\/li>\n<li>\n<p>Code<\/p>\n<\/li>\n<li>\n<p>Stack<\/p>\n<\/li>\n<li>\n<p>Locals<\/p>\n<\/li>\n<li>\n<p>Exception Table<\/p>\n<\/li>\n<li>\n<p>StackMapTable<\/p>\n<\/li>\n<\/ul>\n<h4>8.2 \u89c2\u5bdf\u7c7b\u52a0\u8f7d\u8fc7\u7a0b<\/h4>\n<p># \u8f93\u51fa\u7c7b\u52a0\u8f7d\u65e5\u5fd7<br \/>\njava -Xlog:class&#043;load&#061;info BytecodeDemo<\/p>\n<p>\u53ef\u4ee5\u89c2\u5bdf\u7c7b\u52a0\u8f7d\u987a\u5e8f\u3001\u7c7b\u52a0\u8f7d\u5668\u4ee5\u53ca\u7c7b\u6765\u6e90\u7b49\u4fe1\u606f\u3002<\/p>\n<h4>8.3 \u89c2\u5bdf\u89e3\u91ca\u5668\u548c JIT \u7f16\u8bd1<\/h4>\n<p># \u4e3b\u8981\u4f7f\u7528\u89e3\u91ca\u5668\u6267\u884c<br \/>\njava -Xint BytecodeDemo<\/p>\n<p># \u4f7f\u7528\u7f16\u8bd1\u6a21\u5f0f&#xff0c;\u5c1d\u8bd5\u5c3d\u65e9\u7f16\u8bd1\u65b9\u6cd5<br \/>\njava -Xcomp BytecodeDemo<\/p>\n<p># \u8f93\u51fa JIT \u7f16\u8bd1\u4fe1\u606f<br \/>\njava -XX:&#043;PrintCompilation BytecodeDemo<\/p>\n<p>\u5bf9\u4e8e\u73b0\u4ee3 JDK&#xff0c;\u5efa\u8bae\u7ed3\u5408&#xff1a;<\/p>\n<p>java -XX:&#043;UnlockDiagnosticVMOptions \\\\<br \/>\n     -XX:&#043;LogCompilation \\\\<br \/>\n     -XX:LogFile&#061;jit.log \\\\<br \/>\n     BytecodeDemo<\/p>\n<p>\u5206\u6790\u7f16\u8bd1\u65e5\u5fd7\u3002<\/p>\n<h4>8.4 \u89c2\u5bdf JIT \u751f\u6210\u7684\u673a\u5668\u7801<\/h4>\n<p>\u53ef\u4ee5\u4f7f\u7528 HotSpot \u7684\u8bca\u65ad\u9009\u9879&#xff1a;<\/p>\n<p># \u8f93\u51fa\u6c47\u7f16\u76f8\u5173\u4fe1\u606f<br \/>\njava -XX:&#043;UnlockDiagnosticVMOptions \\\\<br \/>\n     -XX:&#043;PrintAssembly \\\\<br \/>\n     BytecodeDemo<\/p>\n<p>\u6ce8\u610f&#xff1a;<\/p>\n<ul>\n<li>\n<p>PrintAssembly \u901a\u5e38\u9700\u8981\u914d\u5408\u9002\u7528\u7684\u53cd\u6c47\u7f16\u5668\u652f\u6301\u3002<\/p>\n<\/li>\n<li>\n<p>\u751f\u4ea7\u73af\u5883\u4e0d\u5efa\u8bae\u76f4\u63a5\u5f00\u542f\u5927\u91cf\u8bca\u65ad\u8f93\u51fa\u3002<\/p>\n<\/li>\n<li>\n<p>-Xint\u3001-Xcomp \u9002\u5408\u7814\u7a76\u6267\u884c\u6a21\u5f0f&#xff0c;\u4e0d\u9002\u5408\u76f4\u63a5\u4f5c\u4e3a\u516c\u5e73\u7684\u6027\u80fd\u5bf9\u6bd4\u65b9\u6cd5\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5efa\u8bae\u8fdb\u4e00\u6b65\u4f7f\u7528 JMH \u8fdb\u884c\u57fa\u51c6\u6d4b\u8bd5\u3002<\/p>\n<h3>\u4e5d\u3001OpenJDK \u6e90\u7801\u9605\u8bfb\u8def\u7ebf<\/h3>\n<p>\u5efa\u8bae\u4e0d\u8981\u4e00\u6b21\u6027\u9605\u8bfb\u6240\u6709 HotSpot \u6e90\u7801&#xff0c;\u800c\u662f\u6cbf\u7740\u771f\u5b9e\u6267\u884c\u94fe\u8def\u9010\u6b65\u6df1\u5165\u3002<\/p>\n<p>\u4ee5\u4e0b\u4ee5 OpenJDK \u4e3b\u7ebf jdk \u4ed3\u5e93\u4e3a\u53c2\u8003\u3002<\/p>\n<table>\n<tr>\u987a\u5e8f\u6e90\u7801\u6587\u4ef6\u91cd\u70b9\u7814\u7a76\u5185\u5bb9<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>classLoader.cpp<\/td>\n<td>Class \u6587\u4ef6\u83b7\u53d6<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>systemDictionary.cpp<\/td>\n<td>\u7c7b\u67e5\u627e\u3001\u52a0\u8f7d\u4e0e\u7ea6\u675f<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>classFileParser.cpp<\/td>\n<td>Class \u6587\u4ef6\u89e3\u6790<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>verifier.cpp<\/td>\n<td>\u5b57\u8282\u7801\u9a8c\u8bc1<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>constantPool.cpp<\/td>\n<td>\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>linkResolver.cpp<\/td>\n<td>\u5b57\u6bb5\u548c\u65b9\u6cd5\u89e3\u6790<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>templateInterpreter.cpp<\/td>\n<td>\u89e3\u91ca\u5668\u521d\u59cb\u5316<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>templateTable.cpp<\/td>\n<td>\u5b57\u8282\u7801\u6a21\u677f\u751f\u6210<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>interpreterRuntime.cpp<\/td>\n<td>\u89e3\u91ca\u5668\u8fd0\u884c\u65f6\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>compileBroker.cpp<\/td>\n<td>JIT \u7f16\u8bd1\u4efb\u52a1\u7ba1\u7406<\/td>\n<\/tr>\n<tr>\n<td>11<\/td>\n<td>c1_Compiler.cpp<\/td>\n<td>C1 \u7f16\u8bd1\u5668<\/td>\n<\/tr>\n<tr>\n<td>12<\/td>\n<td>c2compiler.cpp<\/td>\n<td>C2 \u7f16\u8bd1\u5668<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u91cd\u70b9\u6e90\u7801\u5165\u53e3&#xff1a;<\/p>\n<ul>\n<li>\n<p>ClassFileParser.cpp&#xff1a;\u53ef\u4ee5\u4ece parse_constant_pool_entries() \u5f00\u59cb\u9605\u8bfb\u3002\u6e90\u7801\u4e2d\u53ef\u4ee5\u770b\u5230 JVM \u5982\u4f55\u6839\u636e\u5e38\u91cf\u6c60 tag \u8bfb\u53d6\u4e0d\u540c\u7ed3\u6784&#xff0c;\u5e76\u5199\u5165\u5185\u90e8 ConstantPool\u3002<\/p>\n<p>GitHub<\/p>\n<\/li>\n<li>\n<p>verifier.cpp&#xff1a;\u7814\u7a76\u5b57\u8282\u7801\u9a8c\u8bc1\u3002<\/p>\n<\/li>\n<li>\n<p>linkResolver.cpp&#xff1a;\u7814\u7a76\u65b9\u6cd5\u89e3\u6790\u3001\u63a5\u53e3\u89e3\u6790\u548c\u8bbf\u95ee\u68c0\u67e5\u3002<\/p>\n<\/li>\n<li>\n<p>templateInterpreter.cpp&#xff1a;\u7814\u7a76\u89e3\u91ca\u5668\u521d\u59cb\u5316\u548c\u4ee3\u7801\u5165\u53e3\u3002<\/p>\n<p>GitHub<\/p>\n<\/li>\n<li>\n<p>templateTable.cpp&#xff1a;\u7814\u7a76\u5b57\u8282\u7801\u6267\u884c\u6a21\u677f\u3002<\/p>\n<\/li>\n<li>\n<p>compileBroker.cpp&#xff1a;\u7814\u7a76\u7f16\u8bd1\u4efb\u52a1\u7ba1\u7406\u3002<\/p>\n<p>GitHub<\/p>\n<\/li>\n<\/ul>\n<p>\u5efa\u8bae\u56fa\u5b9a\u4e00\u4e2a JDK \u7248\u672c&#xff0c;\u4f8b\u5982 JDK 25&#xff0c;\u7edf\u4e00\u4f7f\u7528\u8be5\u7248\u672c\u7684\u89c4\u8303\u548c\u6e90\u7801\u8fdb\u884c\u5b66\u4e60\u3002\u4e0d\u8981\u5c06 JDK 8\u3001JDK 17 \u548c\u5f53\u524d\u4e3b\u7ebf\u7684\u5b9e\u73b0\u7ec6\u8282\u76f4\u63a5\u6df7\u5728\u4e00\u8d77\u3002<\/p>\n<h3>\u5341\u3001\u5efa\u8bae\u5f62\u6210\u7684\u5b66\u4e60\u6210\u679c<\/h3>\n<p>\u5b8c\u6210\u672c\u6b21\u5b66\u4e60\u540e&#xff0c;\u5efa\u8bae\u81ea\u5df1\u6574\u7406\u56db\u4efd\u6280\u672f\u5b66\u4e60\u6750\u6599&#xff1a;<\/p>\n<table>\n<tr>\u5b66\u4e60\u6210\u679c\u5177\u4f53\u5185\u5bb9\u76ee\u6807<\/tr>\n<tbody>\n<tr>\n<td>Class \u52a0\u8f7d\u6d41\u7a0b\u56fe<\/td>\n<td>\u52a0\u8f7d\u3001\u89e3\u6790\u3001\u9a8c\u8bc1\u3001\u51c6\u5907\u3001\u521d\u59cb\u5316<\/td>\n<td>\u7406\u89e3\u7c7b\u751f\u547d\u5468\u671f<\/td>\n<\/tr>\n<tr>\n<td>\u5b57\u8282\u7801\u6267\u884c\u5206\u6790<\/td>\n<td>iload\u3001iadd\u3001ireturn<\/td>\n<td>\u7406\u89e3\u89e3\u91ca\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>HotSpot \u6e90\u7801\u6ce8\u91ca<\/td>\n<td>Parser\u3001Verifier\u3001Interpreter<\/td>\n<td>\u638c\u63e1\u6e90\u7801\u5b9e\u73b0<\/td>\n<\/tr>\n<tr>\n<td>JIT \u6267\u884c\u5206\u6790<\/td>\n<td>C1\u3001C2\u3001Code Cache\u3001\u673a\u5668\u7801<\/td>\n<td>\u7406\u89e3\u6027\u80fd\u4f18\u5316<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u63a8\u8350\u8fdb\u4e00\u6b65\u8fdb\u884c\u7684\u5b9e\u9a8c<\/h4>\n<p>\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2a\u5b8c\u6574\u7684\u5c0f\u7a0b\u5e8f&#xff1a;<\/p>\n<p>public class JvmExecutionStudy {<\/p>\n<p>    static int counter &#061; 100;<\/p>\n<p>    public static int add(int a, int b) {<br \/>\n        return a &#043; b;<br \/>\n    }<\/p>\n<p>    public static int calculate(int value) {<\/p>\n<p>        \/\/ \u666e\u901a\u65b9\u6cd5\u8c03\u7528<br \/>\n        int result &#061; add(value, counter);<\/p>\n<p>        \/\/ \u8fd4\u56de\u8ba1\u7b97\u7ed3\u679c<br \/>\n        return result;<br \/>\n    }<\/p>\n<p>    public static void main(String[] args) {<\/p>\n<p>        \/\/ \u591a\u6b21\u6267\u884c&#xff0c;\u4fbf\u4e8e\u89c2\u5bdf\u8fd0\u884c\u65f6\u7f16\u8bd1\u884c\u4e3a<br \/>\n        for (int i &#061; 0; i &lt; 100_000; i&#043;&#043;) {<\/p>\n<p>            int result &#061; calculate(i);<\/p>\n<p>            if (result &lt; 0) {<br \/>\n                System.out.println(result);<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5efa\u8bae\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u9a8c&#xff1a;<\/p>\n<li>\n<p>\u4f7f\u7528 javap -c -v \u5206\u6790 calculate() \u7684\u5b57\u8282\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>\u627e\u5230 add() \u5bf9\u5e94\u7684 invokestatic \u8c03\u7528\u6307\u4ee4\u3002<\/p>\n<\/li>\n<li>\n<p>\u9605\u8bfb ClassFileParser&#xff0c;\u7814\u7a76\u65b9\u6cd5 Code \u5c5e\u6027\u5982\u4f55\u88ab\u89e3\u6790\u3002<\/p>\n<\/li>\n<li>\n<p>\u9605\u8bfb Verifier&#xff0c;\u7814\u7a76\u65b9\u6cd5\u5b57\u8282\u7801\u5982\u4f55\u9a8c\u8bc1\u3002<\/p>\n<\/li>\n<li>\n<p>\u9605\u8bfb LinkResolver&#xff0c;\u7814\u7a76\u65b9\u6cd5\u5f15\u7528\u5982\u4f55\u89e3\u6790\u3002<\/p>\n<\/li>\n<li>\n<p>\u9605\u8bfb TemplateTable&#xff0c;\u7814\u7a76\u89e3\u91ca\u5668\u5982\u4f55\u6267\u884c\u6574\u6570\u52a0\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528 PrintCompilation \u89c2\u5bdf\u65b9\u6cd5\u7f16\u8bd1\u60c5\u51b5\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528 PrintAssembly \u89c2\u5bdf\u7f16\u8bd1\u540e\u7684\u673a\u5668\u7801\u3002<\/p>\n<\/li>\n<h3>\u5341\u4e00\u3001\u6700\u7ec8\u5b66\u4e60\u603b\u7ed3&#xff1a;\u7cfb\u7edf\u5de5\u7a0b\u5e08\u5fc5\u987b\u638c\u63e1\u7684\u6838\u5fc3\u7ed3\u8bba<\/h3>\n<p>1. Class \u6587\u4ef6\u52a0\u8f7d\u89e3\u51b3\u7684\u662f\u7a0b\u5e8f\u5982\u4f55\u8fdb\u5165 JVM \u7684\u95ee\u9898\u3002<\/p>\n<p>\u7c7b\u52a0\u8f7d\u5668\u83b7\u53d6\u4e8c\u8fdb\u5236\u6570\u636e&#xff0c;HotSpot \u5c06\u5176\u89e3\u6790\u4e3a\u5185\u90e8\u8fd0\u884c\u65f6\u7ed3\u6784\u3002\u7c7b\u52a0\u8f7d\u5668\u8fd8\u51b3\u5b9a\u7c7b\u578b\u8eab\u4efd\u548c\u7c7b\u9694\u79bb\u8fb9\u754c\u3002<\/p>\n<p>2. Class \u6587\u4ef6\u89e3\u6790\u89e3\u51b3\u7684\u662f\u7a0b\u5e8f\u7ed3\u6784\u5982\u4f55\u8f6c\u6362\u4e3a JVM \u5185\u90e8\u8868\u793a\u7684\u95ee\u9898\u3002<\/p>\n<p>ClassFileParser \u89e3\u6790\u5e38\u91cf\u6c60\u3001\u5b57\u6bb5\u3001\u65b9\u6cd5\u3001\u5c5e\u6027\u548c\u5b57\u8282\u7801&#xff0c;\u4e3a\u540e\u7eed\u6267\u884c\u5efa\u7acb\u57fa\u7840\u3002<\/p>\n<p>3. \u5b57\u8282\u7801\u9a8c\u8bc1\u548c\u94fe\u63a5\u89e3\u51b3\u7684\u662f\u7a0b\u5e8f\u662f\u5426\u5408\u6cd5\u3001\u5f15\u7528\u662f\u5426\u6709\u6548\u7684\u95ee\u9898\u3002<\/p>\n<p>Verifier \u68c0\u67e5\u7c7b\u578b\u5b89\u5168&#xff0c;Preparation \u51c6\u5907\u9759\u6001\u5b57\u6bb5&#xff0c;Resolution \u5efa\u7acb\u7b26\u53f7\u5f15\u7528\u4e0e\u8fd0\u884c\u65f6\u5b9e\u4f53\u7684\u8054\u7cfb\u3002<\/p>\n<p>4. \u89e3\u91ca\u5668\u89e3\u51b3\u7684\u662f\u5b57\u8282\u7801\u5982\u4f55\u6267\u884c\u7684\u95ee\u9898\u3002<\/p>\n<p>Template Interpreter \u901a\u8fc7\u5b57\u8282\u7801\u5206\u6d3e\u673a\u5236&#xff0c;\u8c03\u7528\u5bf9\u5e94\u7684\u672c\u5730\u673a\u5668\u7801\u6267\u884c\u6a21\u677f\u3002<\/p>\n<p>5. JIT \u89e3\u51b3\u7684\u662f\u70ed\u70b9\u4ee3\u7801\u5982\u4f55\u9ad8\u6548\u6267\u884c\u7684\u95ee\u9898\u3002<\/p>\n<p>C1\u3001C2 \u5229\u7528\u8fd0\u884c\u65f6\u4fe1\u606f\u8fdb\u884c\u7f16\u8bd1\u4f18\u5316&#xff0c;\u751f\u6210\u9002\u5408\u5f53\u524d CPU \u7684\u673a\u5668\u7801\u3002<\/p>\n<p>6. CPU \u89e3\u51b3\u7684\u662f\u672c\u5730\u673a\u5668\u6307\u4ee4\u5982\u4f55\u88ab\u786c\u4ef6\u6267\u884c\u7684\u95ee\u9898\u3002<\/p>\n<p>CPU \u4e0d\u76f4\u63a5\u8bc6\u522b Java \u5b57\u8282\u7801&#xff0c;\u800c\u662f\u6267\u884c JVM \u89e3\u91ca\u5668\u6216 JIT \u7f16\u8bd1\u5668\u751f\u6210\u7684\u673a\u5668\u6307\u4ee4\u3002<\/p>\n<p>\u6700\u91cd\u8981\u7684\u6280\u672f\u8ba4\u77e5&#xff1a;<\/p>\n<p>Class \u6587\u4ef6\u63d0\u4f9b\u7edf\u4e00\u7684 JVM \u5b57\u8282\u7801\u8868\u793a&#xff0c;HotSpot \u901a\u8fc7\u7c7b\u52a0\u8f7d\u3001\u5b57\u8282\u7801\u89e3\u6790\u3001\u9a8c\u8bc1\u3001\u94fe\u63a5\u3001\u89e3\u91ca\u6267\u884c\u548c JIT \u7f16\u8bd1&#xff0c;\u5c06 Java \u7a0b\u5e8f\u9010\u6b65\u8f6c\u6362\u4e3a\u786c\u4ef6\u80fd\u591f\u6267\u884c\u7684\u672c\u5730\u6307\u4ee4\u3002<\/p>\n<p>\u5bf9\u4e8e\u7cfb\u7edf\u5de5\u7a0b\u5e08\u6765\u8bf4&#xff0c;\u771f\u6b63\u9700\u8981\u6253\u901a\u7684\u662f\u4e09\u5c42&#xff1a;<\/p>\n<ul>\n<li>\n<p>JVM \u89c4\u8303\u5c42&#xff1a; \u7406\u89e3 Class \u6587\u4ef6\u683c\u5f0f\u3001\u5b57\u8282\u7801\u8bed\u4e49\u548c\u6267\u884c\u6a21\u578b\u3002<\/p>\n<\/li>\n<li>\n<p>HotSpot \u5b9e\u73b0\u5c42&#xff1a; \u7406\u89e3 ClassFileParser\u3001Verifier\u3001TemplateInterpreter\u3001CompileBroker \u548c C1\/C2\u3002<\/p>\n<\/li>\n<li>\n<p>\u786c\u4ef6\u6267\u884c\u5c42&#xff1a; \u7406\u89e3\u673a\u5668\u6307\u4ee4\u3001\u5bc4\u5b58\u5668\u3001\u7f13\u5b58\u3001\u5185\u5b58\u8bbf\u95ee\u53ca CPU \u6267\u884c\u673a\u5236\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u53ea\u6709\u5c06\u8fd9\u4e09\u5c42\u8054\u7cfb\u8d77\u6765&#xff0c;\u624d\u80fd\u771f\u6b63\u7406\u89e3 Java \u7a0b\u5e8f\u4ece .class \u6587\u4ef6\u5230 CPU \u6267\u884c\u7684\u5b8c\u6574\u8fc7\u7a0b\u3002# 30-Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3-\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3-\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\u524d\u8a00Class\u6587\u4ef6\u4e2d\u7684\u5b57\u8282\u7801\u5982\u4f55\u88abJVM\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\u4e00\u3001\u5b66\u4e60\u76ee\u6807\u4e8c\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u52a0\u8f7d&#xff1f;2.1 Class \u6587\u4ef6\u7684\u57fa\u672c\u7ed3\u67842.2 \u7c7b\u52a0\u8f7d\u5668\u5982\u4f55\u83b7\u53d6 Class \u6587\u4ef6&#xff1f;2.3 HotSpot \u7c7b\u52a0\u8f7d\u6e90\u7801\u5206\u6790\u4e09\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u89e3\u6790&#xff1f;3.1 ClassFileParser \u7684\u6838\u5fc3\u804c\u8d233.2 \u5e38\u91cf\u6c60\u89e3\u6790\u6e90\u7801\u793a\u610f3.3 \u5b57\u8282\u7801\u89e3\u6790\u4e0e\u65b9\u6cd5 Code \u5c5e\u6027\u56db\u3001<\/p>\n","protected":false},"author":2,"featured_media":121080,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,174,99,426,58],"topic":[],"class_list":["post-121084","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-java","tag-jvm","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/121084.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3-\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\u524d\u8a00Class\u6587\u4ef6\u4e2d\u7684\u5b57\u8282\u7801\u5982\u4f55\u88abJVM\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\u4e00\u3001\u5b66\u4e60\u76ee\u6807\u4e8c\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u52a0\u8f7d&#xff1f;2.1 Class \u6587\u4ef6\u7684\u57fa\u672c\u7ed3\u67842.2 \u7c7b\u52a0\u8f7d\u5668\u5982\u4f55\u83b7\u53d6 Class \u6587\u4ef6&#xff1f;2.3 HotSpot \u7c7b\u52a0\u8f7d\u6e90\u7801\u5206\u6790\u4e09\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u89e3\u6790&#xff1f;3.1 ClassFileParser \u7684\u6838\u5fc3\u804c\u8d233.2 \u5e38\u91cf\u6c60\u89e3\u6790\u6e90\u7801\u793a\u610f3.3 \u5b57\u8282\u7801\u89e3\u6790\u4e0e\u65b9\u6cd5 Code \u5c5e\u6027\u56db\u3001\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/121084.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-01T18:16:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101181656-6ae7821818862.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/121084.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/121084.html\",\"name\":\"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-01T18:16:57+00:00\",\"dateModified\":\"2026-11-01T18:16:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/121084.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/121084.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/121084.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/121084.html","og_locale":"zh_CN","og_type":"article","og_title":"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3-\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\u524d\u8a00Class\u6587\u4ef6\u4e2d\u7684\u5b57\u8282\u7801\u5982\u4f55\u88abJVM\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c\u4e00\u3001\u5b66\u4e60\u76ee\u6807\u4e8c\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u52a0\u8f7d&#xff1f;2.1 Class \u6587\u4ef6\u7684\u57fa\u672c\u7ed3\u67842.2 \u7c7b\u52a0\u8f7d\u5668\u5982\u4f55\u83b7\u53d6 Class \u6587\u4ef6&#xff1f;2.3 HotSpot \u7c7b\u52a0\u8f7d\u6e90\u7801\u5206\u6790\u4e09\u3001Class \u6587\u4ef6\u5982\u4f55\u88ab JVM \u89e3\u6790&#xff1f;3.1 ClassFileParser \u7684\u6838\u5fc3\u804c\u8d233.2 \u5e38\u91cf\u6c60\u89e3\u6790\u6e90\u7801\u793a\u610f3.3 \u5b57\u8282\u7801\u89e3\u6790\u4e0e\u65b9\u6cd5 Code \u5c5e\u6027\u56db\u3001","og_url":"https:\/\/www.wsisp.com\/helps\/121084.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-01T18:16:57+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101181656-6ae7821818862.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/121084.html","url":"https:\/\/www.wsisp.com\/helps\/121084.html","name":"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-01T18:16:57+00:00","dateModified":"2026-11-01T18:16:57+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/121084.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/121084.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/121084.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Java\u5b57\u8282\u7801\u5b66\u4e60\u603b\u7ed3\uff1a\u5b57\u8282\u7801\u5982\u4f55\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u6267\u884c"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/121084","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=121084"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/121084\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/121080"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=121084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=121084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=121084"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=121084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}