Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/48364 )

Change subject: configs,python: Clean some cruft out of m5.objects.
......................................................................

configs,python: Clean some cruft out of m5.objects.

SimObject is already available as m5.SimObject, and it doesn't make a
lot of sense to expose m5.internal.params, part of the internals of
gem5's python interface, as a peer to all the SimObject types.

Change-Id: I3030c1eb261877fd9648c9d3d73b7dbbd4c24345
---
M configs/common/ObjectList.py
M src/python/m5/objects/__init__.py
M src/python/m5/simulate.py
3 files changed, 6 insertions(+), 17 deletions(-)



diff --git a/configs/common/ObjectList.py b/configs/common/ObjectList.py
index aa3bda0..685dbc1 100644
--- a/configs/common/ObjectList.py
+++ b/configs/common/ObjectList.py
@@ -35,6 +35,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 import m5.objects
+import m5.internal.params
 import inspect
 import sys
 from textwrap import TextWrapper
diff --git a/src/python/m5/objects/__init__.py b/src/python/m5/objects/__init__.py
index e59f9a8..4bec74df 100644
--- a/src/python/m5/objects/__init__.py
+++ b/src/python/m5/objects/__init__.py
@@ -24,14 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from m5.internal import params
-from m5.SimObject import *
-
-try:
-    modules = __spec__.loader_state
-except NameError:
-    modules = { }
-
-for module in modules:
+for module in __spec__.loader_state:
     if module.startswith('m5.objects.'):
         exec("from %s import *" % module)
diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py
index 4a05095..66e6a08 100644
--- a/src/python/m5/simulate.py
+++ b/src/python/m5/simulate.py
@@ -50,6 +50,7 @@
 from . import SimObject
 from . import ticks
 from . import objects
+from . import params
 from m5.util.dot_writer import do_dot, do_dvfs_dot
 from m5.util.dot_writer_ruby import do_ruby_dot

@@ -59,12 +60,6 @@
 # define a MaxTick parameter, unsigned 64 bit
 MaxTick = 2**64 - 1

-_memory_modes = {
-    "atomic" : objects.params.atomic,
-    "timing" : objects.params.timing,
-    "atomic_noncaching" : objects.params.atomic_noncaching,
-    }
-
 _drain_manager = _m5.drain.DrainManager.instance()

 # The final hook to generate .ini files.  Called from the user script
@@ -292,8 +287,9 @@
             raise RuntimeError(
                 "Old CPU (%s) does not support CPU handover." % (old_cpu,))

+    MemoryMode = params.allEnums["MemoryMode"]
     try:
-        memory_mode = _memory_modes[memory_mode_name]
+        memory_mode = MemoryMode(memory_mode_name).getValue()
     except KeyError:
         raise RuntimeError("Invalid memory mode (%s)" % memory_mode_name)

@@ -309,7 +305,7 @@
         # Flush the memory system if we are switching to a memory mode
         # that disables caches. This typically happens when switching to a
         # hardware virtualized CPU.
-        if memory_mode == objects.params.atomic_noncaching:
+        if memory_mode == MemoryMode("atomic_noncaching").getValue():
             memWriteback(system)
             memInvalidate(system)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48364
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: I3030c1eb261877fd9648c9d3d73b7dbbd4c24345
Gerrit-Change-Number: 48364
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[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

Reply via email to