Skip to content

Commit

Permalink
convert root_new back to new
Browse files Browse the repository at this point in the history
Initial run with profiler showed root_new op as taking about 4x as long as new.

git-svn-id: http://partcl.googlecode.com/svn/trunk@613 6cb8db7d-f34b-0410-8f57-4f83c6281724
  • Loading branch information
wcoleda committed Aug 24, 2009
1 parent 285bb02 commit 2aba864
Show file tree
Hide file tree
Showing 34 changed files with 107 additions and 108 deletions.
6 changes: 3 additions & 3 deletions runtime/builtin/array.pir
Expand Up @@ -126,7 +126,7 @@
rule = globber.'compile'(match_str)

.local pmc retval
retval = root_new ['parrot'; 'TclList']
retval = new 'TclList'

.pmc(iterator, iter the_array)

Expand Down Expand Up @@ -217,7 +217,7 @@
rule = globber.'compile'(pattern)

.local pmc retval
retval = root_new ['parrot'; 'TclList']
retval = new 'TclList'

.pmc(iterator, iter the_array)
.While(iterator, {
Expand All @@ -237,7 +237,7 @@
rule = tclARE(pattern)

.local pmc retval
retval = root_new ['parrot'; 'TclList']
retval = new 'TclList'

.pmc(iterator, iter the_array)
.While(iterator, {
Expand Down
4 changes: 2 additions & 2 deletions runtime/builtin/catch.pir
Expand Up @@ -20,7 +20,7 @@
if argc > 3 goto bad_args

.local pmc opts
opts = root_new ['parrot'; 'TclDict']
opts = new 'TclDict'

code = argv[0]
push_eh non_ok
Expand All @@ -42,7 +42,7 @@ got_retval:
varname = argv[1]

.local pmc opts
opts = root_new ['parrot'; 'TclDict']
opts = new 'TclDict'

# Store the caught value in a

Expand Down
2 changes: 1 addition & 1 deletion runtime/builtin/clock.pir
Expand Up @@ -77,7 +77,7 @@ bad_args:

.sub 'anon' :anon :load
.local pmc options
options = root_new ['parrot'; 'TclList']
options = new 'TclList'
push options, 'add'
push options, 'clicks'
push options, 'format'
Expand Down
40 changes: 20 additions & 20 deletions runtime/builtin/dict.pir
Expand Up @@ -71,7 +71,7 @@ dict_error:
$S0 = exception
$I0 = index $S0, 'variable is array'
if $I0 != -1 goto cant_dict_array
dictionary = root_new ['parrot'; 'TclDict']
dictionary = new 'TclDict'

got_dict:
.local pmc key, value
Expand Down Expand Up @@ -122,7 +122,7 @@ bad_args:
if $I3 goto bad_args

.local pmc retval
retval = root_new ['parrot'; 'TclDict']
retval = new 'TclDict'

.local pmc key,value

Expand Down Expand Up @@ -185,7 +185,7 @@ bad_args:
dictionary = dictionary.'getDictValue'()

.local pmc options
options = root_new ['parrot'; 'TclList']
options = new 'TclList'
options[0] = 'key'
options[1] = 'script'
options[2] = 'value'
Expand All @@ -198,7 +198,7 @@ bad_args:
option = select_option(options, option, 'filterType')

.local pmc results, key, value
results = root_new ['parrot'; 'TclDict']
results = new 'TclDict'

if option == 'script' goto do_script_prelude

Expand Down Expand Up @@ -253,13 +253,13 @@ do_script_prelude:
.local pmc iterator
iterator = iter dictionary
.local pmc retval
retval = root_new ['parrot';'TclDict']
retval = new 'TclDict'
.local pmc body_proc
body_proc = compileTcl(body)

.local pmc check_key,check_value
.local pmc eh
eh = root_new ['parrot'; 'ExceptionHandler']
eh = new 'ExceptionHandler'
eh.'handle_types'(.CONTROL_CONTINUE,.CONTROL_BREAK)
set_addr eh, body_handler
script_loop:
Expand Down Expand Up @@ -341,7 +341,7 @@ for_loop:
setVar(valueVar, $P2)

.local pmc eh
eh = root_new ['parrot'; 'ExceptionHandler']
eh = new 'ExceptionHandler'
eh.'handle_types'(.CONTROL_CONTINUE,.CONTROL_BREAK)
set_addr eh, loop_handler
push_eh eh
Expand Down Expand Up @@ -433,7 +433,7 @@ dict_error:
$S0 = exception
$I0 = index $S0, 'variable is array'
if $I0 != -1 goto cant_dict_array
dictionary = root_new ['parrot'; 'TclDict']
dictionary = new 'TclDict'

got_dict:
.local pmc key
Expand Down Expand Up @@ -462,7 +462,7 @@ vivified:
done:
dictionary[key] = value
set(dict_name, dictionary)
$P1 = root_new ['parrot'; 'TclList']
$P1 = new 'TclList'
$P1[0] = key
$P1[1] = value
.return ($P1)
Expand Down Expand Up @@ -523,7 +523,7 @@ dict_error:
$S0 = exception
$I0 = index $S0, 'variable is array'
if $I0 != -1 goto cant_dict_array
dictionary = root_new ['parrot';'TclDict']
dictionary = new 'TclDict'

got_dict:
.local pmc key, value
Expand All @@ -533,7 +533,7 @@ got_dict:

$I0 = exists dictionary[key]
if $I0 goto vivified
value = root_new ['parrot'; 'TclList']
value = new 'TclList'
goto loop

vivified:
Expand Down Expand Up @@ -590,7 +590,7 @@ got_pattern:
iterator = iter dictionary

.local pmc results, key
results = root_new ['parrot'; 'TclList']
results = new 'TclList'
loop:
unless iterator goto loop_done
key = shift iterator
Expand Down Expand Up @@ -731,7 +731,7 @@ dict_error:
$S0 = exception
$I0 = index $S0, 'variable is array'
if $I0 != -1 goto cant_dict_array
dictionary = root_new ['parrot';'TclDict']
dictionary = new 'TclDict'

got_dict:
.local pmc value
Expand All @@ -749,7 +749,7 @@ loop:
sub_dict = $P1
goto loop
new_key:
$P1 = root_new ['parrot'; 'TclDict']
$P1 = new 'TclDict'
sub_dict[key] = $P1
sub_dict = $P1
goto loop
Expand Down Expand Up @@ -814,7 +814,7 @@ dict_error:
$S0 = exception
$I0 = index $S0, 'variable is array'
if $I0 != -1 goto cant_dict_array
dictionary = root_new ['parrot'; 'TclDict']
dictionary = new 'TclDict'
set(dict_name, dictionary)

got_dict:
Expand Down Expand Up @@ -876,15 +876,15 @@ dict_error:
$S0 = exception
$I0 = index $S0, 'variable is array'
if $I0 != -1 goto cant_dict_array
dictionary = root_new ['parrot'; 'TclDict']
dictionary = new 'TclDict'

got_dict:
.local pmc body
body = pop argv

.local pmc keys,varnames
keys = root_new ['parrot'; 'TclList']
varnames = root_new ['parrot'; 'TclList']
keys = new 'TclList'
varnames = new 'TclList'
# get lists of both keys & varnames, setting the variables.
key_loop:
$I0 = elements argv
Expand Down Expand Up @@ -958,7 +958,7 @@ got_pattern:
iterator = iter dictionary

.local pmc results, key, value
results = root_new ['parrot'; 'TclList']
results = new 'TclList'
loop:
unless iterator goto loop_done
key = shift iterator
Expand Down Expand Up @@ -999,7 +999,7 @@ dict_error:
$S0 = exception
$I0 = index $S0, 'variable is array'
if $I0 != -1 goto cant_dict_array
dictionary = root_new ['parrot'; 'TclDict']
dictionary = new 'TclDict'

got_dict:
.local pmc body
Expand Down
2 changes: 1 addition & 1 deletion runtime/builtin/exec.pir
Expand Up @@ -6,7 +6,7 @@

# XXX We aren't yet able to parse any of the tcl command metachars, so skip them
.local pmc cmd_args
cmd_args = root_new ['parrot'; 'TclList']
cmd_args = new 'TclList'

.local pmc iterator
iterator = iter argv
Expand Down
2 changes: 1 addition & 1 deletion runtime/builtin/file.pir
Expand Up @@ -665,7 +665,7 @@ bad_args:
filename = argv[0]

.local pmc retval
retval = root_new ['parrot'; 'TclList']
retval = new 'TclList'

# XXX not platform-independent.
# XXX this $P0 is a parrot type, not a tcl type.
Expand Down
2 changes: 1 addition & 1 deletion runtime/builtin/fileevent.pir
Expand Up @@ -36,7 +36,7 @@ readable:

.local pmc events
events = get_root_global ['_tcl'], 'events'
$P0 = root_new ['parrot'; 'TclList']
$P0 = new 'TclList'
push events, $P0
push $P0, channel
push $P0, script
Expand Down
4 changes: 2 additions & 2 deletions runtime/builtin/for.pir
Expand Up @@ -25,12 +25,12 @@
body_block = compileTcl(body_block)

.local pmc eh_continue
eh_continue = root_new ['parrot'; 'ExceptionHandler']
eh_continue = new 'ExceptionHandler'
eh_continue.'handle_types'(.CONTROL_BREAK,.CONTROL_CONTINUE)
set_addr eh_continue, command_exception

.local pmc eh_done
eh_done = root_new ['parrot'; 'ExceptionHandler']
eh_done = new 'ExceptionHandler'
eh_done.'handle_types'(.CONTROL_BREAK)
set_addr eh_done, done

Expand Down
8 changes: 4 additions & 4 deletions runtime/builtin/foreach.pir
Expand Up @@ -23,8 +23,8 @@
setVar = get_root_global ['_tcl'], 'setVar'

.local pmc varLists, lists, command
varLists = root_new ['parrot'; 'TclList']
lists = root_new ['parrot'; 'TclList']
varLists = new 'TclList'
lists = new 'TclList'
command = pop argv
command = compileTcl(command, 'ns'=>ns)

Expand All @@ -47,7 +47,7 @@ arg_loop:
.TryCatch({
list = list.'getListValue'()
}, {
list = root_new ['parrot'; 'TclList']
list = new 'TclList'
})

$I0 = elements varList
Expand All @@ -69,7 +69,7 @@ arg_loop:
arg_done:

.local pmc eh
eh = root_new ['parrot'; 'ExceptionHandler']
eh = new 'ExceptionHandler'
eh.'handle_types'(.CONTROL_BREAK,.CONTROL_CONTINUE)
set_addr eh, handle_continue

Expand Down
10 changes: 5 additions & 5 deletions runtime/builtin/info.pir
Expand Up @@ -247,7 +247,7 @@ bad_args:

mathfunc = get_root_namespace ['tcl'; 'tcl'; 'mathfunc']
iterator = iter mathfunc
retval = root_new ['parrot'; 'TclList']
retval = new 'TclList'

.local pmc globber,rule,match
globber = compreg 'Tcl::Glob'
Expand Down Expand Up @@ -321,7 +321,7 @@ bad_args:
})

.local pmc result
result = root_new ['parrot'; 'TclList']
result = new 'TclList'

if null ns goto iter_loop_end

Expand Down Expand Up @@ -455,7 +455,7 @@ iterate:
.local pmc iterator, retval
.local string elem
iterator = iter lexpad
retval = root_new ['parrot'; 'TclList']
retval = new 'TclList'
loop:
unless iterator goto end
elem = shift iterator
Expand Down Expand Up @@ -552,7 +552,7 @@ find_info_level:
})

.local pmc retval
retval = root_new ['parrot'; 'TclList']
retval = new 'TclList'

.If(null ns, {
.return(retval)
Expand Down Expand Up @@ -626,7 +626,7 @@ bad_args:

.sub 'anon' :anon :load
.local pmc options
options = root_new ['parrot'; 'TclList']
options = new 'TclList'
push options, 'args'
push options, 'body'
push options, 'cmdcount'
Expand Down
2 changes: 1 addition & 1 deletion runtime/builtin/lappend.pir
Expand Up @@ -26,7 +26,7 @@

new_variable:
.catch()
value = root_new ['parrot'; 'TclList']
value = new 'TclList'
# goto loop

loop:
Expand Down
2 changes: 1 addition & 1 deletion runtime/builtin/lrange.pir
Expand Up @@ -42,7 +42,7 @@ set_last:

have_indices:
$I0 = from
R = root_new ['parrot'; 'TclList']
R = new 'TclList'
loop:
if $I0 > to goto end
$P0 = a_list[$I0]
Expand Down
2 changes: 1 addition & 1 deletion runtime/builtin/lrepeat.pir
Expand Up @@ -19,7 +19,7 @@

# convert the Array ireturned by foldup into a TclList.
.local pmc retval
retval = root_new ['parrot'; 'TclList']
retval = new 'TclList'

.local int i_cnt
.local int o_cnt
Expand Down

0 comments on commit 2aba864

Please sign in to comment.