@@ -163,7 +163,7 @@ private static void init(VirtualMachine vm, InstanceJavaClass unsafe, UnsafeHelp
163
163
throw new PanicException ("Segfault" );
164
164
}
165
165
val value = (ObjectValue ) obj ;
166
- val offset = ( int ) locals .load (2 ).asLong ();
166
+ val offset = locals .load (2 ).asLong ();
167
167
val expected = locals .load (4 ).asInt ();
168
168
val x = locals .load (5 ).asInt ();
169
169
val memoryManager = vm .getMemoryManager ();
@@ -189,7 +189,7 @@ private static void init(VirtualMachine vm, InstanceJavaClass unsafe, UnsafeHelp
189
189
throw new PanicException ("Segfault" );
190
190
}
191
191
val value = (ObjectValue ) obj ;
192
- val offset = ( int ) locals .load (2 ).asLong ();
192
+ val offset = locals .load (2 ).asLong ();
193
193
val expected = locals .<ObjectValue >load (4 );
194
194
val x = locals .<ObjectValue >load (5 );
195
195
val memoryManager = vm .getMemoryManager ();
@@ -212,7 +212,7 @@ private static void init(VirtualMachine vm, InstanceJavaClass unsafe, UnsafeHelp
212
212
throw new PanicException ("Segfault" );
213
213
}
214
214
val value = (ObjectValue ) $value ;
215
- val offset = ( int ) locals .load (2 ).asLong ();
215
+ val offset = locals .load (2 ).asLong ();
216
216
val expected = locals .load (4 ).asLong ();
217
217
val x = locals .load (6 ).asLong ();
218
218
val memoryManager = vm .getMemoryManager ();
@@ -282,20 +282,28 @@ private static void init(VirtualMachine vm, InstanceJavaClass unsafe, UnsafeHelp
282
282
ctx .setResult (LongValue .M_ONE );
283
283
return Result .ABORT ;
284
284
});
285
+ vmi .setInvoker (unsafe , "putByte" , "(JB)V" , ctx -> {
286
+ val memoryManager = vm .getMemoryManager ();
287
+ val locals = ctx .getLocals ();
288
+ val address = locals .load (1 ).asLong ();
289
+ val block = nonNull (memoryManager .getMemory (address ));
290
+ block .getData ().writeByte (address - block .getAddress (), locals .load (3 ).asByte ());
291
+ return Result .ABORT ;
292
+ });
285
293
vmi .setInvoker (unsafe , "putLong" , "(JJ)V" , ctx -> {
286
294
val memoryManager = vm .getMemoryManager ();
287
295
val locals = ctx .getLocals ();
288
296
val address = locals .load (1 ).asLong ();
289
297
val block = nonNull (memoryManager .getMemory (address ));
290
- block .getData ().writeLong (( int ) ( address - block .getAddress () ), locals .load (3 ).asLong ());
298
+ block .getData ().writeLong (address - block .getAddress (), locals .load (3 ).asLong ());
291
299
return Result .ABORT ;
292
300
});
293
301
vmi .setInvoker (unsafe , "getByte" , "(J)B" , ctx -> {
294
302
val memoryManager = vm .getMemoryManager ();
295
303
val locals = ctx .getLocals ();
296
304
val address = locals .load (1 ).asLong ();
297
305
val block = nonNull (memoryManager .getMemory (address ));
298
- ctx .setResult (IntValue .of (block .getData ().readByte (( int ) ( address - block .getAddress () ))));
306
+ ctx .setResult (IntValue .of (block .getData ().readByte (address - block .getAddress ())));
299
307
return Result .ABORT ;
300
308
});
301
309
vmi .setInvoker (unsafe , "putInt" , "(Ljava/lang/Object;JI)V" , ctx -> {
@@ -346,7 +354,7 @@ private static void init(VirtualMachine vm, InstanceJavaClass unsafe, UnsafeHelp
346
354
vmi .setInvoker (unsafe , "getLong" , "(J)J" , ctx -> {
347
355
val address = ctx .getLocals ().load (1 ).asLong ();
348
356
val block = nonNull (vm .getMemoryManager ().getMemory (address ));
349
- ctx .setResult (LongValue .of (block .getData ().readLong (( int ) ( address - block .getAddress () ))));
357
+ ctx .setResult (LongValue .of (block .getData ().readLong (address - block .getAddress ())));
350
358
return Result .ABORT ;
351
359
});
352
360
vmi .setInvoker (unsafe , "defineAnonymousClass" , "(Ljava/lang/Class;[B[Ljava/lang/Object;)Ljava/lang/Class;" , ctx -> {
0 commit comments