Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/50331 )

Change subject: scons: Make the SimObject list from the 'gem5 lib' tag.
......................................................................

scons: Make the SimObject list from the 'gem5 lib' tag.

Only include SimObject files which match the gem5 lib tag. This way we
can declare SimObjects, and then filter them out based on tags.

Change-Id: I0aca1ef830bcc7beaee80c54d58ba8a188968491
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50331
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/SConscript
1 file changed, 19 insertions(+), 4 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/SConscript b/src/SConscript
index 6b2f7e4..76f29f3 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -141,7 +141,6 @@
     it to a list of sim object modules'''

     fixed = False
-    modnames = []

     def __init__(self, source, tags=None, add_tags=None):
         '''Specify the source file and any tags (automatically in
@@ -150,8 +149,6 @@
         if self.fixed:
             raise AttributeError("Too late to call SimObject now.")

-        bisect.insort_right(SimObject.modnames, self.modname)
-

# This regular expression is simplistic and assumes that the import takes up # the entire line, doesn't have the keyword "public", uses double quotes, has
@@ -589,7 +586,9 @@

 # import all sim objects so we can populate the all_objects list
 # make sure that we're working with a list, then let's sort it
-for modname in SimObject.modnames:
+gem5_lib_simobjects = SimObject.all.with_tag(env, 'gem5 lib')
+gem5_lib_modnames = sorted(map(lambda so: so.modname, gem5_lib_simobjects))
+for modname in gem5_lib_modnames:
     exec('from m5.objects import %s' % modname)

 # we need to unload all of the currently imported modules so that they

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/50331
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: I0aca1ef830bcc7beaee80c54d58ba8a188968491
Gerrit-Change-Number: 50331
Gerrit-PatchSet: 6
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Hoa Nguyen <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Jui-min Lee <[email protected]>
Gerrit-Reviewer: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
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