misc: string.join has been removed in python3

In general string methods are deprecated in favour of str ones

Change-Id: Ifba04e0b70be29e5a82a67cf11837f740de57e32
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26244
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2020-02-28 13:48:12 +00:00
parent 735267e111
commit 4e7fe439d7
8 changed files with 13 additions and 16 deletions

View File

@@ -57,7 +57,7 @@ let {{
# This shouldn't be part of the eaCode, but until the exec templates
# are converted over it's the easiest place to put it.
eaCode += '\n unsigned memAccessFlags = '
eaCode += (string.join(memFlags, '|') + ';')
eaCode += ('|'.join(memFlags) + ';')
codeBlobs["ea_code"] = eaCode

View File

@@ -41,7 +41,6 @@ from __future__ import with_statement, print_function
import os
import sys
import re
import string
import inspect, traceback
# get type names
from types import *
@@ -231,7 +230,7 @@ class Format(object):
self.params = params
label = 'def format ' + id
self.user_code = compile(fixPythonIndentation(code), label, 'exec')
param_list = string.join(params, ", ")
param_list = ", ".join(params)
f = '''def defInst(_code, _context, %s):
my_locals = vars().copy()
exec _code in _context, my_locals
@@ -1399,7 +1398,7 @@ def makeFlagConstructor(flag_list):
i += 1
pre = '\n\tflags['
post = '] = true;'
code = pre + string.join(flag_list, post + pre) + post
code = pre + (post + pre).join(flag_list) + post
return code
# Assume all instruction flags are of the form 'IsFoo'
@@ -1584,7 +1583,7 @@ class ISAParser(Grammar):
# file where it was included.
self.fileNameStack = Stack()
symbols = ('makeList', 're', 'string')
symbols = ('makeList', 're')
self.exportContext = dict([(s, eval(s)) for s in symbols])
self.maxInstSrcRegs = 0
@@ -2597,7 +2596,7 @@ StaticInstPtr
(?<!\w) # neg. lookbehind assertion: prevent partial matches
((%s)(?:_(%s))?) # match: operand with optional '_' then suffix
(?!\w) # neg. lookahead assertion: prevent partial matches
''' % (string.join(operands, '|'), string.join(extensions, '|'))
''' % ('|'.join(operands), '|'.join(extensions))
self.operandsRE = re.compile(operandsREString, re.MULTILINE|re.VERBOSE)
@@ -2605,7 +2604,7 @@ StaticInstPtr
# groups are returned (base and ext, not full name as above).
# Used for subtituting '_' for '.' to make C++ identifiers.
operandsWithExtREString = r'(?<!\w)(%s)_(%s)(?!\w)' \
% (string.join(operands, '|'), string.join(extensions, '|'))
% ('|'.join(operands), '|'.join(extensions))
self.operandsWithExtRE = \
re.compile(operandsWithExtREString, re.MULTILINE)

View File

@@ -29,7 +29,6 @@ from __future__ import print_function
import os
import sys
import re
import string
import traceback
# get type names
from types import *

View File

@@ -50,7 +50,7 @@ def LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
if mem_flags:
mem_flags = [ 'Request::%s' % flag for flag in mem_flags ]
s = '\n\tmemAccessFlags = ' + string.join(mem_flags, '|') + ';'
s = '\n\tmemAccessFlags = ' + '|'.join(mem_flags) + ';'
iop.constructor += s
# select templates

View File

@@ -100,7 +100,7 @@ def LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
inst_flags)
if mem_flags:
s = '\n\tmemAccessFlags = ' + string.join(mem_flags, '|') + ';'
s = '\n\tmemAccessFlags = ' + '|'.join(mem_flags) + ';'
iop.constructor += s
fullExecTemplate = eval(exec_template_base + 'Execute')

View File

@@ -73,7 +73,7 @@ def LoadStoreBase(name, Name, offset_code, ea_code, memacc_code, mem_flags,
if mem_flags:
mem_flags = [ 'Request::%s' % flag for flag in mem_flags ]
s = '\n\tmemAccessFlags = ' + string.join(mem_flags, '|') + ';'
s = '\n\tmemAccessFlags = ' + '|'.join(mem_flags) + ';'
iop.constructor += s
# select templates

View File

@@ -124,7 +124,7 @@ let {{
def format Swap(code, postacc_code, mem_flags, *opt_flags) {{
mem_flags = makeList(mem_flags)
mem_flags = [ 'Request::%s' % flag for flag in mem_flags ]
flags = string.join(mem_flags, '|')
flags = '|'.join(mem_flags)
(header_output,
decoder_output,
@@ -137,7 +137,7 @@ def format SwapAlt(code, postacc_code, mem_flags, *opt_flags) {{
mem_flags = makeList(mem_flags)
mem_flags = [ 'Request::%s' % flag for flag in mem_flags ]
mem_flags.append("EXT_ASI")
flags = string.join(mem_flags, '|')
flags = '|'.join(mem_flags)
(header_output,
decoder_output,
exec_output,
@@ -169,7 +169,7 @@ def format CasAlt(code, postacc_code, mem_flags, *opt_flags) {{
mem_flags = makeList(mem_flags)
mem_flags = [ 'Request::%s' % flag for flag in mem_flags ]
mem_flags.append("EXT_ASI")
flags = string.join(mem_flags, '|')
flags = '|'.join(mem_flags)
(header_output,
decoder_output,
exec_output,

View File

@@ -35,7 +35,6 @@ except ImportError:
import inspect
import os
import re
import string
class lookup(object):
def __init__(self, formatter, frame, *args, **kwargs):
@@ -164,7 +163,7 @@ class code_formatter(object):
f.close()
def __str__(self):
data = string.join(self._data, '')
data = ''.join(self._data)
self._data = [ data ]
return data