1.首先下载hsdis-amd64.dll文件
零积分下载地址:/download/Kevinnsm/54740576
2.解压放到java11\bin\server
3.准备一段Java代码
public class Visibility {private static volatile boolean flag = true;public static void main(String[] args) throws InterruptedException {new Thread(() -> {while (flag) {}}).start();TimeUnit.SECONDS.sleep(1);new Thread(() -> {flag = false;System.out.println(Thread.currentThread().getName() + "线程将flag修改为了false!");}).start();}}
4.配置参数
-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
5.运行代码