A bytecode set for adaptive optimizations Clment Bra & Eliot - - PowerPoint PPT Presentation

a bytecode set for adaptive optimizations
SMART_READER_LITE
LIVE PREVIEW

A bytecode set for adaptive optimizations Clment Bra & Eliot - - PowerPoint PPT Presentation

A bytecode set for adaptive optimizations Clment Bra & Eliot Miranda Thursday, August 21, 14 Introduction The Cog VM is the standard VM for: Pharo Squeak Newspeak Thursday, August 21, 14 Introduction Working


slide-1
SLIDE 1

A bytecode set for adaptive

  • ptimizations

Clément Béra & Eliot Miranda

Thursday, August 21, 14

slide-2
SLIDE 2

Introduction

  • The Cog

VM is the standard VM for:

  • Pharo
  • Squeak
  • Newspeak

Thursday, August 21, 14

slide-3
SLIDE 3

Introduction

  • Working runtime bytecode to bytecode
  • ptimizer for Cog’s JIT
  • The optimizer
  • depends the bytecode set quality
  • needs new bytecode instructions

Thursday, August 21, 14

slide-4
SLIDE 4

Introduction

  • Design of a new bytecode set

Thursday, August 21, 14

slide-5
SLIDE 5

Plan

  • Context
  • Challenges for a good bytecode set
  • Current Issues
  • New bytecode set
  • Switching between bytecode sets

Thursday, August 21, 14

slide-6
SLIDE 6

Context

  • Compiled methods are objects
  • Shared between the

VM and the image

Thursday, August 21, 14

slide-7
SLIDE 7

Object header (8 bytes) literals (4 bytes per literal) compiled method header (4 bytes) bytecodes (variable) source pointer (variable, usually 4 bytes)

Memory representation of Compiled Method in 32 bits with the new Memory Manager Spur

Thursday, August 21, 14

slide-8
SLIDE 8

Object header (8 bytes) literals (4 bytes per literal) compiled method header (4 bytes) bytecodes (variable) source pointer (variable, usually 4 bytes)

Memory representation of Compiled Method in 32 bits with the new Memory Manager Spur

Thursday, August 21, 14

slide-9
SLIDE 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

slide-10
SLIDE 10

Challenges

  • Generic challenges
  • Challenges for the bytecode optimizer

Thursday, August 21, 14

slide-11
SLIDE 11

Generic challenges

  • Platform-independent
  • Compact
  • Easy to decode
  • Backward compatibility

Thursday, August 21, 14

slide-12
SLIDE 12

Optimizer challenges

...

Thursday, August 21, 14

slide-13
SLIDE 13

Optimizer

Thursday there’s a talk about it.

  • Inlining
  • Primitive specialization

Thursday, August 21, 14

slide-14
SLIDE 14

Optimizer challenges

  • Inlined primitives / unsafe operations
  • Large methods
  • Access to non receiver instance variable
  • Extendable

Thursday, August 21, 14

slide-15
SLIDE 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

slide-16
SLIDE 16

New bytecode set

  • Extendable instructions (prefix)
  • Inlined primitives / unsafe operations
  • Extendable (available bytes)
  • Maximum number of literals increased

Thursday, August 21, 14

slide-17
SLIDE 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

slide-18
SLIDE 18

Bytecode set switch

  • Offline converter: hard to debug
  • VM supporting two bytecode set
  • Bit in compiled method header

Thursday, August 21, 14

slide-19
SLIDE 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

slide-20
SLIDE 20

Questions

Thursday, August 21, 14