denker - pharo: present and future - 2009-07-14

44
Past and Future

Upload: choose

Post on 19-May-2015

622 views

Category:

Technology


1 download

DESCRIPTION

This set of slides was used by Marcus Denker for his CHOOSE SIGBeer given on July 14, 2009 in Bern: http://choose.s-i.ch/events/2009-07-14-denker

TRANSCRIPT

Page 1: Denker - Pharo: Present and Future - 2009-07-14

Past and Future

Page 2: Denker - Pharo: Present and Future - 2009-07-14

What?

A progressive, open-source Smalltalk platform for professional use.

Page 3: Denker - Pharo: Present and Future - 2009-07-14

What?

A flexible environment to support the research of new language concepts.

Page 4: Denker - Pharo: Present and Future - 2009-07-14

What?

Pharo = Language + IDE

Pure Object-Oriented Language

Dynamically Typed

Page 5: Denker - Pharo: Present and Future - 2009-07-14

HistoryBased on Squeak Smalltalk

+ Major Cleanups (MVC, eToys)+ New UI Look / TrueType+ Tools+ Block Closures+ Lots of bugfixes and small improvements

Page 6: Denker - Pharo: Present and Future - 2009-07-14

699 Bug-reports closed

377 Updates

Release Planned: August 2009

Page 7: Denker - Pharo: Present and Future - 2009-07-14
Page 8: Denker - Pharo: Present and Future - 2009-07-14
Page 9: Denker - Pharo: Present and Future - 2009-07-14

Getting Started

(if needed)

Page 10: Denker - Pharo: Present and Future - 2009-07-14

Pier

Page 11: Denker - Pharo: Present and Future - 2009-07-14

Pier

Page 12: Denker - Pharo: Present and Future - 2009-07-14

Smalltalk with OO-Database

Pharo is the IDE

Page 13: Denker - Pharo: Present and Future - 2009-07-14

Future

Page 14: Denker - Pharo: Present and Future - 2009-07-14

...cleaner

Page 15: Denker - Pharo: Present and Future - 2009-07-14

...smaller

Page 16: Denker - Pharo: Present and Future - 2009-07-14

...faster

Page 17: Denker - Pharo: Present and Future - 2009-07-14

(of course)

Page 18: Denker - Pharo: Present and Future - 2009-07-14

Enable Evolution

Page 19: Denker - Pharo: Present and Future - 2009-07-14

Enable Experiments

Page 20: Denker - Pharo: Present and Future - 2009-07-14

Examples

- Compiler

- Slots

- JIT and AOStA

Page 21: Denker - Pharo: Present and Future - 2009-07-14

Old Compiler

- From 1976- Not OO- Hard to understand. Hard to change

We need a better Compiler!

Page 22: Denker - Pharo: Present and Future - 2009-07-14

New Compiler- Originally by Anthony Hannan

- Based on Visitors- Reusable and Pluggable Backend (IRBuilder)- Uses RB AST- SmaCC Parser

Easier to understand. Easier to change

Page 23: Denker - Pharo: Present and Future - 2009-07-14

New Compiler

code AST ASTScanner/ Parser

SemanticAnalysis BytecodeCode

Generation

AST IRBuildIR BytecodeBytecode

Generation

ASTTranslatorIRBuilder

IRTranslatorBytecodeBuilder

Code generation in detail

Page 24: Denker - Pharo: Present and Future - 2009-07-14

Plans...- New BlockClosure Format

- Plugin architecture: Parser, Checker, CodeGen

- Use RB Parser (Faster, Error messages)

Page 25: Denker - Pharo: Present and Future - 2009-07-14

Examples

- Compiler

- Slots

- JIT and AOStA

Page 26: Denker - Pharo: Present and Future - 2009-07-14

Instance Vars

- Not objects - Change behavior?- Change memory layout?

Instance state should be more powerful!

Page 27: Denker - Pharo: Present and Future - 2009-07-14

Slots

- Are objects- Allow custom subclasses- Change behavior and memory layout

Without Performance penalty!

Page 28: Denker - Pharo: Present and Future - 2009-07-14

MopObject subclass: #SlotExample slots: '{AutoAccessorSlot named: #hello}' classVariableNames: '' poolDictionaries: '' category: 'SlotExamples'

Auto-Accessor

Create accessor-methods at compile-time

Page 29: Denker - Pharo: Present and Future - 2009-07-14

MopObject subclass: #SlotExample slots: '{ActiveSlot named: #hello

action: [Beeper beep]}' classVariableNames: '' poolDictionaries: '' category: 'SlotExamples'

Active Slot

Evaluate block on read

Page 30: Denker - Pharo: Present and Future - 2009-07-14

MopObject subclass: #SlotExample slots: '{SparseSlot named: #a.

SparseSlot named: #b.SparseSlot named: #c}'

classVariableNames: '' poolDictionaries: '' category: 'SlotExamples'

Sparse Slot

Store values in one Dictionary

Page 31: Denker - Pharo: Present and Future - 2009-07-14

MopObject subclass: #SlotExample slots: '{IVarSlot named: #a} classVariableNames: '' poolDictionaries: '' category: 'SlotExamples'

iVar Slot

Normal instance Variable

Page 32: Denker - Pharo: Present and Future - 2009-07-14

MopObject subclass: #SlotExample slots: '{AutoAccessorSlot named: #hello}' classVariableNames: '' poolDictionaries: '' category: 'SlotExamples'

Auto-Accessor

Create accessor-methods at compiled-time

Page 33: Denker - Pharo: Present and Future - 2009-07-14

Slot subclass: #AutoAccessorSlot instanceVariableNames: '' ....

postCreationAction self generateGetter. self generateSetter.

generateGetter class compile: (String streamContents: [:stream |stream nextPutAll: self name; crtab; nextPutAll: '^', self name asString])

Page 34: Denker - Pharo: Present and Future - 2009-07-14

MopObject subclass: #SlotExample slots: '{ActiveSlot named: #hello

action: [Beeper beep]}' classVariableNames: '' poolDictionaries: '' category: 'SlotExamples'

Active Slot

Evaluate block on read

Page 35: Denker - Pharo: Present and Future - 2009-07-14

AutoAccessorSlot subclass: #ActiveSlot instanceVariableNames: 'action' ....

emitReadUsing: methodBuilder methodBuilder pushLiteral: action; send: #value. super emitReadUsing: methodBuilder

Active Slot

Page 36: Denker - Pharo: Present and Future - 2009-07-14

Status

- First Prototype

- Integration with ClassBuilder - Compatibility with iVars- Explore different designs

Page 37: Denker - Pharo: Present and Future - 2009-07-14

Examples

- Compiler

- Slots

- JIT and AOStA

Page 38: Denker - Pharo: Present and Future - 2009-07-14

VM

- Virtual Machine uses Interpreter

- JIT Compiler under development (Eliot Miranda)

How to optimize even more?

Page 39: Denker - Pharo: Present and Future - 2009-07-14

AOStA- Provide API for accessing runtime data

- PIC: Polymorphic Inline Cache

Record class per send instruction

- Hotness Counter

Where do we spend time?

Page 40: Denker - Pharo: Present and Future - 2009-07-14

AOStA

BC 2SSA

SSA 2BC

OPT

Optimize SSA-Form(Static Single Assignment)

PIC

BC BCSSA SSA

Page 41: Denker - Pharo: Present and Future - 2009-07-14

AOStA

- Use PIC-Data for specialization

- Inline often-called methods

- Special Bytecode for primitive types (Floats)

Page 42: Denker - Pharo: Present and Future - 2009-07-14

AOStA

- Bytecode-to-Bytecode optimization

- Purely realized in Smaltalk

- Accessible in the image. Reflection?

Page 43: Denker - Pharo: Present and Future - 2009-07-14

More...- Improve Tools

- Real Modules

- Reflection

- .......

Page 44: Denker - Pharo: Present and Future - 2009-07-14

Join Us!

Goal: learning and having fun

http://pharo-project.org