From a2d246b6b8379f9a74dbc56feefc155f615b5ea4 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Thu, 16 Oct 2014 05:49:51 -0400 Subject: arch: Use shared_ptr for all Faults This patch takes quite a large step in transitioning from the ad-hoc RefCountingPtr to the c++11 shared_ptr by adopting its use for all Faults. There are no changes in behaviour, and the code modifications are mostly just replacing "new" with "make_shared". --- src/arch/alpha/isa/decoder.isa | 26 +++++++++++++------------- src/arch/alpha/isa/fp.isa | 2 +- src/arch/alpha/isa/opcdec.isa | 2 +- src/arch/alpha/isa/unimp.isa | 2 +- src/arch/alpha/isa/unknown.isa | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/arch/alpha/isa') diff --git a/src/arch/alpha/isa/decoder.isa b/src/arch/alpha/isa/decoder.isa index 93863b50d..c77ca434f 100644 --- a/src/arch/alpha/isa/decoder.isa +++ b/src/arch/alpha/isa/decoder.isa @@ -120,7 +120,7 @@ decode OPCODE default Unknown::unknown() { // signed overflow occurs when operands have same sign // and sign of result does not match. if (Ra_sl<31:> == Rb_or_imm_sl<31:> && tmp<31:> != Ra_sl<31:>) - fault = new IntegerOverflowFault; + fault = std::make_shared(); Rc_sl = tmp; }}); 0x02: s4addl({{ Rc_sl = (Ra_sl << 2) + Rb_or_imm_sl; }}); @@ -132,7 +132,7 @@ decode OPCODE default Unknown::unknown() { // signed overflow occurs when operands have same sign // and sign of result does not match. if (Ra<63:> == Rb_or_imm<63:> && tmp<63:> != Ra<63:>) - fault = new IntegerOverflowFault; + fault = std::make_shared(); Rc = tmp; }}); 0x22: s4addq({{ Rc = (Ra << 2) + Rb_or_imm; }}); @@ -146,7 +146,7 @@ decode OPCODE default Unknown::unknown() { // sign bit of the subtrahend (Rb), i.e., if the initial // signs are the *same* then no overflow can occur if (Ra_sl<31:> != Rb_or_imm_sl<31:> && tmp<31:> != Ra_sl<31:>) - fault = new IntegerOverflowFault; + fault = std::make_shared(); Rc_sl = tmp; }}); 0x0b: s4subl({{ Rc_sl = (Ra_sl << 2) - Rb_or_imm_sl; }}); @@ -160,7 +160,7 @@ decode OPCODE default Unknown::unknown() { // sign bit of the subtrahend (Rb), i.e., if the initial // signs are the *same* then no overflow can occur if (Ra<63:> != Rb_or_imm<63:> && tmp<63:> != Ra<63:>) - fault = new IntegerOverflowFault; + fault = std::make_shared(); Rc = tmp; }}); 0x2b: s4subq({{ Rc = (Ra << 2) - Rb_or_imm; }}); @@ -313,7 +313,7 @@ decode OPCODE default Unknown::unknown() { // checking the upper 33 bits for all 0s or all 1s. uint64_t sign_bits = tmp<63:31>; if (sign_bits != 0 && sign_bits != mask(33)) - fault = new IntegerOverflowFault; + fault = std::make_shared(); Rc_sl = tmp<31:0>; }}, IntMultOp); 0x60: mulqv({{ @@ -324,7 +324,7 @@ decode OPCODE default Unknown::unknown() { // the lower 64 if (!((hi == 0 && lo<63:> == 0) || (hi == mask(64) && lo<63:> == 1))) - fault = new IntegerOverflowFault; + fault = std::make_shared(); Rc = lo; }}, IntMultOp); } @@ -603,19 +603,19 @@ decode OPCODE default Unknown::unknown() { #if SS_COMPATIBLE_FP 0x0b: sqrts({{ if (Fb < 0.0) - fault = new ArithmeticFault; + fault = std::make_shared(); Fc = sqrt(Fb); }}, FloatSqrtOp); #else 0x0b: sqrts({{ if (Fb_sf < 0.0) - fault = new ArithmeticFault; + fault = std::make_shared(); Fc_sf = sqrt(Fb_sf); }}, FloatSqrtOp); #endif 0x2b: sqrtt({{ if (Fb < 0.0) - fault = new ArithmeticFault; + fault = std::make_shared(); Fc = sqrt(Fb); }}, FloatSqrtOp); } @@ -746,7 +746,7 @@ decode OPCODE default Unknown::unknown() { // checking the upper 33 bits for all 0s or all 1s. uint64_t sign_bits = Fb_uq<63:31>; if (sign_bits != 0 && sign_bits != mask(33)) - fault = new IntegerOverflowFault; + fault = std::make_shared(); Fc_uq = (Fb_uq<31:30> << 62) | (Fb_uq<29:0> << 29); }}); @@ -854,7 +854,7 @@ decode OPCODE default Unknown::unknown() { && xc->readMiscReg(IPR_ICM) != mode_kernel)) { // invalid pal function code, or attempt to do privileged // PAL call in non-kernel mode - fault = new UnimplementedOpcodeFault; + fault = std::make_shared(); } else { // check to see if simulator wants to do something special // on this PAL call (including maybe suppress it) @@ -904,7 +904,7 @@ decode OPCODE default Unknown::unknown() { IprToMiscRegIndex[ipr_index] : -1; if(miscRegIndex < 0 || !IprIsReadable(miscRegIndex) || miscRegIndex >= NumInternalProcRegs) - fault = new UnimplementedOpcodeFault; + fault = std::make_shared(); else Ra = xc->readMiscReg(miscRegIndex); }}, IsIprAccess); @@ -919,7 +919,7 @@ decode OPCODE default Unknown::unknown() { IprToMiscRegIndex[ipr_index] : -1; if(miscRegIndex < 0 || !IprIsWritable(miscRegIndex) || miscRegIndex >= NumInternalProcRegs) - fault = new UnimplementedOpcodeFault; + fault = std::make_shared(); else xc->setMiscReg(miscRegIndex, Ra); if (traceData) { traceData->setData(Ra); } diff --git a/src/arch/alpha/isa/fp.isa b/src/arch/alpha/isa/fp.isa index 78a366ed2..4d19f1421 100644 --- a/src/arch/alpha/isa/fp.isa +++ b/src/arch/alpha/isa/fp.isa @@ -46,7 +46,7 @@ output exec {{ { Fault fault = NoFault; // dummy... this ipr access should not fault if (FullSystem && !ICSR_FPE(xc->readMiscReg(IPR_ICSR))) { - fault = new FloatEnableFault; + fault = std::make_shared(); } return fault; } diff --git a/src/arch/alpha/isa/opcdec.isa b/src/arch/alpha/isa/opcdec.isa index 0051ea828..ceb25cd96 100644 --- a/src/arch/alpha/isa/opcdec.isa +++ b/src/arch/alpha/isa/opcdec.isa @@ -69,7 +69,7 @@ output exec {{ OpcdecFault::execute(CPU_EXEC_CONTEXT *xc, Trace::InstRecord *traceData) const { - return new UnimplementedOpcodeFault; + return std::make_shared(); } }}; diff --git a/src/arch/alpha/isa/unimp.isa b/src/arch/alpha/isa/unimp.isa index f9643d6b4..26ec1c2bd 100644 --- a/src/arch/alpha/isa/unimp.isa +++ b/src/arch/alpha/isa/unimp.isa @@ -118,7 +118,7 @@ output exec {{ { panic("attempt to execute unimplemented instruction '%s' " "(inst 0x%08x, opcode 0x%x)", mnemonic, machInst, OPCODE); - return new UnimplementedOpcodeFault; + return std::make_shared(); } Fault diff --git a/src/arch/alpha/isa/unknown.isa b/src/arch/alpha/isa/unknown.isa index b2e7d2d1b..f356f24d8 100644 --- a/src/arch/alpha/isa/unknown.isa +++ b/src/arch/alpha/isa/unknown.isa @@ -49,7 +49,7 @@ output exec {{ { panic("attempt to execute unknown instruction " "(inst 0x%08x, opcode 0x%x)", machInst, OPCODE); - return new UnimplementedOpcodeFault; + return std::make_shared(); } }}; -- cgit v1.2.3