Author: Whiteknight
Date: Sun Jul 27 17:01:51 2008
New Revision: 29809
Added:
branches/gsoc_pdd09/languages/tcl/runtime/builtin/break.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/break.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/cd.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/cd.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/continue.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/continue.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/eof.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/eof.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/exit.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/exit.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/flush.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/flush.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/for.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/for.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/incr.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/incr.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/join.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/join.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/llength.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/llength.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/lrange.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/lrange.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/pwd.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/pwd.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/set.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/set.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/time.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/time.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/while.pir
- copied unchanged from r29808,
/trunk/languages/tcl/runtime/builtin/while.pir
Removed:
branches/gsoc_pdd09/languages/tcl/src/builtin/
branches/gsoc_pdd09/languages/tcl/tools/gen_inline.pl
Modified:
branches/gsoc_pdd09/languages/lua/src/lib/glut.pir
branches/gsoc_pdd09/languages/perl6/t/spectest_regression.data
branches/gsoc_pdd09/languages/tcl/README.pod
branches/gsoc_pdd09/languages/tcl/config/makefiles/root.in
branches/gsoc_pdd09/languages/tcl/docs/howto.pod
branches/gsoc_pdd09/languages/tcl/docs/overview.pod
branches/gsoc_pdd09/languages/tcl/lib/skipped_tests.tcl
branches/gsoc_pdd09/languages/tcl/runtime/builtin/proc.pir
branches/gsoc_pdd09/languages/tcl/runtime/builtin/rename.pir
branches/gsoc_pdd09/languages/tcl/src/grammar/expr/past2pir.tg
branches/gsoc_pdd09/languages/tcl/t/cmd_incr.t
branches/gsoc_pdd09/languages/tcl/tools/gen_builtins.pl
Log:
[gsoc_pdd09] update to trunk r29808
Modified: branches/gsoc_pdd09/languages/lua/src/lib/glut.pir
==============================================================================
--- branches/gsoc_pdd09/languages/lua/src/lib/glut.pir (original)
+++ branches/gsoc_pdd09/languages/lua/src/lib/glut.pir Sun Jul 27 17:01:51 2008
@@ -162,14 +162,21 @@
if $I0 goto L1
lua_error("incorrect argument to function 'glut.DisplayFunc'")
L1:
- .local pmc _lua__GLOBAL
+ set_hll_global 'displayFunc.name', funcname
+ .const .Sub display = 'display'
+ glutDisplayFunc(display)
+.end
+
+.sub 'display' :anon
+ .local pmc _lua__GLOBAL, funcname
_lua__GLOBAL = get_hll_global '_G'
+ funcname = get_hll_global 'displayFunc.name'
$P0 = _lua__GLOBAL[funcname]
$I0 = lua_isfunction($P0)
if $I0 goto L2
lua_error("Script error: cannot find ", funcname, " function.")
L2:
- glutDisplayFunc($P0)
+ $P0()
.end
@@ -184,14 +191,21 @@
if $I0 goto L1
lua_error("incorrect argument to function 'glut.IdleFunc'")
L1:
- .local pmc _lua__GLOBAL
+ set_hll_global 'idleFunc.name', funcname
+ .const .Sub idle = 'idle'
+ glutIdleFunc(idle)
+.end
+
+.sub 'idle' :anon
+ .local pmc _lua__GLOBAL, funcname
_lua__GLOBAL = get_hll_global '_G'
+ funcname = get_hll_global 'idleFunc.name'
$P0 = _lua__GLOBAL[funcname]
$I0 = lua_isfunction($P0)
if $I0 goto L2
lua_error("Script error: cannot find ", funcname, " function.")
L2:
- glutIdleFunc($P0)
+ $P0()
.end
@@ -253,14 +267,30 @@
if $I0 goto L1
lua_error("incorrect argument to function 'glut.KeyboardFunc'")
L1:
- .local pmc _lua__GLOBAL
+ set_hll_global 'keyboardFunc.name', funcname
+ .const .Sub keyboard = 'keyboard'
+ glutKeyboardFunc(keyboard)
+.end
+
+.sub 'keyboard' :anon
+ .param int key
+ .param int x
+ .param int y
+ .local pmc _lua__GLOBAL, funcname
_lua__GLOBAL = get_hll_global '_G'
+ funcname = get_hll_global 'keyboardFunc.name'
$P0 = _lua__GLOBAL[funcname]
$I0 = lua_isfunction($P0)
if $I0 goto L2
lua_error("Script error: cannot find ", funcname, " function.")
L2:
- glutKeyboardFunc($P0)
+ new $P1, 'LuaNumber'
+ set $P1, key
+ new $P2, 'LuaNumber'
+ set $P2, x
+ new $P3, 'LuaNumber'
+ set $P3, y
+ $P0($P1, $P2, $P3)
.end
@@ -295,17 +325,29 @@
if $I0 goto L1
lua_error("incorrect argument to function 'glut.ReshapeFunc'")
L1:
- .local pmc _lua__GLOBAL
+ set_hll_global 'reshapeFunc.name', funcname
+ .const .Sub reshape = 'reshape'
+ glutReshapeFunc(reshape)
+.end
+
+.sub 'reshape' :anon
+ .param int width
+ .param int height
+ .local pmc _lua__GLOBAL, funcname
_lua__GLOBAL = get_hll_global '_G'
+ funcname = get_hll_global 'reshapeFunc.name'
$P0 = _lua__GLOBAL[funcname]
$I0 = lua_isfunction($P0)
if $I0 goto L2
lua_error("Script error: cannot find ", funcname, " function.")
L2:
- glutFunc($P0)
+ new $P1, 'LuaNumber'
+ set $P1, width
+ new $P2, 'LuaNumber'
+ set $P2, height
+ $P0($P1, $P2)
.end
-
=item C<glut.SwapBuffers ()>
=cut
Modified: branches/gsoc_pdd09/languages/perl6/t/spectest_regression.data
==============================================================================
--- branches/gsoc_pdd09/languages/perl6/t/spectest_regression.data
(original)
+++ branches/gsoc_pdd09/languages/perl6/t/spectest_regression.data Sun Jul
27 17:01:51 2008
@@ -53,6 +53,7 @@
S05-metasyntax/unknown.t
S05-transliteration/trans.t
S06-multi/syntax.t
+S06-multi/type-based.t
S06-signature/mixed-placeholders.t
S06-signature/named-parameters.t
S06-signature/named-placeholders.t
Modified: branches/gsoc_pdd09/languages/tcl/README.pod
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/README.pod (original)
+++ branches/gsoc_pdd09/languages/tcl/README.pod Sun Jul 27 17:01:51 2008
@@ -62,7 +62,7 @@
collection system. Send the results of both to the mailing list
C<[EMAIL PROTECTED]>.
-To run the spec test suites, type C<make tcl-test>; This will check out
+To run the spec test suites, type C<make spectest>; This will check out
the tests from tcl's CVS repository for the 8.5.3 release and run them.
Note that the tests are I<fudged> slightly to use our version of [test]
Modified: branches/gsoc_pdd09/languages/tcl/config/makefiles/root.in
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/config/makefiles/root.in (original)
+++ branches/gsoc_pdd09/languages/tcl/config/makefiles/root.in Sun Jul 27
17:01:51 2008
@@ -9,7 +9,6 @@
#CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X
compilation/linking
#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
-C_BUILTIN = src/builtin
TCL_LIB = library
PMCBUILD = $(PERL) @build_dir@/tools/build/dynpmc.pl
OPSBUILD = $(PERL) @build_dir@/tools/build/dynoplibs.pl
@@ -42,29 +41,9 @@
tclarray \
tcldict
-GENERATED_INLINES = \
- $(C_BUILTIN)/break.pir \
- $(C_BUILTIN)/continue.pir \
- $(C_BUILTIN)/eof.pir \
- $(C_BUILTIN)/exit.pir \
- $(C_BUILTIN)/flush.pir \
- $(C_BUILTIN)/for.pir \
- $(C_BUILTIN)/incr.pir \
- $(C_BUILTIN)/join.pir \
- $(C_BUILTIN)/llength.pir \
- $(C_BUILTIN)/lrange.pir \
- $(C_BUILTIN)/pwd.pir \
- $(C_BUILTIN)/set.pir \
- $(C_BUILTIN)/time.pir \
- $(C_BUILTIN)/while.pir
-
RUNTIME_PIR = $(addprefix runtime/builtin/,$(notdir $(wildcard
languages/tcl/runtime/builtin/*.pir)))
DEPS = \
-$(C_BUILTIN)/cd.pir \
-$(C_BUILTIN)/expr.pir \
-$(C_BUILTIN)/list.pir \
-$(C_BUILTIN)/return.pir \
runtime/conversions.pir \
runtime/string_to_list.pir \
runtime/variables.pir \
@@ -85,12 +64,7 @@
tcl.pbc: $(PARROT) pmcs ops runtime/tcllib.pbc src/tclsh.pir
$(PARROT) --output=tcl.pbc src/tclsh.pir
-$(GENERATED_INLINES) : tools/gen_inline.pl
-
-.SUFFIXES : .pir .tmt .pg .tg .tcl
-
-.tmt.pir :
- $(PERL) tools/gen_inline.pl $< > $@
+.SUFFIXES : .pir .pg .tg .tcl
.tg.pir :
$(PARROT) $(TGE_DIR)/tgc.pir --output=$@ $<
@@ -129,7 +103,7 @@
@cd $(OPSDIR) && $(OPSBUILD) linklibs tcl ../binary$(O)
@cd $(OPSDIR) && $(OPSBUILD) copy "--destination=$(DESTDIR)" tcl
-runtime/builtins.pir: $(GENERATED_INLINES) $(DEPS) tools/gen_builtins.pl
+runtime/builtins.pir: $(DEPS) tools/gen_builtins.pl
$(PERL) tools/gen_builtins.pl > runtime/builtins.pir
runtime/tcllib.pbc: $(PARROT) runtime/tcllib.pir runtime/builtins.pir
$(CLASSES)
@@ -293,7 +267,7 @@
t_tcl/io.t \
t_tcl/stringObj.t
-tcl-test: t_tcl tcl.pbc
+spectest: t_tcl tcl.pbc
# For now, just test the ones that ``work'' with test_more
prove $(RUNNABLE_TCL_TESTS)
t_tcl:
@@ -326,7 +300,6 @@
src/grammar/expr/expression.pir \
src/grammar/expr/past2pir.pir \
src/grammar/expr/pge2past.pir \
-$(GENERATED_INLINES) \
"$(OPSDIR)/*.c" \
"$(OPSDIR)/*.h" \
"src/*$(O)" \
Modified: branches/gsoc_pdd09/languages/tcl/docs/howto.pod
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/docs/howto.pod (original)
+++ branches/gsoc_pdd09/languages/tcl/docs/howto.pod Sun Jul 27 17:01:51 2008
@@ -19,51 +19,9 @@
has been translated, the object's C<compile> method is invoked, which then
generates PIR which can be compiled by parrot.
-The commands themselves have (well, some of them do) inline-able (compiled)
-versions: These are located in C<src/builtin>, and all new development should
go
-there. There are many runtime-only versions that exist in C<runtime/builtin>.
-In general, no new development should occur here. The inline-able versions are
-preferred, as they help avoid runtime dispatch.
-
-When writing inlined builtins, these are further subdivided into two variants
-at the moment: those generated automatically by running
C<tools/gen_inline.pl>,
-and those that are handwritten.
-
-Templates for inlined builtins look a lot like PIR (they are, for the most
-part) but they have a little bit of magic. The compiler takes care of argument
-handling and renames local variables and labels so they don't collide. Since
-we're using perl to generate the code, this is a one time cost at build time:
at
-runtime, we are using PIR. (Which in turn generates PIR itself).
-
-Hand-rolled inlined builtins take three arguments: a TclCompiler, an
-array PMC with the raw arguments, and an array PMC with the registers
-of the compiled arguments. Your return value is simply the compiler
-object. You should only use this method for generating builtins if a
-builtin cannot be defined using a template, and even then, extending
-the template parser is probably the right answer.
-
-This is as opposed to the interpreted style in C<runtime/builtin>, which takes
-a variable number of already compiled arguments at runtime. Our fallback method
-bundles these up, passing in a starting register of 0, and uses the resulting
-PIR to generate a .sub immediately and then invoke it. The runtime fallback
-is *always* going to be necessary for HLL interoperability.
-
-Remember, every argument to your builtin is potentially variable and may change
-at runtime. You can check the type of the object at compile time. However,
-if it's constant, then you can optimize: for example, we could optimize
-[puts -nonewline "whee\n"] down to, basically, {say 'whee'}... however,
-we still have to be able to deal with [set a -nonewline; puts $a "whee\n"].
-So, your first pass should probably do no optimizations. If you see a potential
-for optimization, however, at least add an XXX comment so we can get back to
-it later. At this point, we'd rather spend time working on new features than
-making existing features faster.
-
-The results of calling the inlined code will be used by
-C<lib/tclcommand.pir>. The inlined code is further wrapped in a
-protective conditional which will skip the inlined version if it can
-no longer be trusted (that is, if [proc] or [rename] has been
-invoked), and will fall back to the interpreted version as necessary.
-(And throw an exception if the command is not found at runtime.).
+The commands themselves are all dispatched at runtime. These are all written
+in PIR, and can be found, e.g. in F<runtime/builtins/while.pir>. These variants
+take a variable number of already compiled arguments at runtime.
=item speed
@@ -116,7 +74,7 @@
using the tcl-based version. See C<t/cmd_expr.t> for an example.
Our final goal will be to pass (most of) the tcl test suite: run
-C<make tcl-test> to checkout the latest version of of the tcl test suite
+C<make spectest> to checkout the latest version of of the tcl test suite
and run it. Warning: slow...
Long term goal is remove any tests in C<t/> that are testing things that are
Modified: branches/gsoc_pdd09/languages/tcl/docs/overview.pod
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/docs/overview.pod (original)
+++ branches/gsoc_pdd09/languages/tcl/docs/overview.pod Sun Jul 27 17:01:51 2008
@@ -30,10 +30,7 @@
the appropriate namespaces, as well as declare and register the TCL
compiler for the C<compile> opcode.
-This file is actually built in several steps. First, all the templated commands
-(src/builtin/*.tmt) are converted to PIR. Next, runtime/builtins.pir is
-generated from all the pir files in src/builtin/ and runtime/builtin. This file
-is then included by tcllib.pir and compiled to tcllib.pbc.
+This file is then included by F<tcllib.pir> which is compiled to F<tcllib.pbc>.
=item tcl.pbc
@@ -112,7 +109,7 @@
Occasional failures are suspected against svn-head; there should be no
failures in a released version, however.
-To run the Tcl test suite, type C<make tcl-test>. This will checkout the
+To run the Tcl test suite, type C<make spectest>. This will checkout the
appropriate CVS copy of the tests from the Tcl repository and run them.
Warning, this will be slow.
Modified: branches/gsoc_pdd09/languages/tcl/lib/skipped_tests.tcl
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/lib/skipped_tests.tcl (original)
+++ branches/gsoc_pdd09/languages/tcl/lib/skipped_tests.tcl Sun Jul 27
17:01:51 2008
@@ -74,8 +74,6 @@
} {better switch handling} {
subst-7.[27]
switch-3.1[234]
- } {[incr] should autovivify} {
- incr-1.13 incr-1.26 incr-2.13 incr-2.26 incr-old-2.3
} {[expr wide()]} {
incr-3.[12]
} {[unknown]} {
Modified: branches/gsoc_pdd09/languages/tcl/runtime/builtin/proc.pir
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/runtime/builtin/proc.pir (original)
+++ branches/gsoc_pdd09/languages/tcl/runtime/builtin/proc.pir Sun Jul 27
17:01:51 2008
@@ -46,7 +46,7 @@
if $I0 == 0 goto create
name = pop ns
- if $I0 == 1 goto root
+ if $I0 == 1 goto create
$P0 = get_hll_namespace ns
if null $P0 goto unknown_namespace
@@ -55,22 +55,6 @@
namespace .= "']"
goto create
-root:
- # check to see if this is inlinable
- # if it is, we need to update the epoch
- $S0 = name
- $P1 = get_root_global ['_tcl'; 'builtins'], $S0
- if null $P1 goto create
-
- .local pmc epoch
- epoch = get_root_global ['_tcl'], 'epoch'
- inc epoch
-
- # now we need to delete the helper sub
- # so we don't try to inline anything else
- $P1 = get_root_namespace ['_tcl'; 'builtins']
- delete $P1[$S0]
-
create:
code.emit(<<'END_PIR', namespace, name)
.sub 'xxx' :anon
Modified: branches/gsoc_pdd09/languages/tcl/runtime/builtin/rename.pir
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/runtime/builtin/rename.pir
(original)
+++ branches/gsoc_pdd09/languages/tcl/runtime/builtin/rename.pir Sun Jul
27 17:01:51 2008
@@ -37,7 +37,7 @@
delete_sub:
delete ns[$S0]
- if delete_only goto delete_builtin
+ if delete_only goto return
add_sub:
# Create the new sub
@@ -53,19 +53,8 @@
set_new_sub:
ns[$S0] = sub
-
-delete_builtin:
- builtin = get_root_global ['_tcl'; 'builtins'], oldName
- if null builtin goto return
-
- $P0 = get_root_namespace ['_tcl'; 'builtins']
- delete $P0[oldName]
-
if delete_only goto return
-add_builtin:
- set_root_global ['_tcl'; 'builtins'], newName, builtin
-
return:
.return('')
Modified: branches/gsoc_pdd09/languages/tcl/src/grammar/expr/past2pir.tg
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/src/grammar/expr/past2pir.tg
(original)
+++ branches/gsoc_pdd09/languages/tcl/src/grammar/expr/past2pir.tg Sun Jul
27 17:01:51 2008
@@ -208,9 +208,6 @@
$P0 = shift iter
name = $P0['value']
- .local int has_expand
- has_expand = 0
-
iter_loop:
unless iter goto iter_done
$P1 = shift iter
@@ -219,13 +216,10 @@
push args, reg
pir .= $P0
$S0 = typeof $P1
- if $S0 == 'PAST::Expand' goto iter_expand
+ if $S0 == 'PAST::Expand' goto iter_loop
unless $S0 == 'PAST::Var' goto iter_loop
pir.emit(" %0 = clone %0", reg)
goto iter_loop
- iter_expand:
- has_expand = 1
- goto iter_loop
iter_done:
.local string retval
retval = pir.unique('$P')
@@ -237,22 +231,7 @@
$P0 = shift children
$S0 = $P0['value']
- if has_expand goto dynamic
- $P1 = get_root_global ['_tcl'; 'builtins'], $S0
- if null $P1 goto dynamic
-
- $P0 = $P1(retval, children,args)
- if null $P0 goto dynamic
-
- .local pmc epoch
- epoch = get_root_global ['_tcl'], 'epoch'
- $S0 = pir.unique('dynamic_')
- pir.emit(' if epoch != %0 goto %1', epoch, $S0)
- pir .= $P0
- pir.emit(' goto %0', done_)
- pir.emit('%0:', $S0)
- dynamic:
.local string ns
ns = ''
$S0 = join ", ", args
Modified: branches/gsoc_pdd09/languages/tcl/t/cmd_incr.t
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/t/cmd_incr.t (original)
+++ branches/gsoc_pdd09/languages/tcl/t/cmd_incr.t Sun Jul 27 17:01:51 2008
@@ -77,7 +77,7 @@
eval_is {
catch {unset a}
incr a
-} 1 {no such variable} {TODO {not changed yet. this will require some work}}
+} 1 {no such variable}
# Uses the same parsing mechanism as
Modified: branches/gsoc_pdd09/languages/tcl/tools/gen_builtins.pl
==============================================================================
--- branches/gsoc_pdd09/languages/tcl/tools/gen_builtins.pl (original)
+++ branches/gsoc_pdd09/languages/tcl/tools/gen_builtins.pl Sun Jul 27
17:01:51 2008
@@ -8,7 +8,6 @@
use lib qw(lib);
my $static_dir = 'runtime/builtin';
-my $dynamic_dir = 'src/builtin';
print <<EOH;
# This file automatically generated by $0.
@@ -18,26 +17,10 @@
# commands that are in Tcl's :: namespace directly
my @static_cmds = pir_cmds_in_dir($static_dir);
-# subroutines that generate the PIR for Tcl commands
-my @dynamic_cmds = pir_cmds_in_dir($dynamic_dir);
-
print " .HLL 'tcl', 'tcl_group'\n";
-print " .include 'languages/tcl/$dynamic_dir/$_.pir'\n" for @dynamic_cmds;
-
-#print <<'END_PIR';
-#
-#.HLL 'tcl', 'tcl_group'
-#.namespace []
-#
-#END_PIR
-
print " .include 'languages/tcl/$static_dir/$_.pir'\n" for @static_cmds;
-# For every builtin with an inline'd version and no interpreted version,
-# create a shim for the interpreted version that automatically calls
-# the inline'd version, compiles the result and invokes it.
-
sub pir_cmds_in_dir {
my ($dir) = @_;