Skip to content

Commit 5425573

Browse files
committed
8290496: riscv: Fix build warnings-as-errors with GCC 11
Reviewed-by: yadongwang, fjiang, shade
1 parent a3e07d9 commit 5425573

File tree

2 files changed

+29
-37
lines changed

2 files changed

+29
-37
lines changed

src/hotspot/cpu/riscv/nativeInst_riscv.hpp

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -312,18 +312,14 @@ class NativeCall: public NativeInstruction {
312312
inline NativeCall* nativeCall_at(address addr) {
313313
assert_cond(addr != NULL);
314314
NativeCall* call = (NativeCall*)(addr - NativeCall::instruction_offset);
315-
#ifdef ASSERT
316-
call->verify();
317-
#endif
315+
DEBUG_ONLY(call->verify());
318316
return call;
319317
}
320318

321319
inline NativeCall* nativeCall_before(address return_address) {
322320
assert_cond(return_address != NULL);
323321
NativeCall* call = (NativeCall*)(return_address - NativeCall::return_address_offset);
324-
#ifdef ASSERT
325-
call->verify();
326-
#endif
322+
DEBUG_ONLY(call->verify());
327323
return call;
328324
}
329325

@@ -363,16 +359,16 @@ class NativeMovConstReg: public NativeInstruction {
363359
}
364360

365361
intptr_t data() const;
366-
void set_data(intptr_t x);
362+
void set_data(intptr_t x);
367363

368364
void flush() {
369365
if (!maybe_cpool_ref(instruction_address())) {
370366
ICache::invalidate_range(instruction_address(), movptr_instruction_size);
371367
}
372368
}
373369

374-
void verify();
375-
void print();
370+
void verify();
371+
void print();
376372

377373
// Creation
378374
inline friend NativeMovConstReg* nativeMovConstReg_at(address addr);
@@ -382,55 +378,53 @@ class NativeMovConstReg: public NativeInstruction {
382378
inline NativeMovConstReg* nativeMovConstReg_at(address addr) {
383379
assert_cond(addr != NULL);
384380
NativeMovConstReg* test = (NativeMovConstReg*)(addr - NativeMovConstReg::instruction_offset);
385-
#ifdef ASSERT
386-
test->verify();
387-
#endif
381+
DEBUG_ONLY(test->verify());
388382
return test;
389383
}
390384

391385
inline NativeMovConstReg* nativeMovConstReg_before(address addr) {
392386
assert_cond(addr != NULL);
393387
NativeMovConstReg* test = (NativeMovConstReg*)(addr - NativeMovConstReg::instruction_size - NativeMovConstReg::instruction_offset);
394-
#ifdef ASSERT
395-
test->verify();
396-
#endif
388+
DEBUG_ONLY(test->verify());
397389
return test;
398390
}
399391

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.
401394
class NativeMovRegMem: public NativeInstruction {
402395
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+
};
407402

408-
address instruction_address() const {
409-
Unimplemented();
410-
return NULL;
411-
}
403+
int instruction_start() const { return instruction_offset; }
412404

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; }
417408

418409
int offset() const;
419410

420411
void set_offset(int x);
421412

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+
}
423416

424417
void verify();
425418
void print();
426419

427420
private:
428-
inline friend NativeMovRegMem* nativeMovRegMem_at (address addr);
421+
inline friend NativeMovRegMem* nativeMovRegMem_at(address addr);
429422
};
430423

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;
434428
}
435429

436430
class NativeJump: public NativeInstruction {
@@ -461,9 +455,7 @@ class NativeJump: public NativeInstruction {
461455

462456
inline NativeJump* nativeJump_at(address addr) {
463457
NativeJump* jump = (NativeJump*)(addr - NativeJump::instruction_offset);
464-
#ifdef ASSERT
465-
jump->verify();
466-
#endif
458+
DEBUG_ONLY(jump->verify());
467459
return jump;
468460
}
469461

src/hotspot/cpu/riscv/vtableStubs_riscv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
171171
assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0");
172172

173173
// Entry arguments:
174-
// t2: CompiledICHolder
174+
// t1: CompiledICHolder
175175
// j_rarg0: Receiver
176176

177177
// This stub is called from compiled code which has no callee-saved registers,

0 commit comments

Comments
 (0)