Skip to content

Instantly share code, notes, and snippets.

@ytoshima
ytoshima / interp.dump.txt
Created October 22, 2011 01:06
A gdb macro which dumps java7 HotSpot JVM linux/32-bit interpreter codelets and an output
AbstractInterpreter::_code : StubQueue * = 0xb49150c0
_stub_buffer : 0xb6f7a6c0
_number_of_stubs: 0x103
Codelet @ 0xb6f7a6c0 128 -1 0xffffffff 0x10c81a1: "slow signature handler"
Dump of assembler code from 0xb6f7a6e0 to 0xb6f7a740:
0xb6f7a6e0: mov %esp,%ecx
0xb6f7a6e2: call 0xb6f7a6ec
0xb6f7a6e7: jmp 0xb6f7a73f
0xb6f7a6ec: push %ecx
0xb6f7a6ed: push %edi
@ytoshima
ytoshima / C2-IR-Node-Classes
Created November 16, 2011 08:50
C2 IR Node classes
Node
AbsNode
AbsDNode
AbsFNode
AbsINode
AddNode
AddDNode
AddFNode
AddINode
AddLNode
@ytoshima
ytoshima / PrintIdealGraphFile-output-example.xml
Created November 16, 2011 08:56
PrintIdealGraphFile output example
<graphDocument>
<group>
<properties>
<p name="name"> virtual jint Call.doit()</p>
</properties>
<graph name="Bytecode 0: aload_0">
<nodes>
<node id="159337448">
<properties>
<p name="name"> Root</p>
@ytoshima
ytoshima / gist:1369656
Created November 16, 2011 09:17
PrintIdeal PrintCompilation output example
$ ~/jdk1.7.0-b147/fastdebug/bin/java -XX:+PrintCompilation -XX:+PrintIdeal -XX:CICompilerCount=1 sum
214 1 sum::doit (22 bytes)
VM option '+PrintCompilation'
VM option '+PrintIdeal'
VM option 'CICompilerCount=1'
21 ConI === 0 [[ 180 ]] #int:0
180 Phi === 184 21 70 [[ 179 ]] #int !orig=[159],[139],[66] !jvms:
sum::doit @ bci:10
179 AddI === _ 180 181 [[ 178 ]] !orig=[154],[137],70,[145] !jvms: su
@ytoshima
ytoshima / gist:1369697
Created November 16, 2011 09:46
TraceOptoParse output example
static int doit();
flags: ACC_STATIC
Code:
stack=2, locals=2, args_size=0
0: iconst_0
1: istore_0
2: iconst_0
3: istore_1
4: iload_1
5: bipush 100
@ytoshima
ytoshima / sum.java
Created November 18, 2011 16:02
PrintOptoAssembly output example
// -XX::CompileOnly=sum::doit would narrow down the method to compile, but it
// is not used here.
$ ~/jdk1.7.0-b147/fastdebug/bin/java -XX:+PrintOptoAssembly sum
VM option '+PrintOptoAssembly'
{method}
- klass: {other class}
- this oop: 0x911f8110
- method holder: 'sum'
- constants: 0x911f7e10 constant pool [32] for 'sum' cache=0x911f86b0
@ytoshima
ytoshima / c1-result.txt
Created November 18, 2011 16:39
Code comparison between C1 and C2
C1
$ ~/jdk1.7.0-b147/fastdebug/bin/java -XX:CompileOnly=gvnex::doHashSum -XX:+PrintLIR -client gvnex
VM option 'CompileOnly=gvnex::doHashSum'
VM option '+PrintLIR'
CompileOnly: compileonly *gvnex*.doHashSum
LIR:
B1 [0, 0] sux: B0
__id_Instruction___________________________________________
0 label [label:0x939c62c]
@ytoshima
ytoshima / gist:1381429
Created November 21, 2011 02:22
PrintEscapeAnalysis output example
$ ~/local/jdk1.7.0-b147/fastdebug/bin/java -XX:+Verbose -XX:+PrintEscapeAnalysis -jar ~/local/jdk1.6.0_26/demo/jfc/Java2D/Java2Demo.jar
VM option '+Verbose'
VM option '+PrintEscapeAnalysis'
======== Connection graph for java.util.Properties$LineReader::readLine
519 JavaObject GlobalEscape NSR [[ 578F 589F 623F 624F 452F 468F 469F 602F 606F]] 519 AllocateArray === 503 199 501 8 1 ( 517 506 512 505 10 438 281 22 65 22 384 68 22 1 1 ) [[ 520 521 522 529 530 531 ]] rawptr:NotNull ( int:>=0, java/lang/Object:NotNull *, bool, int ) java.util.Properties$LineReader::readLine @ bci:286 Type:{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:rawptr:NotNull} !jvms: java.util.Properties$LineReader::readLine @ bci:286
LocalVar [[ 519P]] 531 Proj === 519 [[ 532 536 ]] #5 Type:rawptr:NotNull !jvms: java.util.Properties$LineReader::readLine @ bci:286
LocalVar [[ 519P]] 536 CheckCastPP === 533 531 [[ 655 678 655 624 578 578 589 589 624 623 ]] Type:char[i
@ytoshima
ytoshima / JniEx.cpp
Created February 2, 2012 17:41
Simple JNI examples for certain crashes
#include "JniEx.h"
#include <stdlib.h>
void bad_func()
{
int *ip = (int*)0xbffffffe;
*ip = 1;
}
JNIEXPORT void JNICALL Java_JniEx_crash (JNIEnv *env, jclass cls) {
@ytoshima
ytoshima / gist:1814611
Created February 13, 2012 07:27
TraceMethodHandles sample output
$ ~/local/jdk1.7.0-b147/fastdebug/bin/java -cp classes:lib/asm-4.0.jar name.yt.icache.Pet
D: bsm: type: (Object)void
D: bsm: fallback: MethodHandle(Object)void
D: bsm: fallback: MethodHandle(Object)void
D: fallback: type: (Object)void
D: fallback: type.dropParameterTypes(0,1): ()void
D: fallback: receiverClass: class name.yt.icache.Cat
D: fallback: target: MethodHandle(Cat)void
D: fallback: target after asType: MethodHandle(Object)void
D: fallback: test: MethodHandle(Object)boolean