Your SlideShare is downloading. ×
0
A bytecode set 
for adaptive 
optimizations 
Clément Béra & Eliot Miranda 
Thursday, August 21, 14
Introduction 
• The Cog VM is the standard VM for: 
• Pharo 
• Squeak 
• Newspeak 
Thursday, August 21, 14
Introduction 
• Working runtime bytecode to bytecode 
optimizer for Cog’s JIT 
• The optimizer 
• depends the bytecode set...
Introduction 
• Design of a new bytecode set 
Thursday, August 21, 14
Plan 
• Context 
• Challenges for a good bytecode set 
• Current Issues 
• New bytecode set 
• Switching between bytecode ...
Context 
• Compiled methods are objects 
• Shared between the VM and the image 
Thursday, August 21, 14
Memory representation of 
Compiled Method in 32 bits 
with the new Memory Manager Spur 
Object header (8 bytes) 
compiled ...
Memory representation of 
Compiled Method in 32 bits 
with the new Memory Manager Spur 
Object header (8 bytes) 
compiled ...
Bytecode set 
• Stack based 
• Interpreted by the StackInterpreter 
• Compiled to machine code by Cogit 
• Generated by th...
Challenges 
• Generic challenges 
• Challenges for the bytecode optimizer 
Thursday, August 21, 14
Generic challenges 
• Platform-independent 
• Compact 
• Easy to decode 
• Backward compatibility 
Thursday, August 21, 14
Optimizer challenges 
... 
Thursday, August 21, 14
Optimizer 
Thursday there’s a talk about it. 
• Inlining 
• Primitive specialization 
Thursday, August 21, 14
Optimizer challenges 
• Inlined primitives / unsafe operations 
• Large methods 
• Access to non receiver instance variabl...
Current issues 
• Large method unsupported 
• Few available bytes 
• Primitive encoding forbidding inlining 
• DoubleExten...
New bytecode set 
• Extendable instructions (prefix) 
• Inlined primitives / unsafe operations 
• Extendable (available by...
New bytecode set 
• Overall bytecode size smaller 
• Immediate objects compaction 
• Easier decoding 
• Sorted by number o...
Bytecode set switch 
• Offline converter: hard to debug 
• VM supporting two bytecode set 
• Bit in compiled method header...
Conclusion 
• Designed a bytecode set for runtime 
bytecode to bytecode optimizations 
• Next step is to work on the optim...
Questions 
Thursday, August 21, 14
Upcoming SlideShare
Loading in...5
×

A bytecode set for adaptive optimizations

224

Published on

A bytecode set for adaptive optimizations
IWST 2014 at ESUG, Cambridge

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
224
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "A bytecode set for adaptive optimizations"

  1. 1. A bytecode set for adaptive optimizations Clément Béra & Eliot Miranda Thursday, August 21, 14
  2. 2. Introduction • The Cog VM is the standard VM for: • Pharo • Squeak • Newspeak Thursday, August 21, 14
  3. 3. Introduction • Working runtime bytecode to bytecode optimizer for Cog’s JIT • The optimizer • depends the bytecode set quality • needs new bytecode instructions Thursday, August 21, 14
  4. 4. Introduction • Design of a new bytecode set Thursday, August 21, 14
  5. 5. Plan • Context • Challenges for a good bytecode set • Current Issues • New bytecode set • Switching between bytecode sets Thursday, August 21, 14
  6. 6. Context • Compiled methods are objects • Shared between the VM and the image Thursday, August 21, 14
  7. 7. Memory representation of Compiled Method in 32 bits with the new Memory Manager Spur Object header (8 bytes) compiled method header (4 bytes) literals (4 bytes per literal) bytecodes (variable) source pointer (variable, usually 4 bytes) Thursday, August 21, 14
  8. 8. Memory representation of Compiled Method in 32 bits with the new Memory Manager Spur Object header (8 bytes) compiled method header (4 bytes) literals (4 bytes per literal) bytecodes (variable) source pointer (variable, usually 4 bytes) Thursday, August 21, 14
  9. 9. Bytecode set • Stack based • Interpreted by the StackInterpreter • Compiled to machine code by Cogit • Generated by the in-image compiler Thursday, August 21, 14
  10. 10. Challenges • Generic challenges • Challenges for the bytecode optimizer Thursday, August 21, 14
  11. 11. Generic challenges • Platform-independent • Compact • Easy to decode • Backward compatibility Thursday, August 21, 14
  12. 12. Optimizer challenges ... Thursday, August 21, 14
  13. 13. Optimizer Thursday there’s a talk about it. • Inlining • Primitive specialization Thursday, August 21, 14
  14. 14. Optimizer challenges • Inlined primitives / unsafe operations • Large methods • Access to non receiver instance variable • Extendable Thursday, August 21, 14
  15. 15. Current issues • Large method unsupported • Few available bytes • Primitive encoding forbidding inlining • DoubleExtendedDoAnything bytecode • Immediate objects compaction • Late addition of the closure bytecode Thursday, August 21, 14
  16. 16. New bytecode set • Extendable instructions (prefix) • Inlined primitives / unsafe operations • Extendable (available bytes) • Maximum number of literals increased Thursday, August 21, 14
  17. 17. New bytecode set • Overall bytecode size smaller • Immediate objects compaction • Easier decoding • Sorted by number of bytes • Sorted by functionalities • Closure decoding improved Thursday, August 21, 14
  18. 18. Bytecode set switch • Offline converter: hard to debug • VM supporting two bytecode set • Bit in compiled method header Thursday, August 21, 14
  19. 19. Conclusion • Designed a bytecode set for runtime bytecode to bytecode optimizations • Next step is to work on the optimizer • Come at my talk thursday about it Thursday, August 21, 14
  20. 20. Questions Thursday, August 21, 14
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×