Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | directGet interacts with the callframe. (Has 'out' as well as 'in' because of traces). |
---|---|
Timelines: | family | ancestors | descendants | both | kbk-refactor-directops |
Files: | files | file ages | folders |
SHA3-256: |
22c7d8b27839e05def4300d2a623643f |
User & Date: | kbk 2019-11-12 01:52:25.448 |
Context
2019-11-12
| ||
02:05 | directExists interacts with callframe check-in: 8d343ec32d user: kbk tags: kbk-refactor-directops | |
01:52 | directGet interacts with the callframe. (Has 'out' as well as 'in' because of traces). check-in: 22c7d8b278 user: kbk tags: kbk-refactor-directops | |
01:03 | Add 'generate-callframe-op' method to quadcode translator to refactor 'directXXX' ops. check-in: e877e7f449 user: kbk tags: kbk-refactor-directops | |
Changes
Changes to codegen/build.tcl.
︙ | ︙ | |||
2637 2638 2639 2640 2641 2642 2643 | # Results: # A ZEROONE that indicates whether the variable is set. method directArrayExists(STRING,STRING) {varname elem {name ""}} { my call ${tcl.direct.exists} [list $varname $elem] $name } | | > | | > | 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 | # Results: # A ZEROONE that indicates whether the variable is set. method directArrayExists(STRING,STRING) {varname elem {name ""}} { my call ${tcl.direct.exists} [list $varname $elem] $name } # Builder:directGet(CALLFRAME.STRING) -- # # Read the value of a variable, which should be referred to by a # fully-qualified name. NOTE: this operation can fail because of traces # so it produces a STRING FAIL. Quadcode implementation ('directGet'). # # Parameters: # cf - The callframe to use for other than fully-qualified varnames # varname - # The variable name as an LLVM value reference. # ec - Where to write the error code if an error happens. # name (optional) - # A name to give to the result value. # # Results: # The contents of the variable. method directGet(CALLFRAME,STRING) {cf varname ec {name ""}} { set result [my call ${tcl.direct.get} [list $varname {} $ec] $name] return [my frame.pack $cf $result] } # Builder:directArrayGet(STRING,STRING) -- # # Read the value of an array variable, which should be referred to by a # fully-qualified name. NOTE: this operation can fail because of traces # so it produces a STRING FAIL. Quadcode implementation |
︙ | ︙ | |||
2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 | # Builder:directSet(CALLFRAME,STRING,STRING) -- # # Set the value of a variable, which should be referred to by a # fully-qualified name. NOTE: this operation can fail because of traces # so it produces a STRING FAIL. Quadcode implementation ('directSet'). # # Parameters: # varname - # The variable name as an LLVM value reference. # value - The value to append as an LLVM value reference. # ec - Where to write the error code if an error happens. # name (optional) - # A name to give to the result value. # | > | 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 | # Builder:directSet(CALLFRAME,STRING,STRING) -- # # Set the value of a variable, which should be referred to by a # fully-qualified name. NOTE: this operation can fail because of traces # so it produces a STRING FAIL. Quadcode implementation ('directSet'). # # Parameters: # cf - The callframe to use for other than fully-qualified varnames # varname - # The variable name as an LLVM value reference. # value - The value to append as an LLVM value reference. # ec - Where to write the error code if an error happens. # name (optional) - # A name to give to the result value. # |
︙ | ︙ |
Changes to codegen/compile.tcl.
︙ | ︙ | |||
517 518 519 520 521 522 523 | set srcs [my ConvertIndices 0 strlen 1 2] set res [$b $opcode {*}$srcs $errorCode $name] if {"FAIL" in [my ValueTypes $tgt]} { my SetErrorLine $errorCode [$b maybe $res] } my StoreResult $tgt $res } | | | | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | set srcs [my ConvertIndices 0 strlen 1 2] set res [$b $opcode {*}$srcs $errorCode $name] if {"FAIL" in [my ValueTypes $tgt]} { my SetErrorLine $errorCode [$b maybe $res] } my StoreResult $tgt $res } "directAppend" - "directLappend" - "directLappendList" - "directUnset" - "directArrayGet" - "directArraySet" - "directArrayAppend" - "directArrayLappend" - "directArrayLappendList" - "directArrayUnset" - "directIsArray" - "directMakeArray" - "regexp" - "listLength" - "listIn" - "listNotIn" - "dictIterStart" - "dictAppend" - "dictIncr" - "dictLappend" - "dictSize" - "div" - "expon" - "mod" - "verifyList" - "dictGetOrNexist" - "dictSetOrUnset" { set srcs [lassign $l opcode tgt] set name [my LocalVarName $tgt] append opcode ( [my ValueTypes {*}$srcs] ) set srcs [lmap s $srcs {my LoadOrLiteral $s}] set res [$b $opcode {*}$srcs $errorCode $name] if {"FAIL" in [my ValueTypes $tgt]} { my SetErrorLine $errorCode [$b maybe $res] } my StoreResult $tgt $res } "directGet" - "directSet" { set srcs [lassign $l opcode tgt] set name [my LocalVarName $tgt] append opcode ( [my ValueTypes {*}$srcs] ) set srcs [lmap s $srcs {my LoadOrLiteral $s}] set res [$b $opcode {*}$srcs $errorCode $name] set resNoCF [$b frame.value $res] my SetErrorLine $errorCode [$b maybe $resNoCF] |
︙ | ︙ |
Changes to demos/perftest/tester.tcl.
︙ | ︙ | |||
2752 2753 2754 2755 2756 2757 2758 | linesearch::getAllLines2 regexptest::* vartest::* nsvartest::* directtest::init directtest::accum directtest::summarize directtest::check directtest::ary1 | | | | 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 | linesearch::getAllLines2 regexptest::* vartest::* nsvartest::* directtest::init directtest::accum directtest::summarize directtest::check directtest::ary1 directtest::ary2 directtest::ary3 directtest::ary4 directtest::ary5 directtest::alias upvar0 upvar0a upvartest0::* upvartest1::* upvartest2::* flightawarebench::* |
︙ | ︙ |
Changes to quadcode/translate.tcl.
︙ | ︙ | |||
632 633 634 635 636 637 638 | my quads copy $res $inval } incrStkImm { set var [list temp [incr depth -1]] set delta [list literal [lindex $insn 1]] # TODO: This assumes we're dealing with qualified names! set val {temp opd2} | | | | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | my quads copy $res $inval } incrStkImm { set var [list temp [incr depth -1]] set delta [list literal [lindex $insn 1]] # TODO: This assumes we're dealing with qualified names! set val {temp opd2} my generate-callframe-op $pc directGet $val $var my generate-arith-domain-check $pc incr $val $delta my quads purify {temp opd0} $val my quads purify {temp opd1} $delta my quads add $val {temp opd0} {temp opd1} my generate-callframe-op $pc directSet $var $var $val # WAS: my error-quads $pc directSet $var $var $val } incrStk { set delta [list temp [incr depth -1]] set var [list temp [incr depth -1]] # TODO: This assumes we're dealing with qualified names! set val {temp opd2} my generate-callframe-op $pc directGet $val $var my generate-arith-domain-check $pc incr $val $delta my quads purify {temp opd0} $val my quads purify {temp opd1} $delta my quads add $val {temp opd0} {temp opd1} my generate-callframe-op $pc directSet $var $var $val # WAS: my error-quads $pc directSet $var $var $val } |
︙ | ︙ | |||
737 738 739 740 741 742 743 | set var [list temp [incr depth -1]] # TODO: This assumes we're dealing with qualified names! my quads directArrayExists $var $var $elem } loadStk { set var [list temp [incr depth -1]] # TODO: This assumes we're dealing with qualified names! | | | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | set var [list temp [incr depth -1]] # TODO: This assumes we're dealing with qualified names! my quads directArrayExists $var $var $elem } loadStk { set var [list temp [incr depth -1]] # TODO: This assumes we're dealing with qualified names! my generate-callframe-op $pc directGet $var $var } loadArrayStk { set elem [list temp [incr depth -1]] set var [list temp [incr depth -1]] # TODO: This assumes we're dealing with qualified names! my error-quads $pc directArrayGet $var $var $elem } |
︙ | ︙ |
Changes to quadcode/types.tcl.
︙ | ︙ | |||
758 759 760 761 762 763 764 | } resolveCmd { return $STRING } originCmd - frameArgs { return [expr {$STRING | $FAIL}] } | | | | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | } resolveCmd { return $STRING } originCmd - frameArgs { return [expr {$STRING | $FAIL}] } directAppend - directLappend - directLappendList - directArrayGet - directArraySet - directArrayAppend - directArrayLappend - directArrayLappendList { # Can't assume more; these may be touching traced variables return [expr {$STRING | $FAIL}] } directGet - directSet { return [expr {$CALLFRAME | $STRING | $FAIL}] } directExists - directArrayExists { return $BOOL } directUnset - directArrayUnset - directIsArray - directMakeArray { return [expr {$BOOL | $FAIL}] |
︙ | ︙ |