| Copyright Page | 225 |
---|
| 4 | 225 |
---|
| Preface | 6 |
---|
| Acknowledgements | 8 |
---|
| Table of Contents | 8 |
---|
| 9 | 8 |
---|
| 1 Introduction | 8 |
---|
| 14 | 8 |
---|
| 1.1 Introduction | 14 |
| 1.2 Interpreters | 16 |
| 1.3 Landin's SEeD Machine | 16 |
| 1.4 The Organisation of this Book | 18 |
| 1.5 Omissions | 20 |
| 2 VMs for Portability: BCPL | 20 |
---|
| 24 | 20 |
---|
| 2.1 Introduction | 24 |
| 2.2 BCPL the Language | 25 |
| 2.3 VM Operations | 28 |
| 2.4 The OeODE Machine | 30 |
| 2.5 OCODE Instructions and their Implementation | 30 |
| 31 | 30 |
---|
| 2.5.1 Expression Instructions | 31 |
| 2.5.2 Load and Store Instructions | 33 |
| 2.5.3 Instructions Relating to Routines | 33 |
| 2.5 .4 Control Instructions | 35 |
| 2.5.5 Directives | 36 |
| 2.6 The Intcode/Cintcode Machine | 36 |
| 37 | 36 |
---|
| 3 The Java Virtual Machine | 36 |
---|
| 40 | 36 |
---|
| 3.1 Introduction | 40 |
| 3.2 JVM Organisation: An Overview | 41 |
| 3.2.1 The stack | 42 |
| 3.2.2 Method areas | 43 |
| 3.2.3 The PC register | 43 |
| 44 | 43 |
---|
| 3.2.4 Other structures | 45 |
| 3.3 Class Files | 45 |
| 3.4 Object Representation at Runtime | 53 |
| 3.5 Initialisation | 55 |
| 3.6 Object Deletion | 57 |
| 3.7 JVM Termination | 58 |
| 3.8 Exception Handling | 58 |
| 3.9 Instructions | 59 |
| 3.9.1 Data-manipulation instructions | 61 |
| 3.9.2 Control instructions | 64 |
| 3.9.3 Stack-manipulating instructions | 67 |
| 3.9.4 Support for object orientation | 67 |
| 69 | 67 |
---|
| 3.9.5 Synchronisation | 72 |
| 3.10 Concluding Remarks | 72 |
| 4 DIY VMs | 72 |
---|
| 73 | 72 |
---|
| 4.1 Introduction | 73 |
| 4.2 ALEX | 74 |
| 4.2.1 Language Overview | 74 |
| 4.2.2 What the Virtual Machine Must Support | 77 |
| 4.2.3 Virtual Machine-Storage Structures | 78 |
| 4.2.4 Virtual Machine-Registers | 80 |
| 4.2 .5 Virtual Machine-Instruction Set | 82 |
| 4.2.6 An Example | 91 |
| 4.2.7 Implementation | 93 |
| 4.2.8 Extensions | 97 |
| 4.2.9 Alternatives | 100 |
| 4.2.10 Specification | 105 |
| 4.3 Issues | 108 |
| 4.3.1 Indirect and Relative Jumps | 109 |
| 4.3.2 More Data Types | 110 |
| 4.3.3 Higher-Order Routines | 118 |
| 4.3.4 Primitive Routines | 118 |
| 4.4 Concluding Remarks | 119 |
| 5 More Stack-Based VMs | 119 |
---|
| 121 | 119 |
---|
| 5.1 Introduction | 121 |
| 5.2 A Simple Object-Oriented Language | 122 |
| 5.2.1 Language Overview | 122 |
| 5.2 .2 Virtual Machine-Storage Structures | 123 |
| 5.2.3 Virtual Machine-Registers | 125 |
| 5.2.4 Virtual Machine-Instruction Set | 125 |
| 5.2.5 Extensions | 128 |
| 5.2.6 Alternatives | 128 |
| 5.3 A Parallel Language | 129 |
| 5.3.1 Language Overview | 129 |
| 5.3.2 Virtual Machine-Storage Structures | 131 |
| 5.3.3 Virtual Machine-Registers | 133 |
| 5.3.4 Virtual Machine-Instruction Set | 134 |
| 5.3.5 Implementation | 136 |
| 5.3.6 Extensions | 138 |
| 5.3.7 Alternatives | 140 |
| 5.3.8 Issues | 141 |
| 5.4 Concluding Remarks | 141 |
| 5.4.1 Some Optimisations | 141 |
| 5.4.2 Combining the Languages | 142 |
| 6 Case Study: An Event-Driven Language | 142 |
---|
| 143 | 142 |
---|
| 6.1 Introduction | 143 |
| 6.2 The Structure of Rules | 145 |
| 6.3 Events | 148 |
| 6.4 Execution Cycle | 148 |
| 6.5 Interpretation Rules | 150 |
| 6.6 VM Specification | 153 |
| 6.6.1 States and Notational Conventions | 154 |
| 6.6.2 Infra-Rule Transitions | 157 |
| 6.6.3 Extra-Rule Transitions | 160 |
| 6.6.4 VM-Only Transitions | 162 |
| 6.6.5 Introspective Operations | 163 |
| 6.7 Rule Equivalences | 165 |
| 6.8 Concluding Remarks | 166 |
| 7 Register-Bas
|