Bootstrapping a SmalltalkG. Casaccio, S. Ducasse, L. Fabresse, J-B. Arnaud, B. van RyseghemPresented by: M. DenkerM.Denker...
What is Bootstrapping?                    A process that builds          the minimal infrastructure of a language        t...
Example: Bootstrapping a language X                                               Tools Language X                     Com...
Example: Bootstrapping a language X                                               Tools Language X                     Com...
Example: Bootstrapping a language X                                                   Tools Language X                    ...
Example: Bootstrapping a language X                                                   Tools Language X                    ...
Example: Bootstrapping a language X                                                   Tools Language X                    ...
Why Bootstrapping?   - Agile and explicit process   - Explicit malleability and evolution support   - Warranty of initial ...
Existing approaches                                    Bootstrap Approaches                        Execution-based        ...
Existing approaches                                    Bootstrap Approaches                        Execution-based        ...
Spoon- Client / Server approach- Client side starts as minimal- On each slot access if the target object is missing, fetch...
Chacharas Same approach as Spoon but: - Analyze a server side execution - All reached objects are copied on the client   M...
MicroSqueak1 - A kernel is loaded from              MicroSqueak             MicroSqueak                                   ...
Hazelnut   Same approach as MicroSqueak but:   - does not rely on a specific list of class that are manually edited   - tak...
Discussion                                                                 Bootstrap Approaches                           ...
Our approach                                    Bootstrap Approaches                        Execution-based               ...
CorGen                                                 Bootstrap>>bootstrap [1. Creation of the stub objects for literal  ...
Stubs Creation  Bootstrap>>instantiateSmalltalkObjects [   self        instantiateNilGst;        instantiateTrueGst;      ...
Classes/Metaclasses creation Bootstrap>>processClasses [   "fill the class stubs with real classes"   self          "create...
Compile Methods- Methods either taken from the model or the source files- Use a compiler parametrized by an environment an...
Initializing the System Bootstrap>>setupSmalltalkObjects [    self setupCharacter; "insert references to the Character tab...
Initializing the System    Bootstrap>>createProcess [        | processGst |        (processGst := GstProcess new)         ...
Saving the Image- Comply with image file format:   - Image header   - Special object array- Serialize objects according to...
The ResultA 54 classes Smalltalk Kernel:   Kernel (15 classes): Behavior, BlockClosure, BlockContext, Boolean, Class,   Cl...
Related Work- Lisp : using image such Smalltalk, the bootstrap is done by migrate thecurrent image, using a cross-compiler...
Conclusion and Future WorkPros and Cons:   - Execution-based bootstrapping (tracing) such as Hazelnut   - Static-based boo...
THANKSBootstrapping a SmalltalkG. Casaccio, S. Ducasse, L. Fabresse, J-B. Arnaud, B. van RyseghemPresented by: M. DenkerM....
Upcoming SlideShare
Loading in …5
×

Boostrapping a Smalltalk

1,789 views

Published on

Presentation given at Smalltalks 2011, Quilmes, Argentina

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,789
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Boostrapping a Smalltalk

  1. 1. Bootstrapping a SmalltalkG. Casaccio, S. Ducasse, L. Fabresse, J-B. Arnaud, B. van RyseghemPresented by: M. DenkerM.Denker - Bootstrapping a Smalltalk November 2011
  2. 2. What is Bootstrapping? A process that builds the minimal infrastructure of a language that is reusable to define this language itself M.Denker - Bootstrapping a Smalltalk November 2011 -
  3. 3. Example: Bootstrapping a language X Tools Language X Compiler Loader M.Denker - Bootstrapping a Smalltalk November 2011 -
  4. 4. Example: Bootstrapping a language X Tools Language X Compiler Loader How to create/write all of this for language X? M.Denker - Bootstrapping a Smalltalk November 2011 -
  5. 5. Example: Bootstrapping a language X Tools Language X Compiler Loader Compiler Language Y description or Loader M.Denker - Bootstrapping a Smalltalk November 2011 -
  6. 6. Example: Bootstrapping a language X Tools Language X Compiler Resilient Loader ≠ Compiler Language Y description or Loader Java M.Denker - Bootstrapping a Smalltalk November 2011 -
  7. 7. Example: Bootstrapping a language X Tools Language X Compiler Squeak/Pharo Loader ⊃ Compiler Language Y description or Loader Slang M.Denker - Bootstrapping a Smalltalk November 2011 -
  8. 8. Why Bootstrapping? - Agile and explicit process - Explicit malleability and evolution support - Warranty of initial state - Minimal self reference M.Denker - Bootstrapping a Smalltalk November 2011 -
  9. 9. Existing approaches Bootstrap Approaches Execution-based Static-based (tracing) (generation) OnAbsence OnPresence Dumping Recreating Spoon Chacharas MicroSqueak CorGen Hazelnut GNU ST M.Denker - Bootstrapping a Smalltalk November 2011 -
  10. 10. Existing approaches Bootstrap Approaches Execution-based Static-based (tracing) (generation) OnAbsence OnPresence Dumping Recreating Spoon Chacharas MicroSqueak CorGen Hazelnut GNU ST M.Denker - Bootstrapping a Smalltalk November 2011 -
  11. 11. Spoon- Client / Server approach- Client side starts as minimal- On each slot access if the target object is missing, fetch and copy it fromthe server ss ce t ac lo 1 .s t jec t jec ob ob ing g py tin co ec inj 3. 4. Server Client 2. slot absent grabbing it from server M.Denker - Bootstrapping a Smalltalk November 2011 -
  12. 12. Chacharas Same approach as Spoon but: - Analyze a server side execution - All reached objects are copied on the client M.Denker - Bootstrapping a Smalltalk November 2011 -
  13. 13. MicroSqueak1 - A kernel is loaded from MicroSqueak MicroSqueak Kernel Kernelfiles into a namespace Fix references of Create stub objects classes and metaclasses MicroSqueak MicroSqueak Kernel Kernel Fix references of Save it compiled method M.Denker - Bootstrapping a Smalltalk November 2011 -
  14. 14. Hazelnut Same approach as MicroSqueak but: - does not rely on a specific list of class that are manually edited - takes a list of classes as input and recursively copy classes into a new namespace M.Denker - Bootstrapping a Smalltalk November 2011 -
  15. 15. Discussion Bootstrap Approaches Execution-based Static-basedExecution-based approaches: (tracing) (generation)- difficult to control which objects will be selected for thebootstrapped image OnAbsence OnPresence Dumping Recreating MicroSqueak CorGen- reflection breaks tracing Spoon Chacharas Hazelnut GNU ST- not suitable for interactive programs+ suitable to compute the minimal runtime required by a programStatic-based approaches:+ easier to control the result of a static generation+ suitable for deep changes in a system (new object format, ...)- hard to specify / write / maintain M.Denker - Bootstrapping a Smalltalk November 2011 -
  16. 16. Our approach Bootstrap Approaches Execution-based Static-based (tracing) (generation) OnAbsence OnPresence Dumping Recreating Spoon Chacharas MicroSqueak CorGen Hazelnut GNU ST M.Denker - Bootstrapping a Smalltalk November 2011 -
  17. 17. CorGen Bootstrap>>bootstrap [1. Creation of the stub objects for literal self instantiateSmalltalkObjects;objects: nil, true, false, characters2. Definition of classes and metaclasses importClassesFromSources;3. Method compilation processClasses;4. Creation of process and special object array setupSmalltalkObjects; saveImage]5. Image serialization. M.Denker - Bootstrapping a Smalltalk November 2011 -
  18. 18. Stubs Creation Bootstrap>>instantiateSmalltalkObjects [ self instantiateNilGst; instantiateTrueGst; instantiateFalseGst; instantiateCharactersTable; "build all the characters" instantiateEnvironment "create System Dictionary"] M.Denker - Bootstrapping a Smalltalk November 2011 -
  19. 19. Classes/Metaclasses creation Bootstrap>>processClasses [ "fill the class stubs with real classes" self "create classes and add them to System Dictionary" createClasses; "compile and install CompileMethods" compileMethods ] M.Denker - Bootstrapping a Smalltalk November 2011 -
  20. 20. Compile Methods- Methods either taken from the model or the source files- Use a compiler parametrized by an environment and a symbol table- Deep changes may be applied (change bytecode set, other optimization, ...) M.Denker - Bootstrapping a Smalltalk November 2011 -
  21. 21. Initializing the System Bootstrap>>setupSmalltalkObjects [ self setupCharacter; "insert references to the Character table" setupSymbol; "insert references to the Symbol table" setupProcessor "create Processor and install it" ] Bootstrap>>setupProcessor [ | processorGst | processGst := self createProcess. processorGst := GstProcessorScheduler new. processorGst scheduler: nilGst; processes: self buildProcessList; activeProcess: processGst; idleTasks: nilGst. ] M.Denker - Bootstrapping a Smalltalk November 2011 -
  22. 22. Initializing the System Bootstrap>>createProcess [ | processGst | (processGst := GstProcess new) nextLink: nilGst; suspendedContext: self createInitContext; priority: 4; myList: nilGst; name: GstString new; interrupts: nilGst; interruptLock: nilGst ] M.Denker - Bootstrapping a Smalltalk November 2011 -
  23. 23. Saving the Image- Comply with image file format: - Image header - Special object array- Serialize objects according to their shape (CompiledMethods, ...)- Avoid object duplication during serializing M.Denker - Bootstrapping a Smalltalk November 2011 -
  24. 24. The ResultA 54 classes Smalltalk Kernel: Kernel (15 classes): Behavior, BlockClosure, BlockContext, Boolean, Class, ClassDescription, ContextPart, False, Metaclass, MethodContext, MethodInfo, Object, ProcessorScheduler, True, UndefinedObject. Collection (27 classes): Array, ArrayedCollection, Bag, BindingDictionary, ByteArray, CharacterArray, Collection, CompiledBlock, CompiledCode, CompiledMethod, Dictionary, HashedCollection, IdentityDictionary, Iterable, Link, LinkedList, LookupTable, MethodDictionary, OrderedCollection, Process, Semaphore, SequenceableCollection, Set, String, Symbol, SystemDictionary, WeakSet. Magnitude (12 classes): Association, Character, Float, Fraction, Integer, LookupKey, Magnitude, MethodInfo, Number, SmallInteger, VariableBinding, HomedAssociation. M.Denker - Bootstrapping a Smalltalk November 2011 -
  25. 25. Related Work- Lisp : using image such Smalltalk, the bootstrap is done by migrate thecurrent image, using a cross-compiler include in the host image.- Ruby : the kernel is load and initialize by the VM some low level initializationis done in C, all the other is done by ruby processing. After all the module isload separately by the Virtual Machine.- Python : the Python virtual machine is initialized. Some classes stubs arecreated and initialized in the virtual machine. (close of the ruby bootstrap) M.Denker - Bootstrapping a Smalltalk November 2011 -
  26. 26. Conclusion and Future WorkPros and Cons: - Execution-based bootstrapping (tracing) such as Hazelnut - Static-based bootstrapping (declarative) such as CoreGenFuture work: Boostrapping Pharo - use an execution-based approach as an intermediate solution - reach a static-based bootstrap that can easily be maintained and co-evolve with the system M.Denker - Bootstrapping a Smalltalk November 2011 -
  27. 27. THANKSBootstrapping a SmalltalkG. Casaccio, S. Ducasse, L. Fabresse, J-B. Arnaud, B. van RyseghemPresented by: M. DenkerM.Denker - Bootstrapping a Smalltalk November 2011

×