Skip to content

Instantly share code, notes, and snippets.

View navyxliu's full-sized avatar
🍉
watermelon

xin liu navyxliu

🍉
watermelon
View GitHub Profile
@navyxliu
navyxliu / java.util.Properties::getProperty
Last active November 22, 2019 19:52
recursive restriction for SPECjvm2008.compiler
recursive case.
4390 358 com.sun.tools.javac.comp.Resolve::findMemberType (277 bytes)
@ 8 com.sun.tools.javac.code.Symbol$ClassSymbol::members (16 bytes) inline (hot)
\-> TypeProfile (5649/5649 counts) = com/sun/tools/javac/code/Symbol$ClassSymbol
@ 12 com.sun.tools.javac.code.Scope::lookup (43 bytes) inline (hot)
\-> TypeProfile (5649/5649 counts) = com/sun/tools/javac/code/Scope
@ 34 com.sun.tools.javac.code.Scope$Entry::access$000 (5 bytes) accessor
@ 45 com.sun.tools.javac.comp.Resolve::isAccessible (327 bytes) hot method too big
@ 94 com.sun.tools.javac.code.Types::supertype (12 bytes) inline (hot)
1. git clone https://github.com/navyxliu/JavaGCworkload.git
2. sh -x ./runJava.sh 4g gc.log -XX:+UnlockExperimentalVMOptions -XX:G1LogLevel=finest -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=8 -XX:GCLogFileSize=16k $*
3. the testcase itself is in infinite mode(-1). Usually, hotspot crashes in 4 hours.
I found jdk8u/hotspot could crash on a varienty of systems.
eg. I got this hs_err_report on AL2012. it has glibc 2.12. btw, AL2012 is similar to RHEL6
The message looks very similiar to JDK-8190798 and JDK-8191393
#
@navyxliu
navyxliu / gist:6df98f8dfef948ca2b3ea428794faa75
Last active April 17, 2020 22:11
intrinsic _getInt nullifies the unsafe access
$cat TestHaltNode.java
import jdk.internal.misc.Unsafe;
public class TestHaltNode {
static final Unsafe UNSAFE = Unsafe.getUnsafe();
static boolean f;
static int address;
private static int getAddress() {
return address;
@navyxliu
navyxliu / linkedlist.cpp
Created April 25, 2020 23:56
doubly linkedlist with a dummy node. it can simplify implementation.
void breakpoint() {
exit(-1);
}
struct node {
friend class linkedlist;
int key;
int value;
node* prev, * next;
@navyxliu
navyxliu / tasks.json
Created April 28, 2020 22:05
hotspot development tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "reconfigure",
"type": "shell",
"command": "make reconfigure CONF=linux-x86_64-server-fastdebug LOG=info",
"problemMatcher": [],
//java -XX:+PrintCompilation -XX:CompileOnly=OSR::main -XX:CompileCommand=quiet -XX:-TieredCompilation OSR
import java.io.FileWriter; // Import the FileWriter class
import java.io.IOException; // Import the IOException class to handle errors
class OSR {
public static void main(String[] args) throws IOException {
FileWriter writer = new FileWriter("/dev/null");
for (int i=0; i<3_000_000; ++i) {
writer.write(".");
### Keybase proof
I hereby claim:
* I am navyxliu on github.
* I am xliu (https://keybase.io/xliu) on keybase.
* I have a public key whose fingerprint is FD6D CB16 0216 060A 4F5D B218 B9D9 34C6 1E04 7B0D
To claim this, I am signing this object:
@navyxliu
navyxliu / OOMEInThread.java
Last active August 27, 2021 17:06
OOMEInThread
//jdk9+ java -XX:+UnlockDiagnosticVMOptions -XX:AbortVMOnException=java.lang.OutOfMemoryError OOMEInThread
// OutOfMemoryError is an unchecked exception. please note that even it keeps throwing,
// it only terminates a thread but not the java process. the following command shows that OnOutOfMemoryError
// fails to react OOME from java and get stuck forever.
//
public class OOMEInThread {
public static void main(String[] args) {
String msg = "a long long message.";
// write your code here
@navyxliu
navyxliu / scores.rb
Last active July 21, 2022 00:47
scores.rb
#!/usr/bin/env ruby
# do the statistics of renaissance results
#
# probably should choose gem 'enumerable-statistics' in the future.
# so far, we only need simple procedures.
#
def median(a)
copy = a.sort
return copy[a.size / 2]
@navyxliu
navyxliu / PartialEATest.java
Created September 23, 2022 19:50
PartialEATest.java
package com.amazon.jdkteam;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;