Skip to content

Instantly share code, notes, and snippets.

Avatar

Kris Mok rednaxelafx

View GitHub Profile
View JDK 6 update 23, client, Windows x86
[Global flags]
uintx AdaptivePermSizeWeight = 20 {product}
uintx AdaptiveSizeDecrementScaleFactor = 4 {product}
uintx AdaptiveSizeMajorGCDecayTimeScale = 10 {product}
uintx AdaptiveSizePausePolicy = 0 {product}
uintx AdaptiveSizePolicyCollectionCostMargin = 50 {product}
uintx AdaptiveSizePolicyInitializingSteps = 20 {product}
uintx AdaptiveSizePolicyOutputInterval = 0 {product}
uintx AdaptiveSizePolicyWeight = 10 {product}
uintx AdaptiveSizeThroughPutPolicy = 0 {product}
@rednaxelafx
rednaxelafx / PrintThreadIds.java
Created Feb 25, 2011
find out the correspondence between the tid/nid of Java threads as shown from jstack/JMX, on HotSpot/Linux
View PrintThreadIds.java
package fx.jvm.hotspot.tools;
import java.util.List;
import sun.jvm.hotspot.tools.Tool;
public class PrintThreadIds extends Tool {
public static void main(String[] args) {
PrintThreadIds tool = new PrintThreadIds();
tool.start(args);
@rednaxelafx
rednaxelafx / F.java
Created Mar 7, 2011
show how the same Class file loaded by two classloaders become "incompatible"
View F.java
import java.io.*;
import java.net.*;
public class F {
static F instance;
public static void main(String[] args) throws Exception {
ClassLoader l = new URLClassLoader(new URL[] { new File(".").toURI().toURL()}, null);
Class<?> clazz = l.loadClass("F");
F.class.getDeclaredField("instance").set(null, clazz.newInstance());
@rednaxelafx
rednaxelafx / TestStackOpsMain.java
Created Mar 26, 2011
Hack HotSpot's interpreter with return stack shellcode. Requires JRuby and BiteScript to build, works on WinXP 32-bit only. If run under a SecurityManager then it'll be caught and a security exception will be thrown before it wrecks havoc; it's configured
View TestStackOpsMain.java
public class TestStackOpsMain {
public static void main(String[] args) {
// refer to earlier blog post, http://rednaxelafx.javaeye.com/blog/461787
byte[] code = {
// CODE SECTION
// push ebp
0x55,
// mov ebp,esp
(byte) 0x8B, (byte) 0xEC,
// push -0B ; /DevType = STD_OUTPUT_HANDLE
@rednaxelafx
rednaxelafx / demo.groovy
Created Apr 6, 2011
get properties from an object in Groovy, even when the object has an getProperties() method
View demo.groovy
def getPropertiesFrom(obj) {
obj.metaClass.properties.findAll { it.name != 'class' && it.name != 'metaClass' }.inject([:]) { acc, e -> acc[e.name] = e.getProperty(obj); acc }
}
class Foo {
int getBar() { 42; }
List getProperties() { [] }
}
def foo = new Foo();
foo.properties; //=> []
@rednaxelafx
rednaxelafx / jdk6u24_x86_server_Xint_interpreter.txt
Created Apr 18, 2011
difference in the generated interpreter between "-server -Xint" and "-client -Xint" HotSpot VMs (JDK6u24)
View jdk6u24_x86_server_Xint_interpreter.txt
----------------------------------------------------------------------
Interpreter
code size = 65K bytes
total space = 167K bytes
wasted space = 102K bytes
# of codelets = 258
avg codelet size = 258 bytes
@rednaxelafx
rednaxelafx / jdk6u24_x86_client_Xint_interpreter.txt
Created Apr 18, 2011
difference in the generated interpreter between "-server -Xint" and "-client -Xint" HotSpot VMs (JDK6u24)
View jdk6u24_x86_client_Xint_interpreter.txt
----------------------------------------------------------------------
Interpreter
code size = 56K bytes
total space = 167K bytes
wasted space = 111K bytes
# of codelets = 258
avg codelet size = 224 bytes
@rednaxelafx
rednaxelafx / jdk6u24_x86_client_Xint_flags.txt
Created Apr 18, 2011
difference in the ergonomics between "-server -Xint" and "-client -Xint" HotSpot VMs (JDK6u24)
View jdk6u24_x86_client_Xint_flags.txt
[Global flags]
uintx AdaptivePermSizeWeight = 20 {product}
uintx AdaptiveSizeDecrementScaleFactor = 4 {product}
uintx AdaptiveSizeMajorGCDecayTimeScale = 10 {product}
uintx AdaptiveSizePausePolicy = 0 {product}
uintx AdaptiveSizePolicyCollectionCostMargin = 50 {product}
uintx AdaptiveSizePolicyInitializingSteps = 20 {product}
uintx AdaptiveSizePolicyOutputInterval = 0 {product}
uintx AdaptiveSizePolicyWeight = 10 {product}
uintx AdaptiveSizeThroughPutPolicy = 0 {product}
@rednaxelafx
rednaxelafx / gist:925044
Created Apr 18, 2011
example: make a NoClassDefFoundError without a class name in the message
View gist:925044
[sajia@sajia ~]$ java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
@rednaxelafx
rednaxelafx / gist:925323
Last active Jul 2, 2020
Correspondence between Sun/Oracle JDK, OpenJDK and HotSpot VM versions
View gist:925323

Correspondence between Sun/Oracle JDK, OpenJDK and HotSpot VM versions

build date Sun/Oracle JDK Version OpenJDK Version HotSpot VM Version
2006-11-29 1.6.0-b105 1.6.0-b105
2007-03-14 1.6.0_01-b06 1.6.0_01-b06
2007-06-22 1.6.0_02-b05 1.6.0_02-b05
2007-09-24 1.6.0_03-b05 1.6.0_03-b05
2007-12-14 1.6.0_04-b12 10.0-b19