@@ -132,16 +132,15 @@ object X86Interpreter {
132
132
val strict : Boolean ) {
133
133
134
134
135
-
136
135
def read (arg : Arg ): Long = arg match {
137
136
case Imm (v) => v
138
- case Reg (reg) => this .registers(reg)
137
+ case Reg (reg) => this .registers.getOrElse (reg, throw new RuntimeException ( " The interpreter to read register " + reg + " that had no value. " ) )
139
138
case Deref (reg, offset) =>
140
- val addr = this .registers(reg) + offset
139
+ val addr = this .registers.getOrElse (reg, throw new RuntimeException ( " The interpreter to read register " + reg + " that had no value. " ) ) + offset
141
140
assert(addr % 8 == 0 , " Offset reads not supported" )
142
141
if (strict) assert(addr >= registers(RSP ()), " Write outside of stack" )
143
142
this .memory(addr)
144
- case XVar (name) => this .variables(name)
143
+ case XVar (name) => this .variables.getOrElse (name, throw new RuntimeException ( " The interpreter to read variable " + name + " that had no value. " ) )
145
144
case ByteRegister (reg) => reg match {
146
145
case AL () => this .registers(RAX ()).toByte
147
146
case BL () => this .registers(RBX ()).toByte
@@ -158,7 +157,7 @@ object X86Interpreter {
158
157
case Imm (_) => assert(false , " Write to immediate value" )
159
158
case Reg (reg) => this .registers(reg) = w
160
159
case Deref (reg, offset) =>
161
- val addr = this .registers(reg) + offset
160
+ val addr = this .registers.getOrElse (reg, throw new RuntimeException ( " The interpreter to read register " + reg + " that had no value. " ) ) + offset
162
161
assert(addr % 8 == 0 , " Offset reads not supported" )
163
162
if (strict) assert(addr >= registers(RSP ()), " Write outside of stack" )
164
163
this .memory(addr) = w
0 commit comments