Oop Maps在Hotspot VM中的含义是什么? [英] What does Oop Maps means in Hotspot VM exactly

查看:244
本文介绍了Oop Maps在Hotspot VM中的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从一些文档中读到,Hotspot VM利用名为Oop Maps的数据结构来管理VM中的所有OOP。我的问题是,这个Oop Map数据结构何时生成?在编译时还是运行时?任何有关此问题的进一步详细文件都将受到欢迎。谢谢你们。

I read from some documents that Hotspot VM utilizes a data structure called Oop Maps to manage all OOPs in VM. My question is that when does this Oop Map data structure generated? At compile time or runtime? Any further detailed documents regarding to this will be more than welcomed. Thank you guys.

推荐答案

OopMap是一个记录对象引用(OOP)位于Java堆栈中的结构。它的主要目的是在Java堆栈中找到GC根目录,并在堆中移动对象时更新引用。

OopMap is a structure that records where object references (OOPs) are located on the Java stack. Its primary purpose is to find GC roots on Java stacks and to update the references whenever objects are moved within the Heap.

有三种OopMaps:

There are three kinds of OopMaps:


  1. 解释方法的OopMaps 。它们是懒惰地计算的,即当GC发生时,通过分析字节码流来计算。最好的参考是源代码(有很多注释),参见 generateOopMap.cpp 。 InterpreterOopMaps存储在 OopMapCache

  2. 用于 JIT编译方法的OopMaps 。它们是在JIT编译期间生成的,并与编译后的代码一起保存,以便VM可以通过指令地址快速查找堆栈位置和保存对象引用的寄存器。

  3. 生成的OopMaps 共享运行时存根。这些映射由开发人员手动构建 - 这些运行时存根的作者。

  1. OopMaps for interpreted methods. They are computed lazily, i.e. when GC happens, by analyzing bytecode flow. The best reference is the source code (with lots of comments), see generateOopMap.cpp. InterpreterOopMaps are stored in OopMapCache.
  2. OopMaps for JIT-compiled methods. They are generated during JIT-compilation and kept along with the compiled code so that VM can quickly find by instruction address the stack locations and the registers where the object references are held.
  3. OopMaps for generated shared runtime stubs. These maps are constructed manually by the developers - authors of these runtime stubs.

在GC期间JVM遍历所有线程堆栈。每个堆栈都被解析为堆栈帧流。帧可以是解释或编译的,也可以是存根。解释的帧包含有关Java方法和bci(字节码索引)的信息。 OopMapCache有助于找到与给定方法和bci相对应的OopMap。通过指令地址查找发现编译帧的方法。

During GC JVM walks through all thread stacks. Each stack is parsed as a stream of stack frames. The frames are either interpreted or compiled or stubs. Interpreted frames contain information about Java method and bci (bytecode index). OopMapCache helps to find an OopMap corresponding to the given method and bci. The method of a compiled frame is discovered by instruction address lookup.

这篇关于Oop Maps在Hotspot VM中的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆