Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
Created August 21, 2012 17:03
Show Gist options
  • Save rednaxelafx/3417338 to your computer and use it in GitHub Desktop.
Save rednaxelafx/3417338 to your computer and use it in GitHub Desktop.
If a CompilerThread is not compiling anything, its env() will be null; same reflected in SA. No problem.
$ $JAVA_HOME/bin/java -version
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
$ jps
15245 JConsole
15269 Jps
$ sudo $JAVA_HOME/bin/java -cp $JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB
hsdb> attach 15245
Attaching to process 15245, please wait...
hsdb> dumpideal -a
sun.jvm.hotspot.runtime.CompilerThread@0x00007f76e40ec000
not compiling
sun.jvm.hotspot.runtime.CompilerThread@0x00007f76e40e9800
not compiling
hsdb> jseval "ct = sapkg.runtime.CompilerThread(any2addr(0x00007f76e40ec000))"
sun.jvm.hotspot.runtime.CompilerThread@0x00007f76e40ec000
hsdb> jseval "ct.env()" //=> null
hsdb> jseval "c = ct.getClass()"
class sun.jvm.hotspot.runtime.CompilerThread
hsdb> jseval "f = c.getDeclaredField('_env_field')"
private static sun.jvm.hotspot.types.AddressField sun.jvm.hotspot.runtime.CompilerThread._env_field
hsdb> jseval "f.setAccessible(true)"
hsdb> jseval "a = f.get(ct)"
sun.jvm.hotspot.types.basic.BasicAddressFieldWrapper@63a4c4cb
hsdb> jseval "c = a.getClass()"
class sun.jvm.hotspot.types.basic.BasicAddressFieldWrapper
hsdb> jseval "f = c.getSuperclass()"
class sun.jvm.hotspot.types.basic.BasicFieldWrapper
hsdb> jseval "f = f.getDeclaredField('field')"
protected sun.jvm.hotspot.types.Field sun.jvm.hotspot.types.basic.BasicFieldWrapper.field
hsdb> jseval "f.setAccessible(true)"
hsdb> jseval "f.get(a)"
sun.jvm.hotspot.types.basic.BasicField@357185c8
hsdb> jseval "a = f.get(a)"
sun.jvm.hotspot.types.basic.BasicField@357185c8
hsdb> jseval "a.getOffset()"
928.0
hsdb> jseval "a.isStatic()"
hsdb> jseval "a.getAddress(any2addr(0x00007f76e40ec000))"
hsdb> mem 0x00007f76e40ec000 200
0x00007f76e40ec000: 0x00007f76e9dadbb0
0x00007f76e40ec008: 0x0000000000000000
0x00007f76e40ec010: 0x0000000000000000
0x00007f76e40ec018: 0x0000000000000000
0x00007f76e40ec020: 0x00007f76e40ebf20
0x00007f76e40ec028: 0x00007f76e40ecee0
0x00007f76e40ec030: 0x0000000000000000
0x00007f76e40ec038: 0x00007f76a80008f0
0x00007f76e40ec040: 0x00007f76a8000a30
0x00007f76e40ec048: 0x00007f76d6412b70
0x00007f76e40ec050: 0x0000000000000000
0x00007f76e40ec058: 0x0000000000000000
0x00007f76e40ec060: 0x0000000000000000
0x00007f76e40ec068: 0x0000000000000000
0x00007f76e40ec070: 0x0000000000000000
0x00007f76e40ec078: 0x00000000000027b0
0x00007f76e40ec080: 0x000000000000009e
0x00007f76e40ec088: 0x0000000000000000
0x00007f76e40ec090: 0x0000000000000000
0x00007f76e40ec098: 0x3f0334e800000000
0x00007f76e40ec0a0: 0x0000002300000002
0x00007f76e40ec0a8: 0x000000003ccd8f7d
0x00007f76e40ec0b0: 0x00000000000003a0
0x00007f76e40ec0b8: 0x0000000000000000
0x00007f76e40ec0c0: 0x0000000000000000
0x00007f76e40ec0c8: 0x0000000000000000
0x00007f76e40ec0d0: 0x0000000000000001
0x00007f76e40ec0d8: 0x0000000000000000
0x00007f76e40ec0e0: 0x00007f76b8003b60
0x00007f76e40ec0e8: 0x000000310000000f
0x00007f76e40ec0f0: 0x0000000000000000
0x00007f76e40ec0f8: 0x0000000000000000
0x00007f76e40ec100: 0x00007f76e40ed8c0
0x00007f76e40ec108: 0x00007f76e40130e0
0x00007f76e40ec110: 0x00007f76e4013500
0x00007f76e40ec118: 0x00007f76d6414000
0x00007f76e40ec120: 0x0000000000101000
0x00007f76e40ec128: 0x0000000000000000
0x00007f76e40ec130: 0x00000000ffffffff
0x00007f76e40ec138: 0x0000000000000000
0x00007f76e40ec140: 0x0000000000002bad
0x00007f76e40ec148: 0x00007f76e40ed000
0x00007f76e40ec150: 0x00007f76e40ed200
0x00007f76e40ec158: 0x00007f76e40ed400
0x00007f76e40ec160: 0x00007f76e40ed600
0x00007f76e40ec168: 0x0000000000000000
0x00007f76e40ec170: 0x7434600d104aa1ad
0x00007f76e40ec178: 0x0000876732378fc7
0x00007f76e40ec180: 0x0000000000000000
0x00007f76e40ec188: 0x0000000000000000
0x00007f76e40ec190: 0x0000000000000000
0x00007f76e40ec198: 0x000000005f9218f7
0x00007f76e40ec1a0: 0x0000000000000000
0x00007f76e40ec1a8: 0x00007f76e40e9800
0x00007f76e40ec1b0: 0x0000000785143310
0x00007f76e40ec1b8: 0x0000000000000000
0x00007f76e40ec1c0: 0x0000000000000000
0x00007f76e40ec1c8: 0x0000000000000000
0x00007f76e40ec1d0: 0x00007f76e9951260
0x00007f76e40ec1d8: 0x00007f76e9dc35c0
0x00007f76e40ec1e0: 0x0000000000000000
0x00007f76e40ec1e8: 0x0000000000000000
0x00007f76e40ec1f0: 0x0000000000000000
0x00007f76e40ec1f8: 0x0000000000000000
0x00007f76e40ec200: 0x0000000000000000
0x00007f76e40ec208: 0x0000000000000000
0x00007f76e40ec210: 0x0000000000000000
0x00007f76e40ec218: 0x0000000000000000
0x00007f76e40ec220: 0x0000000000000000
0x00007f76e40ec228: 0x0000000000000000
0x00007f76e40ec230: 0x0000000000000000
0x00007f76e40ec238: 0x0000000000000000
0x00007f76e40ec240: 0x0000000000000000
0x00007f76e40ec248: 0x0000000000000000
0x00007f76e40ec250: 0x000000000000000a
0x00007f76e40ec258: 0x00007f76e4013570
0x00007f76e40ec260: 0x0000000000000000
0x00007f76e40ec268: 0x000000000000deab
0x00007f76e40ec270: 0x0000000000000000
0x00007f76e40ec278: 0x0000000200000001
0x00007f76e40ec280: 0x0000000000000000
0x00007f76e40ec288: 0x0000000000000000
0x00007f76e40ec290: 0x0000000000000000
0x00007f76e40ec298: 0x0000000000000000
0x00007f76e40ec2a0: 0x0000000000000000
0x00007f76e40ec2a8: 0x0000000000000000
0x00007f76e40ec2b0: 0x00007f76e9dabeb0
0x00007f76e40ec2b8: 0x00007f76e9dfdf20
0x00007f76e40ec2c0: 0x0000000000000000
0x00007f76e40ec2c8: 0x0000000000000000
0x00007f76e40ec2d0: 0x0000000000000000
0x00007f76e40ec2d8: 0x0000000000000000
0x00007f76e40ec2e0: 0x0000000000000000
0x00007f76e40ec2e8: 0x0000000000000000
0x00007f76e40ec2f0: 0x00007f76e9d9dc50
0x00007f76e40ec2f8: 0x00007f76e9dfdfe0
0x00007f76e40ec300: 0x0000000000000001
0x00007f76e40ec308: 0x0000000000000000
0x00007f76e40ec310: 0x0000000000000000
0x00007f76e40ec318: 0x0000000000000000
0x00007f76e40ec320: 0x0000000000000000
0x00007f76e40ec328: 0x0000000000000000
0x00007f76e40ec330: 0x0000000000000000
0x00007f76e40ec338: 0x0000000000000000
0x00007f76e40ec340: 0x0000000000000000
0x00007f76e40ec348: 0x0000000000000000
0x00007f76e40ec350: 0x0000000000000000
0x00007f76e40ec358: 0x0000000000000000
0x00007f76e40ec360: 0x0000000000000000
0x00007f76e40ec368: 0x0000000000000000
0x00007f76e40ec370: 0x00007f76e40ed720
0x00007f76e40ec378: 0x0000000000000000
0x00007f76e40ec380: 0x00007f76e40ed840
0x00007f76e40ec388: 0x0000000000000000
0x00007f76e40ec390: 0x00000000ffffffff
0x00007f76e40ec398: 0x00007f76e40eb150
0x00007f76e40ec3a0: 0x0000000000000000 //<- ciEnv* CompilerThread::_env
0x00007f76e40ec3a8: 0x0000000000000000
0x00007f76e40ec3b0: 0x0000000000000000
0x00007f76e40ec3b8: 0x00007f76e40e8d40
0x00007f76e40ec3c0: 0x0000000000000000
0x00007f76e40ec3c8: 0x0000000000000000
0x00007f76e40ec3d0: 0x0000000000000000
0x00007f76e40ec3d8: 0x0000000000000000
0x00007f76e40ec3e0: 0x0000000000000000
0x00007f76e40ec3e8: 0x0000000000000000
0x00007f76e40ec3f0: 0x0000000000000000
0x00007f76e40ec3f8: 0x0000000000000000
0x00007f76e40ec400: 0x0000000000000000
0x00007f76e40ec408: 0x0000000000000000
0x00007f76e40ec410: 0x0000000000000000
0x00007f76e40ec418: 0x0000000000000000
0x00007f76e40ec420: 0x0000000000000000
0x00007f76e40ec428: 0x0000000000000000
0x00007f76e40ec430: 0x0000000000000000
0x00007f76e40ec438: 0x0000000000000000
0x00007f76e40ec440: 0x0000000000000000
0x00007f76e40ec448: 0x0000000000000000
0x00007f76e40ec450: 0x0000000000000000
0x00007f76e40ec458: 0x0000000000000000
0x00007f76e40ec460: 0x0000000000000000
0x00007f76e40ec468: 0x0000000000000000
0x00007f76e40ec470: 0x0000000000000000
0x00007f76e40ec478: 0x0000000000000000
0x00007f76e40ec480: 0x0000000000000000
0x00007f76e40ec488: 0x0000000000000000
0x00007f76e40ec490: 0x0000000000000000
0x00007f76e40ec498: 0x0000000000000000
0x00007f76e40ec4a0: 0x0000000000000000
0x00007f76e40ec4a8: 0x0000000000000000
0x00007f76e40ec4b0: 0x0000000000000000
0x00007f76e40ec4b8: 0x0000000000000000
0x00007f76e40ec4c0: 0x0000000000000000
0x00007f76e40ec4c8: 0x0000000000000000
0x00007f76e40ec4d0: 0x0000000000000000
0x00007f76e40ec4d8: 0x0000000000000000
0x00007f76e40ec4e0: 0x0000000000000000
0x00007f76e40ec4e8: 0x0000000000000000
0x00007f76e40ec4f0: 0x0000000000000000
0x00007f76e40ec4f8: 0x0000000000000000
0x00007f76e40ec500: 0x0000000000000000
0x00007f76e40ec508: 0x0000000000000000
0x00007f76e40ec510: 0x0000000000000000
0x00007f76e40ec518: 0x0000000000000000
0x00007f76e40ec520: 0x0000000000000000
0x00007f76e40ec528: 0x0000000000000000
0x00007f76e40ec530: 0x0000000000000000
0x00007f76e40ec538: 0x0000000000000000
0x00007f76e40ec540: 0x0000000000000000
0x00007f76e40ec548: 0x0000000000000000
0x00007f76e40ec550: 0x0000000000000000
0x00007f76e40ec558: 0x0000000000000000
0x00007f76e40ec560: 0x0000000000000000
0x00007f76e40ec568: 0x0000000000000000
0x00007f76e40ec570: 0x0000000000000000
0x00007f76e40ec578: 0x0000000000000000
0x00007f76e40ec580: 0x0000000000000000
0x00007f76e40ec588: 0x0000000000000000
0x00007f76e40ec590: 0x0000000000000000
0x00007f76e40ec598: 0x0000000000000000
0x00007f76e40ec5a0: 0x0000000000000000
0x00007f76e40ec5a8: 0x0000000000000000
0x00007f76e40ec5b0: 0x0000000000000000
0x00007f76e40ec5b8: 0x0000000000000000
0x00007f76e40ec5c0: 0x0000000000000000
0x00007f76e40ec5c8: 0x0000000000000000
0x00007f76e40ec5d0: 0x0000000000000000
0x00007f76e40ec5d8: 0x0000000000000000
0x00007f76e40ec5e0: 0x0000000000000000
0x00007f76e40ec5e8: 0x0000000000000000
0x00007f76e40ec5f0: 0x0000000000000000
0x00007f76e40ec5f8: 0x0000000000000000
0x00007f76e40ec600: 0x0000000000000000
0x00007f76e40ec608: 0x0000000000000000
0x00007f76e40ec610: 0x0000000000000000
0x00007f76e40ec618: 0x0000000000000000
0x00007f76e40ec620: 0x0000000000000000
0x00007f76e40ec628: 0x0000000000000000
0x00007f76e40ec630: 0x0000000000000000
0x00007f76e40ec638: 0x0000000000000000
hsdb>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment