@@ -312,18 +312,14 @@ class NativeCall: public NativeInstruction {
312
312
inline NativeCall* nativeCall_at (address addr) {
313
313
assert_cond (addr != NULL );
314
314
NativeCall* call = (NativeCall*)(addr - NativeCall::instruction_offset);
315
- #ifdef ASSERT
316
- call->verify ();
317
- #endif
315
+ DEBUG_ONLY (call->verify ());
318
316
return call;
319
317
}
320
318
321
319
inline NativeCall* nativeCall_before (address return_address) {
322
320
assert_cond (return_address != NULL );
323
321
NativeCall* call = (NativeCall*)(return_address - NativeCall::return_address_offset);
324
- #ifdef ASSERT
325
- call->verify ();
326
- #endif
322
+ DEBUG_ONLY (call->verify ());
327
323
return call;
328
324
}
329
325
@@ -363,16 +359,16 @@ class NativeMovConstReg: public NativeInstruction {
363
359
}
364
360
365
361
intptr_t data () const ;
366
- void set_data (intptr_t x);
362
+ void set_data (intptr_t x);
367
363
368
364
void flush () {
369
365
if (!maybe_cpool_ref (instruction_address ())) {
370
366
ICache::invalidate_range (instruction_address (), movptr_instruction_size);
371
367
}
372
368
}
373
369
374
- void verify ();
375
- void print ();
370
+ void verify ();
371
+ void print ();
376
372
377
373
// Creation
378
374
inline friend NativeMovConstReg* nativeMovConstReg_at (address addr);
@@ -382,55 +378,53 @@ class NativeMovConstReg: public NativeInstruction {
382
378
inline NativeMovConstReg* nativeMovConstReg_at (address addr) {
383
379
assert_cond (addr != NULL );
384
380
NativeMovConstReg* test = (NativeMovConstReg*)(addr - NativeMovConstReg::instruction_offset);
385
- #ifdef ASSERT
386
- test->verify ();
387
- #endif
381
+ DEBUG_ONLY (test->verify ());
388
382
return test;
389
383
}
390
384
391
385
inline NativeMovConstReg* nativeMovConstReg_before (address addr) {
392
386
assert_cond (addr != NULL );
393
387
NativeMovConstReg* test = (NativeMovConstReg*)(addr - NativeMovConstReg::instruction_size - NativeMovConstReg::instruction_offset);
394
- #ifdef ASSERT
395
- test->verify ();
396
- #endif
388
+ DEBUG_ONLY (test->verify ());
397
389
return test;
398
390
}
399
391
400
- // RISCV should not use C1 runtime patching, so just leave NativeMovRegMem Unimplemented.
392
+ // RISCV should not use C1 runtime patching, but still implement
393
+ // NativeMovRegMem to keep some compilers happy.
401
394
class NativeMovRegMem : public NativeInstruction {
402
395
public:
403
- int instruction_start () const {
404
- Unimplemented ();
405
- return 0 ;
406
- }
396
+ enum RISCV_specific_constants {
397
+ instruction_size = NativeInstruction::instruction_size,
398
+ instruction_offset = 0 ,
399
+ data_offset = 0 ,
400
+ next_instruction_offset = NativeInstruction::instruction_size
401
+ };
407
402
408
- address instruction_address () const {
409
- Unimplemented ();
410
- return NULL ;
411
- }
403
+ int instruction_start () const { return instruction_offset; }
412
404
413
- int num_bytes_to_end_of_patch () const {
414
- Unimplemented ();
415
- return 0 ;
416
- }
405
+ address instruction_address () const { return addr_at (instruction_offset); }
406
+
407
+ int num_bytes_to_end_of_patch () const { return instruction_offset + instruction_size; }
417
408
418
409
int offset () const ;
419
410
420
411
void set_offset (int x);
421
412
422
- void add_offset_in_bytes (int add_offset) { Unimplemented (); }
413
+ void add_offset_in_bytes (int add_offset) {
414
+ set_offset (offset () + add_offset);
415
+ }
423
416
424
417
void verify ();
425
418
void print ();
426
419
427
420
private:
428
- inline friend NativeMovRegMem* nativeMovRegMem_at (address addr);
421
+ inline friend NativeMovRegMem* nativeMovRegMem_at (address addr);
429
422
};
430
423
431
- inline NativeMovRegMem* nativeMovRegMem_at (address addr) {
432
- Unimplemented ();
433
- return NULL ;
424
+ inline NativeMovRegMem* nativeMovRegMem_at (address addr) {
425
+ NativeMovRegMem* test = (NativeMovRegMem*)(addr - NativeMovRegMem::instruction_offset);
426
+ DEBUG_ONLY (test->verify ());
427
+ return test;
434
428
}
435
429
436
430
class NativeJump : public NativeInstruction {
@@ -461,9 +455,7 @@ class NativeJump: public NativeInstruction {
461
455
462
456
inline NativeJump* nativeJump_at (address addr) {
463
457
NativeJump* jump = (NativeJump*)(addr - NativeJump::instruction_offset);
464
- #ifdef ASSERT
465
- jump->verify ();
466
- #endif
458
+ DEBUG_ONLY (jump->verify ());
467
459
return jump;
468
460
}
469
461
0 commit comments