tools/mpy-tool.py: Fix init of QStrWindow, and remove unused variable.
The qstr window size is not log-2 encoded, it's just the actual number (but in mpy-tool.py this didn't lead to an error because the size is just used to truncate the window so it doesn't grow arbitrarily large in memory). Addresses issue #4635.
This commit is contained in:
parent
4831e38c7e
commit
74ed06828f
|
@ -75,9 +75,9 @@ for n in qstrutil.static_qstr_list:
|
||||||
global_qstrs.append(QStrType(n))
|
global_qstrs.append(QStrType(n))
|
||||||
|
|
||||||
class QStrWindow:
|
class QStrWindow:
|
||||||
def __init__(self, size_log2):
|
def __init__(self, size):
|
||||||
self.window = []
|
self.window = []
|
||||||
self.size = 1 << size_log2
|
self.size = size
|
||||||
|
|
||||||
def push(self, val):
|
def push(self, val):
|
||||||
self.window = [val] + self.window[:self.size - 1]
|
self.window = [val] + self.window[:self.size - 1]
|
||||||
|
@ -633,7 +633,6 @@ def read_qstr_and_pack(f, bytecode, qstr_win):
|
||||||
bytecode.append(qst >> 8)
|
bytecode.append(qst >> 8)
|
||||||
|
|
||||||
def read_bytecode(file, bytecode, qstr_win):
|
def read_bytecode(file, bytecode, qstr_win):
|
||||||
QSTR_LAST_STATIC = len(qstrutil.static_qstr_list)
|
|
||||||
while not bytecode.is_full():
|
while not bytecode.is_full():
|
||||||
op = read_byte(file, bytecode)
|
op = read_byte(file, bytecode)
|
||||||
f, sz = mp_opcode_format(bytecode.buf, bytecode.idx - 1, False)
|
f, sz = mp_opcode_format(bytecode.buf, bytecode.idx - 1, False)
|
||||||
|
|
Loading…
Reference in New Issue