[gem5-dev] Change in gem5/gem5[develop]: scons: Get rid of some unused or unnecessary PySource members.

2021-08-31 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/48139 )


Change subject: scons: Get rid of some unused or unnecessary PySource  
members.

..

scons: Get rid of some unused or unnecessary PySource members.

These were either not used at all, or were unnecessary since they, for
instance, were used to name a variable in an anonymous namespace where
the actual name is hidden and largely irrelevant.

Change-Id: I738960cf0d84017ccc133428aef56701c1d40b03
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48139
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
M src/SConscript
1 file changed, 6 insertions(+), 9 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/SConscript b/src/SConscript
index d39fb8d..c4d246e 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -347,10 +347,8 @@

 class PySource(SourceFile):
 '''Add a python source file to the named package'''
-invalid_sym_char = re.compile('[^A-z0-9_]')
 modules = {}
 tnodes = {}
-symnames = {}

 def __init__(self, package, source, tags=None, add_tags=None):
 '''specify the python package, the source file, and any tags'''
@@ -380,13 +378,10 @@
 self.modpath = modpath
 self.arcname = os.path.join(*arcpath)
 self.abspath = abspath
-self.compiled = File(self.filename + 'c')
 self.cpp = File(self.filename + '.cc')
-self.symname = PySource.invalid_sym_char.sub('_', modpath)

 PySource.modules[modpath] = self
 PySource.tnodes[self.tnode] = self
-PySource.symnames[self.symname] = self

 class SimObject(PySource):
 '''Add a SimObject python file as a python source object and add
@@ -1205,7 +1200,6 @@
 compressed = zlib.compress(marshalled)
 data = compressed
 pysource = PySource.tnodes[source[1]]
-sym = pysource.symname

 code = code_formatter()
 code('''\
@@ -1217,13 +1211,16 @@
 {

 ''')
-bytesToCppArray(code, 'data_{}'.format(sym), data)
+bytesToCppArray(code, 'embedded_module_data', data)
+# The name of the EmbeddedPython object doesn't matter since it's in an
+# anonymous namespace, and it's constructor takes care of installing it
+# into a global list.
 code('''
-EmbeddedPython embedded_${sym}(
+EmbeddedPython embedded_module_info(
 ${{c_str(pysource.arcname)}},
 ${{c_str(pysource.abspath)}},
 ${{c_str(pysource.modpath)}},
-data_${sym},
+embedded_module_data,
 ${{len(data)}},
 ${{len(marshalled)}});


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48139
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: I738960cf0d84017ccc133428aef56701c1d40b03
Gerrit-Change-Number: 48139
Gerrit-PatchSet: 7
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Bobby Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: scons: Get rid of some unused or unnecessary PySource members.

2021-07-15 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/48139 )



Change subject: scons: Get rid of some unused or unnecessary PySource  
members.

..

scons: Get rid of some unused or unnecessary PySource members.

These were either not used at all, or were unnecessary since they, for
instance, were used to name a variable in an anonymous namespace where
the actual name is hidden and largely irrelevant.

Change-Id: I738960cf0d84017ccc133428aef56701c1d40b03
---
M src/SConscript
1 file changed, 3 insertions(+), 9 deletions(-)



diff --git a/src/SConscript b/src/SConscript
index 0048288..77fd15e 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -349,10 +349,8 @@

 class PySource(SourceFile):
 '''Add a python source file to the named package'''
-invalid_sym_char = re.compile('[^A-z0-9_]')
 modules = {}
 tnodes = {}
-symnames = {}

 def __init__(self, package, source, tags=None, add_tags=None):
 '''specify the python package, the source file, and any tags'''
@@ -382,13 +380,10 @@
 self.modpath = modpath
 self.arcname = os.path.join(*arcpath)
 self.abspath = abspath
-self.compiled = File(self.filename + 'c')
 self.cpp = File(self.filename + '.cc')
-self.symname = PySource.invalid_sym_char.sub('_', modpath)

 PySource.modules[modpath] = self
 PySource.tnodes[self.tnode] = self
-PySource.symnames[self.symname] = self

 class SimObject(PySource):
 '''Add a SimObject python file as a python source object and add
@@ -1244,7 +1239,6 @@
 compressed = zlib.compress(marshalled)
 data = compressed
 pysource = PySource.tnodes[source[1]]
-sym = pysource.symname

 code = code_formatter()
 code('''\
@@ -1256,13 +1250,13 @@
 {

 ''')
-bytesToCppArray(code, 'data_{}'.format(sym), data)
+bytesToCppArray(code, 'embedded_module_data', data)
 code('''
-EmbeddedPython embedded_${sym}(
+EmbeddedPython embedded_module_info(
 ${{c_str(pysource.arcname)}},
 ${{c_str(pysource.abspath)}},
 ${{c_str(pysource.modpath)}},
-data_${sym},
+embedded_module_data,
 ${{len(data)}},
 ${{len(marshalled)}});


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48139
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: I738960cf0d84017ccc133428aef56701c1d40b03
Gerrit-Change-Number: 48139
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s