8238851: Shenandoah: C1: Resolve into registers of correct type

Reviewed-by: shade
This commit is contained in:
Roman Kennke 2020-02-11 16:01:38 +01:00
parent 1e0167ef92
commit 411766b6bb
3 changed files with 13 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -824,7 +824,7 @@ void ShenandoahBarrierSetAssembler::gen_load_reference_barrier_stub(LIR_Assemble
Register obj = stub->obj()->as_register(); Register obj = stub->obj()->as_register();
Register res = stub->result()->as_register(); Register res = stub->result()->as_register();
Register addr = stub->addr()->as_register(); Register addr = stub->addr()->as_pointer_register();
Register tmp1 = stub->tmp1()->as_register(); Register tmp1 = stub->tmp1()->as_register();
Register tmp2 = stub->tmp2()->as_register(); Register tmp2 = stub->tmp2()->as_register();
assert_different_registers(obj, res, addr, tmp1, tmp2); assert_different_registers(obj, res, addr, tmp1, tmp2);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -118,14 +118,14 @@ LIR_Opr ShenandoahBarrierSetC1::load_reference_barrier(LIRGenerator* gen, LIR_Op
LIR_Opr ShenandoahBarrierSetC1::load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj, LIR_Opr addr) { LIR_Opr ShenandoahBarrierSetC1::load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj, LIR_Opr addr) {
assert(ShenandoahLoadRefBarrier, "Should be enabled"); assert(ShenandoahLoadRefBarrier, "Should be enabled");
obj = ensure_in_register(gen, obj); obj = ensure_in_register(gen, obj, T_OBJECT);
assert(obj->is_register(), "must be a register at this point"); assert(obj->is_register(), "must be a register at this point");
addr = ensure_in_register(gen, addr); addr = ensure_in_register(gen, addr, T_ADDRESS);
assert(addr->is_register(), "must be a register at this point"); assert(addr->is_register(), "must be a register at this point");
LIR_Opr result = gen->result_register_for(obj->value_type()); LIR_Opr result = gen->result_register_for(obj->value_type());
__ move(obj, result); __ move(obj, result);
LIR_Opr tmp1 = gen->new_register(T_OBJECT); LIR_Opr tmp1 = gen->new_register(T_ADDRESS);
LIR_Opr tmp2 = gen->new_register(T_OBJECT); LIR_Opr tmp2 = gen->new_register(T_ADDRESS);
LIR_Opr thrd = gen->getThreadPointer(); LIR_Opr thrd = gen->getThreadPointer();
LIR_Address* active_flag_addr = LIR_Address* active_flag_addr =
@ -157,20 +157,14 @@ LIR_Opr ShenandoahBarrierSetC1::load_reference_barrier_impl(LIRGenerator* gen, L
return result; return result;
} }
LIR_Opr ShenandoahBarrierSetC1::ensure_in_register(LIRGenerator* gen, LIR_Opr obj) { LIR_Opr ShenandoahBarrierSetC1::ensure_in_register(LIRGenerator* gen, LIR_Opr obj, BasicType type) {
if (!obj->is_register()) { if (!obj->is_register()) {
LIR_Opr obj_reg; LIR_Opr obj_reg;
if (obj->is_constant()) { if (obj->is_constant()) {
obj_reg = gen->new_register(T_OBJECT); obj_reg = gen->new_register(type);
__ move(obj, obj_reg); __ move(obj, obj_reg);
} else { } else {
#ifdef AARCH64
// AArch64 expects double-size register.
obj_reg = gen->new_pointer_register(); obj_reg = gen->new_pointer_register();
#else
// x86 expects single-size register.
obj_reg = gen->new_register(T_OBJECT);
#endif
__ leal(obj, obj_reg); __ leal(obj, obj_reg);
} }
obj = obj_reg; obj = obj_reg;
@ -180,7 +174,7 @@ LIR_Opr ShenandoahBarrierSetC1::ensure_in_register(LIRGenerator* gen, LIR_Opr ob
LIR_Opr ShenandoahBarrierSetC1::storeval_barrier(LIRGenerator* gen, LIR_Opr obj, CodeEmitInfo* info, DecoratorSet decorators) { LIR_Opr ShenandoahBarrierSetC1::storeval_barrier(LIRGenerator* gen, LIR_Opr obj, CodeEmitInfo* info, DecoratorSet decorators) {
if (ShenandoahStoreValEnqueueBarrier) { if (ShenandoahStoreValEnqueueBarrier) {
obj = ensure_in_register(gen, obj); obj = ensure_in_register(gen, obj, T_OBJECT);
pre_barrier(gen, info, decorators, LIR_OprFact::illegalOpr, obj); pre_barrier(gen, info, decorators, LIR_OprFact::illegalOpr, obj);
} }
return obj; return obj;
@ -221,7 +215,7 @@ void ShenandoahBarrierSetC1::load_at_resolved(LIRAccess& access, LIR_Opr result)
BarrierSetC1::load_at_resolved(access, result); BarrierSetC1::load_at_resolved(access, result);
LIR_OprList* args = new LIR_OprList(); LIR_OprList* args = new LIR_OprList();
LIR_Opr addr = access.resolved_addr(); LIR_Opr addr = access.resolved_addr();
addr = ensure_in_register(gen, addr); addr = ensure_in_register(gen, addr, T_ADDRESS);
args->append(result); args->append(result);
args->append(addr); args->append(addr);
BasicTypeList signature; BasicTypeList signature;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -198,7 +198,7 @@ private:
LIR_Opr load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj, LIR_Opr addr); LIR_Opr load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj, LIR_Opr addr);
LIR_Opr ensure_in_register(LIRGenerator* gen, LIR_Opr obj); LIR_Opr ensure_in_register(LIRGenerator* gen, LIR_Opr obj, BasicType type);
public: public:
ShenandoahBarrierSetC1(); ShenandoahBarrierSetC1();