[svn:parrot] r45784 - branches/immutable_strings_part2/compilers/pge/PGE
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun Apr 18 11:20:11 UTC 2010
Author: bacek
Date: Sun Apr 18 11:20:11 2010
New Revision: 45784
URL: https://trac.parrot.org/parrot/changeset/45784
Log:
Update PGE compiler to avoid in-place string ops
Modified:
branches/immutable_strings_part2/compilers/pge/PGE/Exp.pir
branches/immutable_strings_part2/compilers/pge/PGE/OPTable.pir
branches/immutable_strings_part2/compilers/pge/PGE/P5Regex.pir
branches/immutable_strings_part2/compilers/pge/PGE/Perl6Regex.pir
branches/immutable_strings_part2/compilers/pge/PGE/Regex.pir
Modified: branches/immutable_strings_part2/compilers/pge/PGE/Exp.pir
==============================================================================
--- branches/immutable_strings_part2/compilers/pge/PGE/Exp.pir Sun Apr 18 11:19:57 2010 (r45783)
+++ branches/immutable_strings_part2/compilers/pge/PGE/Exp.pir Sun Apr 18 11:20:11 2010 (r45784)
@@ -135,8 +135,8 @@
if null $P0 goto have_subid
$S0 = code.'escape'($P0)
pirflags = concat pirflags, ' :subid('
- concat pirflags, $S0
- concat pirflags, ')'
+ pirflags = concat pirflags, $S0
+ pirflags = concat pirflags, ')'
have_subid:
## Perform reduction/optimization on the
@@ -286,12 +286,12 @@
hash['m'] = $I0 # %m = min repetitions
hash['n'] = $I1 # %n = max repetitions
$S0 = $I0
- $S0 .= '..'
+ $S0 = $S0 . '..'
$S1 = $I1
- $S0 .= $S1
- $S0 .= ' ('
- $S0 .= $S2
- $S0 .= ')'
+ $S0 = $S0 . $S1
+ $S0 = $S0 . ' ('
+ $S0 = $S0 . $S2
+ $S0 = $S0 . ')'
hash['Q'] = $S0 # %Q = printable quant
hash['M'] = ''
hash['N'] = ''
@@ -419,7 +419,7 @@
if $I0 != $I1 goto concat_lit_shift
$S0 = exp0.'ast'()
$S1 = exp1.'ast'()
- concat $S0, $S1
+ $S0 = concat $S0, $S1
exp0.'!make'($S0)
goto concat_lit_loop
concat_lit_shift:
@@ -812,8 +812,8 @@
if $I0 == 0 goto subarg_end
$S0 = self['dba']
$S0 = code.'escape'($S0)
- subarg .= ", 'dba'=>"
- subarg .= $S0
+ subarg = concat subarg, ", 'dba'=>"
+ subarg = concat subarg, $S0
subarg_end:
.local string cname, captgen, captsave, captback
Modified: branches/immutable_strings_part2/compilers/pge/PGE/OPTable.pir
==============================================================================
--- branches/immutable_strings_part2/compilers/pge/PGE/OPTable.pir Sun Apr 18 11:19:57 2010 (r45783)
+++ branches/immutable_strings_part2/compilers/pge/PGE/OPTable.pir Sun Apr 18 11:20:11 2010 (r45784)
@@ -377,7 +377,7 @@
goto key_array_1
key_next:
if key == '' goto token_nows
- chopn key, 1
+ key = chopn key, 1
goto key_loop
token_nows:
if pos == wspos goto oper_not_found
@@ -616,10 +616,10 @@
err_ternary:
$S1 = pos
$S0 = concat 'Ternary error at offset ', $S1
- $S0 .= ", found '"
+ $S0 = $S0 . ", found '"
$S1 = substr target, pos, 1
- $S0 .= $S1
- $S0 .= "'"
+ $S0 = $S0 . $S1
+ $S0 = $S0 . "'"
die $S0
.end
Modified: branches/immutable_strings_part2/compilers/pge/PGE/P5Regex.pir
==============================================================================
--- branches/immutable_strings_part2/compilers/pge/PGE/P5Regex.pir Sun Apr 18 11:19:57 2010 (r45783)
+++ branches/immutable_strings_part2/compilers/pge/PGE/P5Regex.pir Sun Apr 18 11:20:11 2010 (r45784)
@@ -132,16 +132,16 @@
$P0 = pos
$P0 = new 'Exception'
$S0 = 'p5regex parse error: '
- $S0 .= message
- $S0 .= ' at offset '
+ $S0 = $S0 . message
+ $S0 = $S0 . ' at offset '
$S1 = pos
- $S0 .= $S1
- $S0 .= ", found '"
+ $S0 = $S0 . $S1
+ $S0 = $S0 . ", found '"
$P1 = getattribute mob, '$.target'
$S1 = $P1
$S1 = substr $S1, pos, 1
- $S0 .= $S1
- $S0 .= "'"
+ $S0 = $S0 . $S1
+ $S0 = $S0 . "'"
$P0 = $S0
throw $P0
.return ()
@@ -319,7 +319,7 @@
$S0 = substr "\n\r\t\f\a\e\0\b", $I0, 1
addchar:
if isrange goto addrange
- charlist .= $S0
+ charlist = charlist . $S0
goto scan
addrange:
isrange = 0
@@ -330,7 +330,7 @@
inc $I2
if $I2 > $I0 goto scan
$S1 = chr $I2
- charlist .= $S1
+ charlist = charlist . $S1
goto addrange_1
hyphenrange:
if isrange goto addrange
@@ -338,7 +338,7 @@
goto scan
endclass:
if isrange == 0 goto end
- charlist .= "-"
+ charlist = charlist . "-"
goto end
dot:
charlist = "\n"
@@ -353,11 +353,11 @@
err_range:
$S0 = 'Invalid [] range "'
$S1 = chr $I2
- $S0 .= $S1
- $S0 .= '-'
+ $S0 = $S0 . $S1
+ $S0 = $S0 . '-'
$S1 = chr $I0
- $S0 .= $S1
- $S0 .= '"'
+ $S0 = $S0 . $S1
+ $S0 = $S0 . '"'
parse_error(mob, pos, $S0)
.end
Modified: branches/immutable_strings_part2/compilers/pge/PGE/Perl6Regex.pir
==============================================================================
--- branches/immutable_strings_part2/compilers/pge/PGE/Perl6Regex.pir Sun Apr 18 11:19:57 2010 (r45783)
+++ branches/immutable_strings_part2/compilers/pge/PGE/Perl6Regex.pir Sun Apr 18 11:20:11 2010 (r45784)
@@ -260,7 +260,7 @@
goto scan_xco_char_digits
scan_xco_char_end:
$S1 = chr decnum
- concat literal, $S1
+ literal = concat literal, $S1
unless isbracketed goto scan_xco_end
pos = find_not_cclass .CCLASS_WHITESPACE, target, pos, lastpos
$S0 = substr target, pos, 1
@@ -971,9 +971,9 @@
$S0 = substr target, pos, 1
if $S0 == closedelim goto subrule_text_add
if $S0 == "\\" goto subrule_text_add
- textarg .= "\\"
+ textarg = textarg . "\\"
subrule_text_add:
- textarg .= $S0
+ textarg = textarg . $S0
inc pos
goto subrule_text_loop
subrule_text_end:
@@ -1021,7 +1021,7 @@
## by converting to <, <+, <-, or <!
$S0 = substr op, -1, 1
if $S0 != '[' goto parse_loop
- chopn op, 1
+ op = chopn op, 1
goto enum
parse_loop:
@@ -1066,7 +1066,7 @@
inc pos
enum_addchar_1:
if isrange goto enum_addrange
- charlist .= $S0
+ charlist = charlist . $S0
goto enum_loop
enum_dotrange:
## check if we have a .. range marker
@@ -1085,7 +1085,7 @@
inc $I2
if $I2 > $I0 goto enum_loop
$S1 = chr $I2
- charlist .= $S1
+ charlist = charlist . $S1
goto enum_addrange_1
enum_close:
inc pos
@@ -1199,7 +1199,7 @@
$S0 = substr target, pos, 1
literal_add:
inc pos
- lit .= $S0
+ lit = lit . $S0
goto literal_iter
literal_end:
inc pos
@@ -1331,7 +1331,7 @@
mob['isnegated'] = 1
assert_pos:
mob['iszerowidth'] = 1
- concat close, '>'
+ close = concat close, '>'
inc len
have_close:
$I0 = index target, close, pos
@@ -1377,16 +1377,16 @@
$P0 = pos
$P0 = new 'Exception'
$S0 = 'perl6regex parse error: '
- $S0 .= message
- $S0 .= ' at offset '
+ $S0 = $S0 . message
+ $S0 = $S0 . ' at offset '
$S1 = pos
- $S0 .= $S1
- $S0 .= ", found '"
+ $S0 = $S0 . $S1
+ $S0 = $S0 . ", found '"
$P1 = getattribute mob, '$.target'
$S1 = $P1
$S1 = substr $S1, pos, 1
- $S0 .= $S1
- $S0 .= "'"
+ $S0 = $S0 . $S1
+ $S0 = $S0 . "'"
$P0 = $S0
throw $P0
.return ()
@@ -1840,7 +1840,7 @@
$I0 = index code, '.sub'
if $I0 >= 0 goto end
code = concat ".sub anon :anon\n.param pmc match\n", code
- code .= "\n.end\n"
+ code = code . "\n.end\n"
end:
.return (code)
.end
Modified: branches/immutable_strings_part2/compilers/pge/PGE/Regex.pir
==============================================================================
--- branches/immutable_strings_part2/compilers/pge/PGE/Regex.pir Sun Apr 18 11:19:57 2010 (r45783)
+++ branches/immutable_strings_part2/compilers/pge/PGE/Regex.pir Sun Apr 18 11:20:11 2010 (r45784)
@@ -406,8 +406,8 @@
have_dba:
.local string message
message = concat "Unable to parse ", dba
- message .= ", couldn't find final "
- message .= goal
+ message = message . ", couldn't find final "
+ message = message . goal
die message
.end
More information about the parrot-commits
mailing list