From: Giacomo Travaglini Date: Wed, 26 Feb 2020 13:46:24 +0000 (+0000) Subject: arch-arm: Speedup ARM execution by avoiding expensive RTTI check X-Git-Tag: v20.0.0.0~405 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ea33d438a2253ba864d19046a495e60f9e2424ed;p=gem5.git arch-arm: Speedup ARM execution by avoiding expensive RTTI check getArmSystem is the building block for a lot of ArmSystem getters a client can use to check for a specific feature. This method is called very often during simulation and it is basically casting a System pointer into an ArmSystem pointer. To do so, it is using dynamic casting to check if the system is really an ArmSystem. This is very expensive and usually not needed. The only chance arm code would use a non ArmSystem is when in SE mode. But if that's the case, we can just replace the assertion with a assert(FullSystem). Testing Linux boot with this patch provides a speedup of nearly 2x! (atomic mode). This is partially related to: JIRA: https://gem5.atlassian.net/browse/GEM5-337 Since the PAuth patch changed the purifyTagged helper (on the critical path of simulation) to rely more heavilly on getArmSystem (via ArmSystem:: static methods) Change-Id: Idbf079548ffe03513b4fc58c76f0d69613952a50 Signed-off-by: Giacomo Travaglini Reviewed-by: Ciro Santilli Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25964 Tested-by: kokoro --- diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc index d40133916..f9bfdec92 100644 --- a/src/arch/arm/system.cc +++ b/src/arch/arm/system.cc @@ -183,9 +183,8 @@ ArmSystem::initState() ArmSystem* ArmSystem::getArmSystem(ThreadContext *tc) { - ArmSystem *a_sys = dynamic_cast(tc->getSystemPtr()); - assert(a_sys); - return a_sys; + assert(FullSystem); + return static_cast(tc->getSystemPtr()); } bool