From b5994b79fe66ef0e17ff1099802955711ede90c5 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Wed, 31 May 2017 14:39:42 +0200 Subject: [PATCH] Optimize llDumpList2String(expr, "") to (string)expr. It works on all VMs and it's always a gain, so it's not worth adding an option to deactivate it. --- lslopt/lslfoldconst.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lslopt/lslfoldconst.py b/lslopt/lslfoldconst.py index 92b3d0b..caf8054 100644 --- a/lslopt/lslfoldconst.py +++ b/lslopt/lslfoldconst.py @@ -1009,6 +1009,14 @@ class foldconst(object): # Convert llGetListLength(expr) to (expr != []) node = {'nt':'CONST', 't':'list', 'value':[]} parent[index] = node = {'nt':'!=', 't':'list', 'ch':[child[0], node]} + elif (node['name'] == 'llDumpList2String' + and child[1]['nt'] == 'CONST' + and child[1]['t'] in ('string', 'key') + and child[1]['value'] == u""): + # Convert llDumpList2String(expr, "") to (string)(expr) + del child[1] + node['nt'] = 'CAST' + del node['name'] elif SEFargs and 'SEF' in self.symtab[0][node['name']]: # The function is marked as SEF in the symbol table, and the # arguments are all side-effect-free. The result is SEF.