Skip to content

Commit

Permalink
merge in trunk, fix conflict in NEWS
Browse files Browse the repository at this point in the history
  • Loading branch information
Whiteknight committed Nov 24, 2010
2 parents 2b58997 + fa56f62 commit 1d07f22
Show file tree
Hide file tree
Showing 82 changed files with 408 additions and 43,804 deletions.
4 changes: 0 additions & 4 deletions DEPRECATED.pod
Expand Up @@ -49,10 +49,6 @@ L<https://trac.parrot.org/parrot/ticket/1580>

L<https://trac.parrot.org/parrot/ticket/1599>

=item CodeString [eligible in 2.7]

L<http://trac.parrot.org/parrot/ticket/1633>

=item multiple dispatch within core PMCs [eligible in 1.1]

L<https://trac.parrot.org/parrot/ticket/452>
Expand Down
55 changes: 0 additions & 55 deletions MANIFEST
Expand Up @@ -107,59 +107,6 @@ compilers/pge/PGE/builtins.pg [pge]
compilers/pge/README.pod []doc
compilers/pge/Rules.mak [pge]
compilers/pge/STATUS [pge]
compilers/pirc/Defines.mak [pirc]
compilers/pirc/README.pod []doc
compilers/pirc/Rules.mak [pirc]
compilers/pirc/TODO [pirc]
compilers/pirc/heredoc/heredocmain.c [pirc]
compilers/pirc/macro/lexer.h [pirc]
compilers/pirc/macro/macro.h [pirc]
compilers/pirc/macro/macro.l [pirc]
compilers/pirc/macro/macro.y [pirc]
compilers/pirc/macro/macrolexer.c [pirc]
compilers/pirc/macro/macrolexer.h [pirc]
compilers/pirc/macro/macroparser.c [pirc]
compilers/pirc/macro/macroparser.h [pirc]
compilers/pirc/src/bcgen.c [pirc]
compilers/pirc/src/bcgen.h [pirc]
compilers/pirc/src/hdocprep.c [pirc]
compilers/pirc/src/hdocprep.l [pirc]
compilers/pirc/src/main.c [pirc]
compilers/pirc/src/pir.l [pirc]
compilers/pirc/src/pir.y [pirc]
compilers/pirc/src/pircapi.c [pirc]
compilers/pirc/src/pircapi.h [pirc]
compilers/pirc/src/pircompiler.c [pirc]
compilers/pirc/src/pircompiler.h [pirc]
compilers/pirc/src/pircompunit.c [pirc]
compilers/pirc/src/pircompunit.h [pirc]
compilers/pirc/src/pirdefines.h [pirc]
compilers/pirc/src/piremit.c [pirc]
compilers/pirc/src/piremit.h [pirc]
compilers/pirc/src/pirerr.c [pirc]
compilers/pirc/src/pirerr.h [pirc]
compilers/pirc/src/pirheredoc.h [pirc]
compilers/pirc/src/pirlexer.c [pirc]
compilers/pirc/src/pirlexer.h [pirc]
compilers/pirc/src/pirmacro.c [pirc]
compilers/pirc/src/pirmacro.h [pirc]
compilers/pirc/src/pirop.c [pirc]
compilers/pirc/src/pirop.h [pirc]
compilers/pirc/src/pirparser.c [pirc]
compilers/pirc/src/pirparser.h [pirc]
compilers/pirc/src/pirpcc.c [pirc]
compilers/pirc/src/pirpcc.h [pirc]
compilers/pirc/src/pirregalloc.c [pirc]
compilers/pirc/src/pirregalloc.h [pirc]
compilers/pirc/src/pirsymbol.c [pirc]
compilers/pirc/src/pirsymbol.h [pirc]
compilers/pirc/src/piryy.h [pirc]
compilers/pirc/t/basic.t [test]
compilers/pirc/t/harness [test]
compilers/pirc/t/heredoc.t [test]
compilers/pirc/t/macro.t [test]
compilers/pirc/t/stmts.t [test]
compilers/pirc/t/subflags.t [test]
compilers/tge/Defines.mak [tge]
compilers/tge/README []doc
compilers/tge/Rules.mak [tge]
Expand Down Expand Up @@ -1384,7 +1331,6 @@ src/pmc/bytebuffer.pmc []
src/pmc/callcontext.pmc []
src/pmc/capture.pmc []
src/pmc/class.pmc []
src/pmc/codestring.pmc []
src/pmc/complex.pmc []
src/pmc/continuation.pmc []
src/pmc/coroutine.pmc []
Expand Down Expand Up @@ -1877,7 +1823,6 @@ t/pmc/bytebuffer.t [test]
t/pmc/callcontext.t [test]
t/pmc/capture.t [test]
t/pmc/class.t [test]
t/pmc/codestring.t [test]
t/pmc/complex.t [test]
t/pmc/config.t [test]
t/pmc/context.t [test]
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Expand Up @@ -2,6 +2,9 @@ New in 2.11.0
- Core
+ Just In Time native call frame generation using LibFFI
+ PIR op find_codepoint is no longer experimental, it is now supported
- Languages
+ PIRC
- left the nest and is currently at https://github.com/plobsing/parrot-pirc/

New in 2.10.0
- Core
Expand Down
1 change: 1 addition & 0 deletions PBC_COMPAT
Expand Up @@ -28,6 +28,7 @@

# please insert tab separated entries at the top of the list

9.2 2010.11.21 plobsing remove CodeString PMC
9.1 2010.10.27 nwellnhof remove charset ops
9.0 2010.10.19 gerd released 2.9.0
8.0 2010.07.20 coke released 2.6.0
Expand Down
31 changes: 31 additions & 0 deletions compilers/data_json/data_json.pir
Expand Up @@ -52,6 +52,7 @@ the documentation at L<http://www.json.org/>.

.sub 'compile' :method
.param string json_string
.param pmc opts :slurpy :named

.local pmc parse, match
parse = get_root_global ['parrot'; 'JSON'], 'value'
Expand All @@ -67,6 +68,14 @@ the documentation at L<http://www.json.org/>.
pirbuilder = pirgrammar.'apply'(match)
pir = pirbuilder.'get'('result')

$I0 = exists opts['target']
unless $I0 goto no_targ
$S0 = opts['target']
unless $S0 == 'pir' goto not_pir
.return (pir)
not_pir:
no_targ:

.local pmc pirc, result
pirc = compreg 'PIR'
result = pirc(pir)
Expand All @@ -81,6 +90,28 @@ the documentation at L<http://www.json.org/>.

.HLL 'parrot'

.sub unique_pmc_reg
$P0 = get_root_global ['parrot';'PGE';'Util'], 'unique'
$I0 = $P0()
$S0 = $I0
$S0 = concat "$P", $S0
.return ($S0)
.end

.sub appendln
.param pmc sb
.param string line
push sb, line
push sb, "\n"
.end

.sub 'sprintf'
.param string fmt
.param pmc args :slurpy
$S0 = sprintf fmt, args
.return ($S0)
.end

.include 'compilers/data_json/data_json/grammar.pir'
.include 'compilers/data_json/data_json/pge2pir.pir'

Expand Down
87 changes: 47 additions & 40 deletions compilers/data_json/data_json/pge2pir.tg
Expand Up @@ -6,12 +6,13 @@ transform result (ROOT) {

$S0 = tree.'get'('pir', node, 'value')

pir = new 'CodeString'
pir.'emit'('.sub anon :anon')
pir.'emit'($S0)
pir = new 'StringBuilder'
appendln(pir, '.sub anon :anon')
appendln(pir, $S0)
result = node['ret']
pir.'emit'(' .return (%0)',result)
pir.'emit'('.end')
$S0 = 'sprintf'(' .return (%Ss)', result)
appendln(pir, $S0)
appendln(pir, '.end')

.return(pir)
}
Expand Down Expand Up @@ -52,38 +53,37 @@ transform pir (value) {
.return (pir)

got_true:
pir = new 'CodeString'
result = pir.'unique'('$P')
$S0 = node
pir.'emit'(" %0 = new 'Boolean'", result)
pir.'emit'(' %0 = 1', result, $S0)
pir = new 'StringBuilder'
result = unique_pmc_reg()
$S0 = 'sprintf'(" %Ss = new 'Boolean', 1", result)
appendln(pir, $S0)
node['ret'] = result
.return(pir)

got_false:
pir = new 'CodeString'
result = pir.'unique'('$P')
$S0 = node
pir.'emit'(" %0 = new 'Boolean'", result)
pir.'emit'(' %0 = 0', result, $S0)
pir = new 'StringBuilder'
result = unique_pmc_reg()
$S0 = 'sprintf'(" %Ss = new 'Boolean', 0", result)
appendln(pir, $S0)
node['ret'] = result
.return(pir)

got_null:
pir = new 'CodeString'
result = pir.'unique'('$P')
$S0 = node
pir.'emit'(' null %0', result)
pir = new 'StringBuilder'
result = unique_pmc_reg()
$S0 = 'sprintf'(' null %Ss', result)
appendln(pir, $S0)
node['ret'] = result
.return(pir)
}

transform pir (object) {
.local pmc pir
pir = new 'CodeString'
pir = new 'StringBuilder'
.local string result, child_result, key_result
result = pir.'unique'('$P')
pir.'emit'(" %0 = new 'Hash'", result)
result = unique_pmc_reg()
$S0 = 'sprintf'(" %Ss = new 'Hash'", result)
appendln(pir, $S0)

.local pmc items

Expand All @@ -106,16 +106,17 @@ loop:
child = shift it
$P0 = tree.'get'('pir', child, 'value')
$S0 = $P0
pir .= $S0
push pir, $S0
child_result = child['ret']

key = shift key_iter
$P0 = tree.'get'('pir', key, 'string')
$S0 = $P0
pir .= $S0
push pir, $S0
key_result = key['ret']

pir.'emit'(' %0[%1] = %2', result, key_result, child_result)
$S0 = 'sprintf'(' %Ss[%Ss] = %Ss', result, key_result, child_result)
appendln(pir, $S0)


goto loop
Expand All @@ -127,10 +128,11 @@ end:

transform pir (array) {
.local pmc pir
pir = new 'CodeString'
pir = new 'StringBuilder'
.local string result, child_result
result = pir.'unique'('$P')
pir.'emit'(" %0 = new 'ResizablePMCArray'", result)
result = unique_pmc_reg()
$S0 = 'sprintf'(" %Ss = new 'ResizablePMCArray'", result)
appendln(pir, $S0)

.local pmc items

Expand All @@ -147,10 +149,11 @@ loop:
child = shift it
$P0 = tree.'get'('pir', child, 'value')
$S0 = $P0
pir .= $S0
push pir, $S0

child_result = child['ret']
pir.'emit'(' push %0, %1', result, child_result)
$S0 = 'sprintf'(' push %Ss, %Ss', result, child_result)
appendln(pir, $S0)
goto loop
end:
node['ret'] = result
Expand All @@ -162,7 +165,7 @@ transform pir (string) {
.local pmc pir, result, children, it, child
.local string tmp
tmp = ''
pir = new 'CodeString'
pir = new 'StringBuilder'
children = node['char']
if null children goto loop_end
it = iter children
Expand Down Expand Up @@ -190,21 +193,25 @@ transform pir (string) {
goto loop
loop_end:

result = pir.'unique'('$P')
$S1 = pir.'escape'(tmp)
pir.'emit'(" %0 = new 'String'", result)
pir.'emit'(' %0 = %1', result, $S1)
result = unique_pmc_reg()
$S0 = 'sprintf'(" %Ss = new 'String'", result)
appendln(pir, $S0)
$P0 = get_root_global ['parrot';'PGE';'Util'], 'pir_str_escape'
tmp = $P0(tmp)
$S0 = 'sprintf'(' %Ss = %Ss', result, tmp)
appendln(pir, $S0)
node['ret'] = result
.return(pir)
}

transform pir (number) {
.local pmc pir, result
pir = new 'CodeString'
result = pir.'unique'('$P')
$S0 = node
pir.'emit'(" %0 = new 'Integer'", result)
pir.'emit'(' %0 = %1', result, $S0)
pir = new 'StringBuilder'
result = unique_pmc_reg()
$S0 = 'sprintf'(" %Ss = new 'Integer'", result)
appendln(pir, $S0)
$S0 = 'sprintf'(' %Ss = %Ss', result, node)
appendln(pir, $S0)
node['ret'] = result
.return(pir)
}

0 comments on commit 1d07f22

Please sign in to comment.