1 Star 0 Fork 81

wangyangdahai/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
optimize-jmap-F-dump-xxx.patch 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
From 675360f4912dad7eeeac4b6a05b782dca234c008 Mon Sep 17 00:00:00 2001
Date: Fri, 22 Jan 2021 16:16:57 +0800
Subject: optimize jmap -F -dump:xxx
Summary: optimize jmap -F -dump:xxx to speed up the dump process
LLT: N/A
Bug url: N/A
---
.../share/classes/sun/jvm/hotspot/oops/Metadata.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Metadata.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Metadata.java
index 4fc2ed8c6..2e56d2708 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Metadata.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Metadata.java
@@ -45,6 +45,7 @@ abstract public class Metadata extends VMObject {
}
private static VirtualBaseConstructor<Metadata> metadataConstructor;
+ private static Map map = new HashMap();
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
metadataConstructor = new VirtualBaseConstructor<Metadata>(db, db.lookupType("Metadata"), null, null);
@@ -65,7 +66,14 @@ abstract public class Metadata extends VMObject {
}
public static Metadata instantiateWrapperFor(Address addr) {
- return metadataConstructor.instantiateWrapperFor(addr);
+ Metadata metadata;
+ if (!map.containsKey(addr)) {
+ metadata = metadataConstructor.instantiateWrapperFor(addr);
+ map.put(addr, metadata);
+ } else {
+ metadata = (Metadata)map.get(addr);
+ }
+ return metadata;
}
public void iterate(MetadataVisitor visitor) {
--
2.19.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangyangdahai/openjdk-1.8.0.git
git@gitee.com:wangyangdahai/openjdk-1.8.0.git
wangyangdahai
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助