JVM bytecode engineering 101
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
426
On Slideshare
412
From Embeds
14
Number of Embeds
1

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 14

http://www.nljug.org 14

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. JVM bytecode engineering 101 Kees Jan Koster kjkoster@java-monitor.com Wednesday, November 6, 13
  • 2. Wednesday, November 6, 13
  • 3. • http://java-monitor.com/livedemo.html • • • • free, on-line service up and running in 5 minutes access server stats from your mobile get help in the integrated forum Wednesday, November 6, 13
  • 4. java-monitor probe java-monitor probe java-monitor probe java-monitor server java-monitor plugin java-monitor probe java-monitor probe Wednesday, November 6, 13
  • 5. Wednesday, November 6, 13
  • 6. Wednesday, November 6, 13
  • 7. Wednesday, November 6, 13
  • 8. Wednesday, November 6, 13
  • 9. • • • workflow and toolchain JVM architecture instruction set basics Wednesday, November 6, 13
  • 10. write in java compile to .class decompile tweak bootstrap recompile to .class debug Wednesday, November 6, 13
  • 11. CA FE BA BE 00 04 AD 00 DA 00 .. .. .. verifier class loader class JVM Wednesday, November 6, 13
  • 12. CA FE BA BE 00 04 AD 00 DA 00 .. .. .. 0xCAFEBABE version # constant pool e.g. strings access flags class info fields methods attributes Wednesday, November 6, 13
  • 13. CA FE BA BE 00 04 AD 00 DA 00 .. .. .. 0xCAFEBABE version # constant pool Transformer e.g. strings access flags class info fields methods attributes Wednesday, November 6, 13 static final Logger __log = new ... __log.info(…); __log.info(…);
  • 14. CA FE BA BE 00 04 AD 00 DA 00 .. .. .. Transformer CA FE BA BE 00 04 AD 00 BE 45 76 .. .. .. verifier class loader class JVM Wednesday, November 6, 13
  • 15. AspectJ Spring http://www.slideshare.net/tcurdt/no-dark-magic-byte-code-engineering-in-the-real-world Wednesday, November 6, 13
  • 16. • • • • • • operand stack local variables • this pointer stack frames and invoking methods constant pool atomic vs object types exceptions Wednesday, November 6, 13
  • 17. • • • push 1 push 2 iadd ... ... Wednesday, November 6, 13
  • 18. • • • push 1 push 2 iadd ... ... Wednesday, November 6, 13
  • 19. • • • push 1 push 2 iadd 1 ... ... Wednesday, November 6, 13
  • 20. • • • push 1 push 2 iadd 2 1 ... ... Wednesday, November 6, 13
  • 21. • • • push 1 push 2 iadd 3 ... ... Wednesday, November 6, 13
  • 22. write in java javap ASMifier bytecode plugin compile to .class decompile tweak bootstrap recompile to .class debug Wednesday, November 6, 13
  • 23. write in java compile to .class decompile tweak bootstrap recompile to .class ASM CheckClassAdapter debug Wednesday, November 6, 13
  • 24. nobody forced you Wednesday, November 6, 13