Jason Lowe-Power has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/58442 )
Change subject: mem-ruby: Use function for backwards compat. ruby
......................................................................
mem-ruby: Use function for backwards compat. ruby
Instead of simply renaming the class, add a function which can be
evaluated at runtime to get the new class name. Note that this will
break any code which uses these classes as a base class. This should be
fixed in prior changes.
Change-Id: Id0ff17026d89322f8506ffb0d0fb75eb3725d111
Signed-off-by: Jason Lowe-Power <[email protected]>
---
M src/mem/slicc/symbols/StateMachine.py
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/src/mem/slicc/symbols/StateMachine.py
b/src/mem/slicc/symbols/StateMachine.py
index 2a0d6a4..2faf19a 100644
--- a/src/mem/slicc/symbols/StateMachine.py
+++ b/src/mem/slicc/symbols/StateMachine.py
@@ -268,20 +268,26 @@
code.dedent()
- # Needed for backwards compatibility while there is only one
protocol
- # compiled. When moving to multiple protocols in the gem5 binary,
this
- # will need to change.
+ # Needed for backwards compatibility. This redefines the function
in
+ # the same way for every protocol, but it uses the
`getRubyProtocol`
+ # function to dynamically select the machine to use. Having
multiple
+ # copies of this function is not ideal, but generating a
separate .py
+ # for MachineType was not feasible.
+ # This will be removed in a later version of gem5.
code('''
-from m5.defines import buildEnv
+from m5.defines import getRubyProtocol
+from m5 import objects
from m5.util import warn
-if getRubyProtocol() == "${protocol}":
+def ${c_ident}(**args):
warn(
- "${c_indent} is deprecated. Use %s_${c_indent} instead",
+ "${c_ident} is deprecated. Use %s_${c_ident} instead",
getRubyProtocol()
)
- ${c_ident} = ${py_ident}
+ full_name = getRubyProtocol() + "_${c_ident}"
+ cls = getattr(objects, full_name)
+ return cls(**args)
''')
code.write(path, '%s.py' % gen_filename)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/58442
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id0ff17026d89322f8506ffb0d0fb75eb3725d111
Gerrit-Change-Number: 58442
Gerrit-PatchSet: 1
Gerrit-Owner: Jason Lowe-Power <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s