[svn:parrot] r40236 - in branches/bsr_jsr_ret/examples: benchmarks japh pasm pir shootout
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Thu Jul 23 23:04:16 UTC 2009
Author: whiteknight
Date: Thu Jul 23 23:04:14 2009
New Revision: 40236
URL: https://trac.parrot.org/parrot/changeset/40236
Log:
[bsr_jsr_ret] update a few more files in examples/. the japh got a little bit less interesting.
Modified:
branches/bsr_jsr_ret/examples/benchmarks/addit.pasm
branches/bsr_jsr_ret/examples/benchmarks/stress.pasm
branches/bsr_jsr_ret/examples/benchmarks/stress1.pasm
branches/bsr_jsr_ret/examples/benchmarks/stress2.pasm
branches/bsr_jsr_ret/examples/benchmarks/stress3.pasm
branches/bsr_jsr_ret/examples/japh/japh3.pasm
branches/bsr_jsr_ret/examples/pasm/fact.pasm
branches/bsr_jsr_ret/examples/pir/life.pir
branches/bsr_jsr_ret/examples/shootout/random.pasm
Modified: branches/bsr_jsr_ret/examples/benchmarks/addit.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/benchmarks/addit.pasm Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/benchmarks/addit.pasm Thu Jul 23 23:04:14 2009 (r40236)
@@ -18,6 +18,7 @@
=cut
_main:
+ new P10, 'ResizableIntegerArray'
new P5, 'ResizablePMCArray'
push P5, 1000
push P5, 7.100
@@ -28,7 +29,7 @@
AGAIN:
dec I9
lt I9, 0, FIN
- bsr _varargs_adder
+ local_branch P10, _varargs_adder
branch AGAIN
FIN:
print N5
@@ -46,7 +47,7 @@
branch LOOP
DONE:
set N5, P2
- ret
+ local_return P10
=head1 SEE ALSO
Modified: branches/bsr_jsr_ret/examples/benchmarks/stress.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/benchmarks/stress.pasm Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/benchmarks/stress.pasm Thu Jul 23 23:04:14 2009 (r40236)
@@ -16,10 +16,11 @@
=cut
+ new P10, 'ResizableIntegerArray'
set I0, 10
new P0, 'ResizablePMCArray'
-ol: bsr buildarray
+ol: local_branch jmpstack, buildarray
set P0[I0], P1
dec I0
# print I0
@@ -29,7 +30,7 @@
set I0, 20
new P2, 'ResizablePMCArray'
-ol1: bsr buildarray
+ol1: local_branch jmpstack, buildarray
set P2[I0], P1
dec I0
# print I0
@@ -39,7 +40,7 @@
set I0, 20
new P3, 'ResizablePMCArray'
-ol2: bsr buildarray
+ol2: local_branch jmpstack, buildarray
set P3[I0], P1
dec I0
# print I0
@@ -63,7 +64,7 @@
set P1[I1], P9
dec I1
if I1, loop1
- ret
+ local_return P10
=head1 SEE ALSO
Modified: branches/bsr_jsr_ret/examples/benchmarks/stress1.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/benchmarks/stress1.pasm Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/benchmarks/stress1.pasm Thu Jul 23 23:04:14 2009 (r40236)
@@ -19,12 +19,13 @@
# Our master loop, I20 times
set I20, 10
time N0
+ new P10, 'ResizableIntegerArray'
mloop:
set I0, 10
new P0, 'ResizablePMCArray'
-ol: bsr buildarray
+ol: local_branch P10, buildarray
set P0[I0], P1
dec I0
if I0, ol
@@ -32,7 +33,7 @@
set I0, 20
new P2, 'ResizablePMCArray'
-ol1: bsr buildarray
+ol1: local_branch P10, buildarray
set P2[I0], P1
dec I0
if I0, ol1
@@ -40,7 +41,7 @@
set I0, 20
new P3, 'ResizablePMCArray'
-ol2: bsr buildarray
+ol2: local_branch P10, buildarray
set P3[I0], P1
dec I0
if I0, ol2
@@ -71,7 +72,7 @@
set P1[I1], P9
dec I1
if I1, loop1
- ret
+ local_return P10
=head1 SEE ALSO
Modified: branches/bsr_jsr_ret/examples/benchmarks/stress2.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/benchmarks/stress2.pasm Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/benchmarks/stress2.pasm Thu Jul 23 23:04:14 2009 (r40236)
@@ -16,28 +16,32 @@
=cut
set I3, 20
-ol: set I0, 10
- new P0, 'ResizablePMCArray'
+ new P10, 'ResizableIntegerArray'
+ol:
+ set I0, 10
+ new P0, 'ResizablePMCArray'
+
+ol1:
+ local_branch P10, buildarray
+ set P0[I0], P1
+ dec I0
+ if I0, ol1
-ol1: bsr buildarray
- set P0[I0], P1
- dec I0
- if I0, ol1
+ dec I3
+ if I3, ol
- dec I3
- if I3, ol
-
- end
+ end
buildarray:
- set I1, 10000
- new P1, 'ResizablePMCArray'
-loop1: new P2, 'Integer'
- set P2, I1
- set P1[I1], P2
- dec I1
- if I1, loop1
- ret
+ set I1, 10000
+ new P1, 'ResizablePMCArray'
+loop1:
+ new P2, 'Integer'
+ set P2, I1
+ set P1[I1], P2
+ dec I1
+ if I1, loop1
+ local_return P10
=head1 SEE ALSO
Modified: branches/bsr_jsr_ret/examples/benchmarks/stress3.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/benchmarks/stress3.pasm Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/benchmarks/stress3.pasm Thu Jul 23 23:04:14 2009 (r40236)
@@ -37,11 +37,12 @@
#lt I10, 2, noarg
#set I11, P5[1]
set I11, 0
+ new P10, 'ResizableIntegerArray'
noarg:
set I0, 100
new P0, 'ResizablePMCArray'
-ol: bsr buildarray
+ol: local_branch P10, buildarray
set P0[I0], P1
dec I0
if I0, ol
@@ -81,7 +82,7 @@
set P1[I1], P9
dec I1
if I1, loop1
- ret
+ local_return P10
=head1 SEE ALSO
Modified: branches/bsr_jsr_ret/examples/japh/japh3.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/japh/japh3.pasm Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/japh/japh3.pasm Thu Jul 23 23:04:14 2009 (r40236)
@@ -10,11 +10,8 @@
substr S3, 5, 1, S2
substr S3, 13, 1, S1
substr S3, 20, 1, S0
- set I3, 3
- bsr I3
- end
print S3
- ret
+ end
# Local Variables:
# mode: pir
Modified: branches/bsr_jsr_ret/examples/pasm/fact.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/pasm/fact.pasm Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/pasm/fact.pasm Thu Jul 23 23:04:14 2009 (r40236)
@@ -27,6 +27,7 @@
=cut
main:
+ new P10, 'ResizableIntegerArray'
set I1,0
## P9 is used as a stack for temporaries.
new P9, 'ResizableIntegerArray'
@@ -36,7 +37,7 @@
print " is: "
new P0, 'Integer'
set P0,I1
- bsr fact
+ local_branch P10, fact
print P0
print "\n"
inc I1
@@ -52,13 +53,13 @@
push P9,I2
set I2,P0
dec P0
- bsr fact
+ local_branch P10, fact
mul P0,P0,I2
pop I2,P9
- ret
+ local_return P10
is_one:
set P0,1
- ret
+ local_return P10
# Local Variables:
# mode: pir
Modified: branches/bsr_jsr_ret/examples/pir/life.pir
==============================================================================
--- branches/bsr_jsr_ret/examples/pir/life.pir Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/pir/life.pir Thu Jul 23 23:04:14 2009 (r40236)
@@ -27,6 +27,8 @@
.sub 'life' :main
.param pmc argv
.local int max_generations
+ .local pmc jmpstack
+ jmpstack = new 'ResizableIntegerArray'
# First the generation count
$I15 = argv
@@ -78,7 +80,7 @@
concat $S15, $S12
concat $S15, $S13
concat $S15, $S14
- bsr dump
+ local_branch jmpstack, dump
set $I0, 0
loop: ge $I0, $I2, getout
inc $I0
@@ -87,9 +89,9 @@
printerr "."
skip:
- bsr generate
+ local_branch jmpstack, generate
- bsr dump
+ local_branch jmpstack, dump
branch loop
getout: time $N6
sub $N7, $N6, $N5
@@ -246,7 +248,7 @@
$I2 = save_I2
$I1 = save_I1
$I0 = save_I0
- ret
+ local_return jmpstack
# $S15 has the incoming string, $S0 is scratch
dump:
@@ -267,7 +269,7 @@
ge $I11, 0, printloop
sleep 1
dumpend:
- ret
+ local_return jmpstack
.end
Modified: branches/bsr_jsr_ret/examples/shootout/random.pasm
==============================================================================
--- branches/bsr_jsr_ret/examples/shootout/random.pasm Thu Jul 23 22:44:12 2009 (r40235)
+++ branches/bsr_jsr_ret/examples/shootout/random.pasm Thu Jul 23 23:04:14 2009 (r40236)
@@ -10,6 +10,7 @@
# N2 is the argument for gen_random
# N3 is the return from gen_random
main:
+ new P10, 'ResizableIntegerArray'
get_params "0", P0
elements I0, P0
eq I0, 2, hasargs
@@ -23,7 +24,7 @@
unless I1, ex
set N2, 100.0
while_1:
- bsr gen_random
+ local_branch P10, gen_random
dec I1
if I1, while_1
new P0, 'FixedFloatArray'
@@ -45,7 +46,7 @@
set N1, I0
mul N3, N2, N1
div N3, .IM
- ret
+ local_return P10
# Local Variables:
# mode: pir
More information about the parrot-commits
mailing list