9. Bytecode and Virtual Machines Original material prepared by Adrian Lienhard and Marcus Denker.

Slides:



Advertisements
Similar presentations
Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
Advertisements

Part IV: Memory Management
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
8. Static Single Assignment Form Marcus Denker. © Marcus Denker SSA Roadmap  Static Single Assignment Form (SSA)  Converting to SSA Form  Examples.
Instruction Set Design
7. Optimization Prof. O. Nierstrasz Lecture notes by Marcus Denker.
CPU Review and Programming Models CT101 – Computing Systems.
INSTRUCTION SET ARCHITECTURES
Chapter 10- Instruction set architectures
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Introduction to Software Engineering 7. Modeling Behaviour.
Garbage Collection CSCI 2720 Spring Static vs. Dynamic Allocation Early versions of Fortran –All memory was static C –Mix of static and dynamic.
Virtual Machines Guest lecture — Adrian Lienhard.
CPSC 388 – Compiler Design and Construction
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
Shared Counters and Parallelism Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit.
Processes CSCI 444/544 Operating Systems Fall 2008.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
13. A bit of Smalltalk. © Oscar Nierstrasz 2 Roadmap  The origins of Smalltalk  What is Smalltalk?  Syntax in a nutshell  Seaside — web development.
CS 536 Spring Code generation I Lecture 20.
JETT 2003 Java.compareTo(C++). JAVA Java Platform consists of 4 parts: –Java Language –Java API –Java class format –Java Virtual Machine.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
3.5 Interprocess Communication
Computer System Overview
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
3-1 3 Compilers and interpreters  Compilers and other translators  Interpreters  Tombstone diagrams  Real vs virtual machines  Interpretive compilers.
CSc 453 Interpreters & Interpretation Saumya Debray The University of Arizona Tucson.
Arpit Jain Mtech1. Outline Introduction Dalvik VM Java VM Examples Comparisons Experimental Evaluation.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
COMP2011 Assembly Language Programming and Introduction to WRAMP.
7. Just In Time Compilation Prof. O. Nierstrasz Jan Kurs.
Lecture 10 : Introduction to Java Virtual Machine
CSC 310 – Imperative Programming Languages, Spring, 2009 Virtual Machines and Threaded Intermediate Code (instead of PR Chapter 5 on Target Machine Architecture)
Advanced Programming Collage of Information Technology University of Palestine, Gaza Prepared by: Mahmoud Rafeek Alfarra Lecture 2: Major Concepts of Programming.
CS 147 June 13, 2001 Levels of Programming Languages Svetlana Velyutina.
Java Virtual Machine Case Study on the Design of JikesRVM.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Chapter 4 Memory Management Virtual Memory.
Execution of an instruction
Module R3 Process Scheduling. Module R3 involves the creation of a simple “Round Robin” dispatcher. The successful completion of this module will require.
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
Precomputation- based Prefetching By James Schatz and Bashar Gharaibeh.
CS 598 Scripting Languages Design and Implementation 14. Self Compilers.
Processes and Virtual Memory
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
S.Ducasse Marcus Denker 1 Working with Bytecodes: IRBuilder and InstructionStream.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
CS 598 Scripting Languages Design and Implementation 12. Interpreter implementation.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Smalltalk Implementation Harry Porter, October 2009 Smalltalk Implementation: Optimization Techniques Prof. Harry Porter Portland State University 1.
Smalltalk Implementation
Processes and threads.
CSc 453 Interpreters & Interpretation
Process Description and Control
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
(Computer fundamental Lab)
Chapter 1 Computer System Overview
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Lecture 7: Flexible Address Translation
CS703 - Advanced Operating Systems
CSc 453 Interpreters & Interpretation
Dynamic Binary Translators and Instrumenters
Chapter 4 The Von Neumann Model
Presentation transcript:

9. Bytecode and Virtual Machines Original material prepared by Adrian Lienhard and Marcus Denker

Birds-eye view A virtual machine is an abstract computing architecture supporting a programming language in a hardware-independent fashion Z1, 1938 © Oscar Nierstrasz Bytecodes and Virtual Machines 2

Roadmap  Introduction  Bytecode  The heap store  Interpreter  Automatic memory management  Threading System  Optimizations © Oscar Nierstrasz Bytecodes and Virtual Machines 3

Implementing a Programming Language © Oscar Nierstrasz Bytecodes and Virtual Machines 4

How are VMs implemented? Typically using an efficient and portable language such as C, C++, or assembly code Pharo VM platform-independent part written in Slang: – subset of Smalltalk, translated to C – core: 600 methods or 8k LOC in Slang – Slang allows one to simulate VM in Smalltalk © Oscar Nierstrasz Bytecodes and Virtual Machines 5

Main Components of a VM The heap store Interpreter Automatic memory management Threading System © Oscar Nierstrasz Bytecodes and Virtual Machines 6

Pros and Cons of the VM Approach Pros  Platform independence of application code “Write once, run anywhere”  Simpler programming model  Security  Optimizations for different hardware architectures Cons  Execution overhead  Not suitable for system programming © Oscar Nierstrasz Bytecodes and Virtual Machines 7

Roadmap  Introduction  Bytecode  The heap store  Interpreter  Automatic memory management  Threading System  Optimizations © Oscar Nierstrasz Bytecodes and Virtual Machines 8

Reasons for working with Bytecode  Generating Bytecode —Implementing compilers for other languages —Experimentation with new language features  Parsing and Interpretation: —Analysis (e.g., self and super sends) —Decompilation (for systems without source) —Printing of bytecode —Interpretation: Debugger, Profiler © Oscar Nierstrasz Bytecodes and Virtual Machines 9

The Pharo Virtual Machine  Virtual machine provides a virtual processor —Bytecode: The “machine-code” of the virtual machine  Smalltalk (like Java): Stack machine —easy to implement interpreters for different processors —most hardware processors are register machines  Pharo VM: Implemented in Slang —Slang: Subset of Smalltalk. (“C with Smalltalk Syntax”) —Translated to C © Oscar Nierstrasz Bytecodes and Virtual Machines 10

Bytecode in the CompiledMethod  CompiledMethod format: Number of temps, literals... Array of all Literal Objects Pointer to Source Header Literals Bytecode Trailer (Number methodDict at: #asInteger) inspect (Number>>#asInteger) inspect © Oscar Nierstrasz Bytecodes and Virtual Machines 11

Bytecodes: Single or multibyte  Different forms of bytecodes: —Single bytecodes: – Example: 112: push self —Groups of similar bytecodes – 16: push temp 1 – 17: push temp 2 – up to 31 —Multibyte bytecodes – Problem: 4 bit offset may be too small – Solution: Use the following byte as offset – Example: Jumps need to encode large jump offsets TypeOffset 4 bits © Oscar Nierstrasz Bytecodes and Virtual Machines 12

 Smalltalk code:  Symbolic Bytecode Example: Number>>asInteger Number>>asInteger "Answer an Integer nearest the receiver toward zero." ^self truncated 17 self 18 send: truncated 19 returnTop © Oscar Nierstrasz Bytecodes and Virtual Machines 13

Example: Step by Step  17 self —The receiver (self) is pushed on the stack  18 send: truncated —Bytecode 208: send literal selector 1 —Get the selector from the first literal —start message lookup in the class of the object that is on top of the stack —result is pushed on the stack  19 returnTop —return the object on top of the stack to the calling method © Oscar Nierstrasz Bytecodes and Virtual Machines 14

Pharo Bytecode  256 Bytecodes, four groups: —Stack Bytecodes – Stack manipulation: push / pop / dup —Send Bytecodes – Invoke Methods —Return Bytecodes – Return to caller —Jump Bytecodes – Control flow inside a method © Oscar Nierstrasz Bytecodes and Virtual Machines 15

Stack Bytecodes  Push values on the stack —e.g., temps, instVars, literals —e.g: : push instance variable  Push Constants —False/True/Nil/1/0/2/-1  Push self, thisContext  Duplicate top of stack  Pop © Oscar Nierstrasz Bytecodes and Virtual Machines 16

Sends and Returns  Sends: receiver is on top of stack —Normal send —Super Sends —Hard-coded sends for efficiency, e.g. +, -  Returns —Return top of stack to the sender —Return from a block —Special bytecodes for return self, nil, true, false (for efficiency) © Oscar Nierstrasz Bytecodes and Virtual Machines 17

 Control Flow inside one method —Used to implement control-flow efficiently —Example: Jump Bytecodes 17 pushConstant: 1 18 pushConstant: 2 19 send: < 20 jumpFalse: pushConstant: 'true' 22 jumpTo: pushConstant: nil 24 returnTop ^ 1<2 ifTrue: ['true'] © Oscar Nierstrasz Bytecodes and Virtual Machines 18

Roadmap  Introduction  Bytecode  The heap store  Interpreter  Automatic memory management  Threading System  Optimizations © Oscar Nierstrasz Bytecodes and Virtual Machines 19

Object Memory Layout 32-bit direct-pointer scheme Reality is more complex: – 1-word header for instances of compact classes – 2-word header for normal objects – 3-word header for large objects © Oscar Nierstrasz Bytecodes and Virtual Machines 20

Different Object Formats  fixed pointer fields  indexable types: – indexable pointer fields (e.g., Array) – indexable weak pointer fields (e.g., WeakArray) – indexable word fields (e.g., Bitmap) – indexable byte fields (e.g., ByteString) Object format (4bit) 0no fields 1fixed fields only 2indexable pointer fields only 3both fixed and indexable pointer fields 4both fixed and indexable weak fields 6indexable word fields only 8-11indexable byte fields only © Oscar Nierstrasz Bytecodes and Virtual Machines 21

“Answer the first object on the heap” anObject someObject “Answer the next object on the heap” anObject nextObject “Answer the first object on the heap” anObject someObject “Answer the next object on the heap” anObject nextObject Excludes small integers! Iterating Over All Objects in Memory © Oscar Nierstrasz Bytecodes and Virtual Machines 22 |count| count := 0. SystemNavigation default allObjectsDo: [:anObject | count := count + 1]. Count |count| count := 0. SystemNavigation default allObjectsDo: [:anObject | count := count + 1]. Count SystemNavigation>>allObjectsDo: aBlock | object endMarker | object := self someObject. endMarker := Object new. [endMarker == object] whileFalse: [aBlock value: object. object := object nextObject]

Roadmap  Introduction  Bytecode  The heap store  Interpreter  Automatic memory management  Threading System  Optimizations © Oscar Nierstrasz Bytecodes and Virtual Machines 23

Stack vs. Register VMs Stack machines Smalltalk, Java and most other VMs Simple to implement for different hardware architectures Very compact code Register machines Potentially faster than stack machines Only few register VMs, e.g., Parrot VM (Perl6) VM provides a virtual processor that interprets bytecode instructions © Oscar Nierstrasz Bytecodes and Virtual Machines 24

Interpreter State and Loop Interpreter state – instruction pointer (ip): points to current bytecode – stack pointer (sp): topmost item in the operand stack – current active method or block context – current active receiver and method Interpreter loop 1. branch to appropriate bytecode routine 2. fetch next bytecode 3. increment instruction pointer 4. execute the bytecode routine 5. return to 1. © Oscar Nierstrasz Bytecodes and Virtual Machines 25

Method Contexts method header: – primitive index – number of args – number of temps – large context flag – number of literals © Oscar Nierstrasz Bytecodes and Virtual Machines 26

Stack Manipulating Bytecode Routine Example: bytecode self Interpreter>>pushReceiverBytecode self fetchNextBytecode. self push: receiver Interpreter>>push: anObject sp := sp + BytesPerWord. self longAt: sp put: anObject © Oscar Nierstrasz Bytecodes and Virtual Machines 27

Stack Manipulating Bytecode Routine Example: bytecode pushRcvr: 1 Interpreter>>pushReceiverVariableBytecode self fetchNextBytecode. self pushReceiverVariable: (currentBytecode bitAnd: 16rF) Interpreter>>pushReceiverVariable: fieldIndex self push: ( self fetchPointer: fieldIndex ofObject: receiver) Interpreter>>fetchPointer: fieldIndex ofObject: oop ^ self longAt: oop + BaseHeaderSize + (fieldIndex * BytesPerWord) © Oscar Nierstrasz Bytecodes and Virtual Machines 28

Message Sending Bytecode Routine 1. find selector, receiver and its class 2. lookup message in the method dictionary of the class 3. if method not found, repeat this lookup in successive superclasses; if superclass is nil, instead send #doesNotUnderstand: 4. create a new method context and set it up 5. activate the context and start executing the instructions in the new method © Oscar Nierstrasz Bytecodes and Virtual Machines 29 Example: bytecode send: hello

Message Sending Bytecode Routine Interpreter>>sendLiteralSelectorBytecode selector := self literal: (currentBytcode bitAnd: 16rF). argumentCount := ((currentBytecode >> 4) bitAnd: 3) - 1. rcvr := self stackValue: argumentCount. class := self fetchClassOf: rcvr. self findNewMethod. self executeNewMethod. self fetchNewBytecode Example: bytecode send: hello This routine (bytecodes ) can use any of the first 16 literals and pass up to 2 arguments E0(hex) = 224(dec) = (bin) E0 AND F = 0 => literal frame at 0 ((E0 >> 4) AND 3) - 1 = 1 => 1 argument © Oscar Nierstrasz Bytecodes and Virtual Machines 30

Primitives Primitive methods trigger a VM routine and are executed without a new method context unless they fail  Improve performance (arithmetics, at:, at:put:,...)  Do work that can only be done in VM (new object creation, process manipulation, become,...)  Interface with outside world (keyboard input, networking,...)  Interact with VM plugins (named primitives) ProtoObject>>nextObject self primitiveFailed © Oscar Nierstrasz Bytecodes and Virtual Machines 31

Roadmap  Introduction  Bytecode  The heap store  Interpreter  Automatic memory management  Threading System  Optimizations © Oscar Nierstrasz Bytecodes and Virtual Machines 32

Automatic Memory Management Challenges – Fast allocation – Fast program execution Tell when an object is no longer used and then recycle the memory – Small predictable pauses – Scalable to large heaps – Minimal space usage © Oscar Nierstrasz Bytecodes and Virtual Machines 33

Main Approaches  1. Reference Counting  2. Mark and Sweep © Oscar Nierstrasz Bytecodes and Virtual Machines 34

Reference Counting GC Idea  For each store operation increment count field in header of newly stored object  Decrement if object is overwritten  If count is 0, collect object and decrement the counter of each object it pointed to Problems  Run-time overhead of counting (particularly on stack)  Inability to detect cycles (need additional GC technique) © Oscar Nierstrasz Bytecodes and Virtual Machines 35

Reference Counting GC © Oscar Nierstrasz Bytecodes and Virtual Machines 36

Mark and Sweep GC Idea  Suspend current process  Mark phase: trace each accessible object leaving a mark in the object header (start at known root objects)  Sweep phase: all objects with no mark are collected  Remove all marks and resume current process Problems  Need to “stop the world”  Slow for large heaps  generational collectors  Fragmentation  compacting collectors © Oscar Nierstrasz Bytecodes and Virtual Machines 37

Mark and Sweep GC © Oscar Nierstrasz Bytecodes and Virtual Machines 38

Generational Collectors Idea  Partition objects into generations  Create objects in young generation  Tenuring: move live objects from young to old generation  Incremental GC: frequently collect young generation (very fast)  Full GC: infrequently collect young+old generation (slow) Difficulty  Need to track pointers from old to new space Most new objects live very short lives; most older objects live forever [Ungar 87] © Oscar Nierstrasz Bytecodes and Virtual Machines 39

Generational Collectors: Remembered Set Write barrier: remember objects with old-young pointers:  On each store check whether stored object (object2) is young and storer (object1) is old  If true, add storer to remembered set  When marking young generation, use objects in remembered set as additional roots object1.f := object2 © Oscar Nierstrasz Bytecodes and Virtual Machines 40

Compacting Collectors Idea  During the sweep phase all live objects are packed to the beginning of the heap  Simplifies allocation since free space is in one contiguous block Challenge  Adjust all pointers of moved objects – object references on the heap – pointer variables of the interpreter! © Oscar Nierstrasz Bytecodes and Virtual Machines 41

The Pharo GC Pharo: mark and sweep compacting collector with two generations  Cooperative, i.e., not concurrent  Single threaded © Oscar Nierstrasz Bytecodes and Virtual Machines 42

When Does the GC Run? – Incremental GC on allocation count or memory needs – Full GC on memory needs – Tenure objects if survivor threshold exceeded “Incremental GC after this many allocations” SmalltalkImage current vmParameterAt: 5 “Tenure when more than this many objects survive” SmalltalkImage current vmParameterAt: © Oscar Nierstrasz Bytecodes and Virtual Machines 43

VM Memory Statistics SmalltalkImage current vmStatisticsReportString memory20,245,028 bytes old14,784,388 bytes (73.0%) young117,724 bytes (0.6%) used14,902,112 bytes (73.6%) free5,342,916 bytes (26.4%) GCs975 (48ms between GCs) full0 totalling 0ms (0.0% uptime) incr975 totalling 267ms (1.0% uptime), avg 0.0ms tenures14 (avg 69 GCs/tenure) Since last view90 (54ms between GCs) uptime4.8s full0 totalling 0ms (0.0% uptime) incr90 totalling 29ms (1.0% uptime), avg 0.0ms tenures1 (avg 90 GCs/tenure) © Oscar Nierstrasz Bytecodes and Virtual Machines 44

Memory System API “Force GC” Smalltalk garbageCollectMost Smalltalk garbageCollect “Is object in remembered set, is it young?” Smalltalk rootTable includes: anObject Smalltalk isYoung: anObject “Various settings and statistics” SmalltalkImage current getVMParameters ”Do an incremental GC after this many allocations” SmalltalkImage current vmParameterAt: 5 put: ”Tenure when more than this many objects survive the GC” SmalltalkImage current vmParameterAt: 6 put: ”Grow/shrink headroom” SmalltalkImage current vmParameterAt: 25 put: 4*1024*1024. SmalltalkImage current vmParameterAt: 24 put: 8*1024*1024. © Oscar Nierstrasz Bytecodes and Virtual Machines 45

Finding Memory Leaks – maybe object is just not GCed yet (force a full GC!) – find the objects and then explore who references them PointerFinder on: AssignmentNode someInstance PointerExplorer new openExplorerFor: AssignmentNode someInstance PointerFinder finds a path from a root to some object I have objects that do not get collected. What’s wrong? © Oscar Nierstrasz Bytecodes and Virtual Machines 46

Roadmap  Introduction  Bytecode  The heap store  Interpreter  Automatic memory management  Threading System  Optimizations © Oscar Nierstrasz Bytecodes and Virtual Machines 47

Threading System Multithreading is the ability to create concurrently running “processes” Non-native threads (green threads) – Only one native thread used by the VM – Simpler to implement and easier to port Native threads – Using the native thread system provided by the OS – Potentially higher performance © Oscar Nierstrasz Bytecodes and Virtual Machines 48

Pharo: Green Threads Each process has its own execution stack, ip, sp,... There is always one (and only one) running process Each process behaves as if it owns the entire VM Each process can be interrupted (  context switching) © Oscar Nierstrasz Bytecodes and Virtual Machines 49

Representing Processes and Run Queues © Oscar Nierstrasz Bytecodes and Virtual Machines 50

Context Switching 1. store the current ip and sp registers to the current context 2. store the current context in the old process’ suspendedContext 3. change Processor to point to newProcess 4. load ip and sp registers from new process’ suspendedContext Interpreter>>transferTo: newProcess When you perform a context switch, which process should run next? © Oscar Nierstrasz Bytecodes and Virtual Machines 51

Process Scheduler > Cooperative between processes of the same priority > Preemptive between processes of different priorities Context is switched to the first process with highest priority when: – current process waits on a semaphore – current process is suspended or terminated – Processor yield is sent Context is switched if the following process has a higher priority: – process is resumed or created by another process – process is resumed from a signaled semaphore When a process is interrupted, it moves to the back of its run queue © Oscar Nierstrasz Bytecodes and Virtual Machines 52

Example: Semaphores and Scheduling here := false. lock := Semaphore forMutualExclusion. [lock critical: [here := true]] fork. lock critical: [ self assert: here not. Processor yield. self assert: here not]. Processor yield. self assert: here When is the forked process activated? © Oscar Nierstrasz Bytecodes and Virtual Machines 53

Roadmap  Introduction  Bytecode  The heap store  Interpreter  Automatic memory management  Threading System  Optimizations © Oscar Nierstrasz Bytecodes and Virtual Machines 54

Many Optimizations...  Method cache for faster lookup: receiver's class + method selector  Method context cache (as much as 80% of objects created are context objects!)  Interpreter loop: 256 way case statement to dispatch bytecodes  Quick returns: methods that simply return a variable or known constant are compiled as a primitive method  Small integers are tagged pointers: value is directly encoded in field references. Pointer is tagged with low-order bit equal to 1. The remaining 31 bit encode the signed integer value. ... © Oscar Nierstrasz Bytecodes and Virtual Machines 55

Optimization: JIT (not in Pharo) Idea: Just In Time Compilation  Translate unit (method, loop,...) into native machine code at runtime  Store native code in a buffer on the heap Challenges  Run-time overhead of compilation  Machine code takes a lot of space (4-8x compared to bytecode)  Deoptimization (for debugging) is very tricky Adaptive compilation: gather statistics to compile only units that are heavily used (hot spots) © Oscar Nierstrasz Bytecodes and Virtual Machines 56

References  Virtual Machines, Iain D. Craig, Springer, 2006  Back to the Future – The Story of Squeak, A Practical Smalltalk Written in Itself, Ingalls et al, OOPSLA ’97  Smalltalk-80, the Language and Its Implementation (AKA “the Blue Book”), Goldberg, Robson, Addison-Wesley, ’83 —  The Java Virtual Machine Specification, Second Edition —  Stacking them up: a Comparison of Virtual Machines, Gough, IEEE’01  Virtual Machine Showdown: Stack Versus Registers, Shi, Gregg, Beatty, Ertl, VEE’05 © Oscar Nierstrasz Bytecodes and Virtual Machines 57

What you should know!  What is the difference between the operand stack and the execution stack?  How do bytecode routines and primitives differ?  Why is the object format encoded in a complicated 4bit pattern instead of using regular boolean values?  Why is the object address not suitable as a hash value?  What happens if an object is only weakly referenced?  Why is it hard to build a concurrent mark sweep GC?  What does cooperative multithreading mean?  How do you protect code from concurrent execution? © Oscar Nierstrasz Bytecodes and Virtual Machines 58

Can you answer these questions?  There is a lot of similarity between VM and OS design. What are the common components?  Why is accessing the 16th instance variable of an object more efficient than the 17th?  Which disastrous situation could occur if a local C pointer variable exists when a new object is allocated?  Why does #allObjectsDo: not include small integers?  What is the largest possible small integer? © Oscar Nierstrasz Bytecodes and Virtual Machines 59

Attribution-ShareAlike 3.0 Unported You are free: to Share — to copy, distribute and transmit the work to Remix — to adapt the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author's moral rights. License © Oscar Nierstrasz Bytecodes and Virtual Machines 60