From: Jacob Lifshay Date: Wed, 14 Jun 2023 05:55:49 +0000 (-0700) Subject: speed up StateSPRs.__init__ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba0ddffb14756c3fc87d51d1c78f71d4a09c7cb1;p=openpower-isa.git speed up StateSPRs.__init__ --- diff --git a/src/openpower/test/state.py b/src/openpower/test/state.py index 5d61c277..99b6a175 100644 --- a/src/openpower/test/state.py +++ b/src/openpower/test/state.py @@ -66,9 +66,13 @@ class StateRunner: class StateSPRs: KEYS = tuple(i for i in SPRfull if i != SPRfull.XER) + __EMPTY_VALUES = {k: 0 for k in KEYS} def __init__(self, values=None): - self.__values = {k: 0 for k in StateSPRs.KEYS} + if isinstance(values, StateSPRs): + self.__values = values.__values.copy() + return + self.__values = self.__EMPTY_VALUES.copy() if values is not None: for k, v in values.items(): self[k] = v