![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JVM
johnjoe.xie
物来顺应,未来不迎,当时不杂,既过不恋。--曾国藩
展开
-
Java类加载之MetaIndex
MetaIndex旨在通过为jar文件中的探针提供快速拒绝机制来减少启动时间(特别是冷启动,当文件尚未进入磁盘缓存时)。元索引的磁盘表示是一个扁平文本文件,每个jar条目指示(一般来说)jar中包含的包名称的前缀。关于元索引设计的一些注意事项:它包含多个jar文件的条目。这是故意的,以减少启动期间需要执行的磁盘访问次数。它仅用作快速拒绝机制,以防止应用程序和其他类强制打开引导和扩展类路径上...原创 2019-03-22 16:35:00 · 711 阅读 · 0 评论 -
《jdk8u源码分析》16.2.ContinueInNewThread
src/share/bin/java.c::ContinueInNewThreadintContinueInNewThread(InvocationFunctions* ifn, jlong threadStackSize, int argc, char **argv, int mode, char *what, ...原创 2019-03-20 14:42:31 · 404 阅读 · 0 评论 -
《jdk8u源码分析》11.SetClassPath
src/share/bin/java.c::SetClassPathstatic voidSetClassPath(const char *s){ char *def; const char *orig = s; static const char format[] = "-Djava.class.path=%s"; /* * usually we ...原创 2019-03-20 14:32:58 · 105 阅读 · 0 评论 -
《jdk8u源码分析》7.SetJvmEnvironment
src/share/bin/java.c::SetJvmEnvironment/* * static void SetJvmEnvironment(int argc, char **argv); * Is called just before the JVM is loaded. We can set env variables * that are consumed by th...原创 2019-03-20 14:31:45 · 130 阅读 · 0 评论 -
《jdk8u源码分析》6.4.GetJVMPath
src/windows/bin/java_md.c::GetJVMPath/* * Given a JRE location and a JVM type, construct what the name the * JVM shared library will be. Return true, if such a library * exists, false otherwise....原创 2019-03-20 14:31:24 · 150 阅读 · 0 评论 -
《jdk8u源码分析》6.3.CheckJvmType ergo
src/share/bin/java.c::CheckJvmType/* * Checks the command line options to find which JVM type was * specified. If no command line option was given for the JVM type, * the default type is used. T...原创 2019-03-20 14:31:12 · 207 阅读 · 0 评论 -
《jdk8u源码分析》6.2.ReadKnownVMs
src/share/bin/java.c::ReadKnownVMs/* * Read the jvm.cfg file and fill the knownJVMs[] array. * * The functionality of the jvm.cfg file is subject to change without * notice and the mechanism will...原创 2019-03-20 14:30:20 · 270 阅读 · 0 评论 -
《jdk8u源码分析》6.1.GetJREPath
src/windows/bin/java_md.c::GetJREPath/* * Find path to JRE based on .exe's location or registry settings. */jbooleanGetJREPath(char *path, jint pathsize){ char javadll[MAXPATHLEN]; struc...原创 2019-03-20 14:29:59 · 351 阅读 · 0 评论 -
《jdk8u源码分析》5.4.ExecJRE
src/windows/bin/java_md.c::ExecJRE/* * Given a path to a jre to execute, this routine checks if this process * is indeed that jre. If not, it exec's that jre. * * We want to actually check the p...原创 2019-03-20 14:28:21 · 256 阅读 · 0 评论 -
《jdk8u源码分析》5.3.LocateJRE
src/windows/bin/java_md.c::LocateJRE/* * This is the global entry point. It examines the host for the optimal * JRE to be used by scanning a set of registry entries. This set of entries * is hard...原创 2019-03-20 14:27:53 · 250 阅读 · 0 评论 -
《jdk8u源码分析》5.2.JLI_ValidVersionString
src/share/bin/version_comp.c::JLI_ValidVersionString/* * Validates a version string by the extended JSR 56 grammar. */intJLI_ValidVersionString(char *version_string){ char *vs; ...原创 2019-03-20 14:27:25 · 217 阅读 · 0 评论 -
《jdk8u源码分析》5.1.JLI_ParseManifest
src/share/bin/parse_manifest.c::JLI_ParseManifest/* * Read the manifest from the specified jar file and fill in the manifest_info * structure with the information found within. * * Error returns ...原创 2019-03-20 14:27:10 · 264 阅读 · 0 评论 -
《jdk8u源码分析》16.2.1.RegisterThread
src/solaris/bin/java_md_solinux.c::RegisterThreadvoidRegisterThread(){ // stubbed out for windows and *nixes.}src/windows/bin/java_md.c::RegisterThreadvoidRegisterThread(){ // stubbed...原创 2019-03-20 14:41:06 · 325 阅读 · 0 评论 -
《jdk8u源码分析》16.2.2.InitializeJVM
src/share/bin/java.c::InitializeJVM/* * Initializes the Java Virtual Machine. Also frees options array when * finished. */static jbooleanInitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunc...原创 2019-03-20 14:41:16 · 183 阅读 · 0 评论 -
《jdk8u源码分析》16.2.3.ShowSettings
src/share/bin/java.c::ShowSettings/* * Prints all the Java settings, see the java implementation for more details. */static voidShowSettings(JNIEnv *env, char *optString){ jmethodID showSett...原创 2019-03-20 14:41:27 · 324 阅读 · 0 评论 -
《jdk8u源码分析》sun.misc.Launcher
sun.misc.Launcher.java@see: 8.LoadJavaVM调用JNI_CreateJavaVM时,加载属性 sun.boot.class.path 配置的包.private static String bootClassPath = System.getProperty("sun.boot.class.path"); private static cl...原创 2019-03-22 16:09:19 · 1276 阅读 · 0 评论 -
《jdk8u源码分析》JNI_CreateJavaVM & DestroyJavaVM 详解
摘录自《Java性能优化权威指南》第3章 JVM概览3.2 HotSpot VM运行时3.2.2 VM生命周期 HotSpot VM 启动时JNI_CreateJavaVM方法将执行以下一系列操作。 (1)确保只有一个线程调用这个方法并且确保只创建一个HotSpot VM实例。因为HotSpot VM创建的静态数据结构无法再次初始化,所以一旦初始化到达某个确定点后,进程空间里就只能...转载 2019-03-20 15:41:37 · 3388 阅读 · 0 评论 -
《jdk8u源码分析》14.SetJavaLauncherProp
src/share/bin/java.c::SetJavaLauncherProp/* * JVM would like to know if it's created by a standard Sun launcher, or by * user native application, the following property indicates the former. */vo...原创 2019-03-20 14:37:43 · 125 阅读 · 0 评论 -
《jdk8u源码分析》jvm.dll接口列表
通过命令行工具 VS2012 ARM Cross Tools Command Prompt 执行命令:dumpbin /exports "C:\Tools\Java\jre1.8.0_191\bin\server\jvm.dll">>D:\jvmdll.txtjvmdll.txtMicrosoft (R) COFF/PE Dumper Version 11.00.51106.1...原创 2019-03-20 14:40:04 · 27713 阅读 · 0 评论 -
《jdk8u源码分析》16.2.10.CreateApplicationArgs
src/solaris/bin/java_md_common.c::CreateApplicationArgsjobjectArrayCreateApplicationArgs(JNIEnv *env, char **strv, int argc){ return NewPlatformStringArray(env, strv, argc);}src/windows/bin/...原创 2019-03-20 14:42:20 · 148 阅读 · 0 评论 -
《jdk8u源码分析》16.2.9.PostJVMInit
src/solaris/bin/java_md_solinux.c::PostJVMInit (linux)voidPostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm){ // stubbed out for windows and *nixes.}src/windows/bin/java_md.c::PostJVMIn...原创 2019-03-20 14:42:12 · 164 阅读 · 0 评论 -
《jdk8u源码分析》16.2.8.GetApplicationClass
src/share/bin/java.c::GetApplicationClassstatic jclassGetApplicationClass(JNIEnv *env){ jmethodID mid; jobject result; jclass cls = GetLauncherHelperClass(env); NULL_CHECK0(cls); ...原创 2019-03-20 14:42:06 · 108 阅读 · 0 评论 -
《jdk8u源码分析》16.2.7.LoadMainClass
src/share/bin/java.c::LoadMainClass/* * Loads a class and verifies that the main class is present and it is ok to * call it for more details refer to the java implementation. */static jclassLoad...原创 2019-03-20 14:41:59 · 287 阅读 · 0 评论 -
《jdk8u源码分析》16.2.6.FreeKnownVMs
src/share/bin/java.c::FreeKnownVMsstatic voidFreeKnownVMs(){ int i; for (i = 0; i < knownVMsCount; i++) { JLI_MemFree(knownVMs[i].name); knownVMs[i].name = NULL; } ...原创 2019-03-20 14:41:53 · 107 阅读 · 0 评论 -
《jdk8u源码分析》16.2.5.PrintUsage
src/share/bin/java.c::PrintUsage/* * Prints default usage or the Xusage message, see sun.launcher.LauncherHelper.java */static voidPrintUsage(JNIEnv* env, jboolean doXUsage){ jmethodID initHel...原创 2019-03-20 14:41:45 · 186 阅读 · 0 评论 -
《jdk8u源码分析》16.2.4.PrintJavaVersion
src/share/bin/java.c::PrintJavaVersion/* * Prints the version information from the java.version and other properties. */static voidPrintJavaVersion(JNIEnv *env, jboolean extraLF){ jclass ver...原创 2019-03-20 14:41:35 · 121 阅读 · 0 评论 -
《jdk8u源码分析》5.SelectVersion
src/share/bin/java.c::SelectVersion/* * The SelectVersion() routine ensures that an appropriate version of * the JRE is running. The specification for the appropriate version * is obtained from e...原创 2019-03-20 14:26:45 · 302 阅读 · 0 评论 -
《jdk8u源码分析》4.DumpState
src/share/bin/java.c::DumpStatestatic voidDumpState(){ if (!JLI_IsTraceLauncher()) return ; printf(&amp;quot;Launcher state:\n&amp;quot;); printf(&amp;quot;\tdebug:%s\n&amp;quot;, (JLI_IsTraceLauncher() == JNI原创 2019-03-20 14:25:35 · 286 阅读 · 0 评论 -
《jdk8u源码分析》jli_util.c
src/share/bin/jli_util.c/* * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free sof...原创 2019-03-20 14:21:30 · 307 阅读 · 0 评论 -
《jdk8u源码分析》jli_util.h
src/share/bin/jli_util.h/* * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free sof...原创 2019-03-20 14:22:29 · 278 阅读 · 0 评论 -
JVM性能调优监控工具 - jdb
jdbserver: - JDK 9 or later:-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 - JDK 5 - 8:-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 - JDK 1.4.x...原创 2019-02-26 11:42:09 · 381 阅读 · 0 评论 -
JVM性能调优监控工具 - jps
jps - Java Virtual Machine Process Status Tool查看虚拟机进程jps [options] [hostid][options]:-q -- 忽略输出的类名、jar名以及传递给main方法的参数,只输出pid-m -- 输出传递给main方法的参数,如果是内嵌的JVM则输出为nu...原创 2019-02-25 15:56:29 · 186 阅读 · 0 评论 -
JVM性能调优监控工具 - jstack
jstack - Java Stack Trace打印指定Java进程的线程堆栈信息jstack [-l] &amp;lt;pid&amp;gt;jstack -F [-m] [-l] &amp;lt;pid&amp;gt;jstack [-m] [-l] &amp;lt;executable&amp;gt; &amp;lt;core&amp;gt;jstack [-m]原创 2019-02-25 16:02:13 · 159 阅读 · 0 评论 -
JVM性能调优监控工具 - javap
javap反编译查看java字节码javap &amp;lt;options&amp;gt; &amp;lt;classes&amp;gt;javap -c HelloWorld.classjavap -verbose Test.class原创 2019-02-25 16:06:28 · 198 阅读 · 0 评论 -
JVM性能调优监控工具 - jinfo
jinfo - Java Configuration Infojinfo [option] &lt;pid&gt;jinfo [option] &lt;executable &lt;core&gt;jinfo [option] [server_id@]&lt;remote server IP or hostname&gt;[options]-flag &lt;name&原创 2019-02-25 16:11:01 · 136 阅读 · 0 评论 -
JVM性能调优监控工具 - jstat
jstat - Java Virtual Machine Statistics Monitoring Tool监控基于HotSpot的JVM,对其堆的使用情况进行实时的命令行的统计jstat -help|-optionsjstat -&lt;option&gt; [-t] [-h&lt;lines&gt;] &lt;vmid&gt; [&lt;interval&gt; [&a原创 2019-02-25 16:19:10 · 432 阅读 · 0 评论 -
JVM性能调优监控工具 - jmap
jmap - Java Memory Map打印指定Java进程的共享对象内存映射或堆内存细节(dump文件)jmap [option] &lt;pid&gt;jmap [option] [server_id@]&lt;remote server IP or hostname&gt;[options]-heap -- 打印heap的概要信息,GC使用的算法,...原创 2019-02-25 16:21:52 · 134 阅读 · 0 评论 -
JVM性能调优监控工具 - jhat
jhat - Java Heap Analyse Tool分析java堆(dump文件),可以将堆中的对象以html的形式显示出来,包括对象的数量,大小等等,并支持对象查询语言jhat [-stack &lt;bool&gt;] [-refs &lt;bool&gt;] [-port &lt;port&gt;] [-baseline &lt;file&gt;] [-debug原创 2019-02-25 16:23:01 · 226 阅读 · 0 评论 -
JVM性能调优监控工具 - hprof
hprofjava -agentlib:hprof[=options] ToBeProfiledClass//java -Xrunprof[:options] ToBeProfiledClassjavac -J-agentlib:hprof[=options] ToBeProfiledClassHPROF: Heap and CPU Profiling Agent (JVMTI Demo...原创 2019-02-25 16:24:28 · 318 阅读 · 0 评论 -
《jdk8u源码分析》mpi.h
src/share/native/sun/security/ec/impl/mpi.h/* * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * This library is free software; ...原创 2019-03-20 14:21:56 · 336 阅读 · 0 评论