Check-in [ab6da27502]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix translation bugs that broke [dict] tests
Timelines: family | ancestors | descendants | both | notworking | kbk-refactor-callframe
Files: files | file ages | folders
SHA3-256: ab6da275020a92d99d89d1c6446d837e5944864845fa7b40928d27b968341f8c
User & Date: kbk 2019-01-29 02:00:01.161
Context
2019-01-29
13:19
Fix misorderered scalar check/copy to result check-in: 36e8177510 user: kbk tags: notworking, kbk-refactor-callframe
02:00
Fix translation bugs that broke [dict] tests check-in: ab6da27502 user: kbk tags: notworking, kbk-refactor-callframe
2019-01-23
02:12
Add conversion to IMPURE ZEROONE INT, needed in booltest. Keep code motion from messing with the callframe for now. Patch out the handful of remaining tests that abort. Next up: fix the dictest tests involving 'dict update', lsetest, and re-add support for direct ops. check-in: 27339e7e0c user: kbk tags: notworking, kbk-refactor-callframe
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to demos/perftest/tester.tcl.
562
563
564
565
566
567
568
569
570


571

572

573

574
575
576
577
578
579
580
562
563
564
565
566
567
568


569
570

571
572
573
574
575
576
577
578
579
580
581
582







-
-
+
+
-
+

+

+







    lappend l a b c d e f
    set x [lrange $l 0 1]
    set y [lrange $l 2 end]
    list $l $x $y
}

proc lsetest {l {ix { 2 }}} {
    for {set i 0} {$i < [llength $l]} {incr i} {
	lset l $i >[lindex $l $i]<
    # for {set i 0} {$i < [llength $l]} {incr i} {
    # 	lset l $i >[lindex $l $i]<
    }
    # }
    lset l $ix abc
    puts "After first lset: $l"
    lset l 1 1 def
    puts "After second lset: $l"
    return $l
}
proc lappendtest {l} {
    lappend l a
    lappend l b c
    return $l
}
2670
2671
2672
2673
2674
2675
2676
2677

2678
2679
2680


2681
2682
2683
2684
2685
2686
2687
2672
2673
2674
2675
2676
2677
2678

2679
2680


2681
2682
2683
2684
2685
2686
2687
2688
2689







-
+

-
-
+
+







    numberitems numberitems2 numberitems3 doubleitems
    containment
    lsorttest
    lsortcmd
    # Dictionary operations (also see some [try] tests)
    dictest
    dictest2
    # dictest3			TEMP generates incorrect code
    dictest3
    dictest4 dictest5
    # dictest6 dictest7		TEMP generates incorrect code
    # dictest8			TEMP generates incorrect code
    dictest6 dictest7
    dictest8
    dictest9
    dictfor
    # Nonexistent variables
    nextest1
    nextest2
    nextest3
    nextest4
Changes to quadcode/constfold.tcl.
734
735
736
737
738
739
740
741
742


743
744
745
734
735
736
737
738
739
740


741
742
743
744
745







-
-
+
+



	}
	set bb [lindex $bbcontent $b]
	lset bbcontent $b {}
	lset bbcontent $b [lrange $bb[set bb ""] 0 $newpc]
    }

    my debug-constfold {
#	puts "After constfold:"
#	my dump-bb
	puts "After constfold:"
	my dump-bb
    }
    return $changed
}
Changes to quadcode/translate.tcl.
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
530
531
532
533
534
535
536

537
538
539
540
541
542
543







-







		set mid [list temp opnd0]
		set val [list temp [incr depth -1]]
		set idx 0
		set toUpdate {}
		foreach v [dict get $aux variables] {
		    set r [my index-to-var $v]
		    my generate-move-from-callframe $r
		    my generate-existence-check $pc $r
		    my generate-scalar-check $pc $r {TCL WRITE VARNAME} \
			"can't set \"%s\": variable is array"
		    my error-quads $pc listIndex $mid $val [list literal $idx]
		    my error-quads $pc dictGetOrNexist $r $var $mid
		    lappend toUpdate [list literal [lindex $r 1]] $r
		    incr idx
		}
569
570
571
572
573
574
575
576


577
578
579
580
581
582
583
584
585



586


587
588
589
590
591
592
593
568
569
570
571
572
573
574

575
576
577
578
579
580
581
582
583
584
585
586
587
588

589
590
591
592
593
594
595
596
597







-
+
+









+
+
+
-
+
+







		    my quads arrayExists $isary $r
		    set n [llength $quads]
		    my quads jumpFalse [list pc [expr {$n + 3}]] $isary
		    my quads copy $mid Nothing
		    my quads jump [list pc [expr {$n + 4}]]
		    my quads extractScalar $mid $r
		    # Write the value to the right key of the dict
		    my error-quads $pc dictSetOrUnset $updating $updating $key $mid
		    my error-quads $pc dictSetOrUnset \
			$updating $updating $key $mid
		}
		my quads copy $var $updating
		my update-in-callframe [list literal [lindex $var 1]] $var
	    }
	    unsetScalar {
		# TODO - This doesn't complain on unsetting a nonexistent
		#        variable, it ignores '-nocomplain'
		set var [my index-to-var [lindex $insn 2]]
		my quads unset $var
		if {[lindex $var 0] eq "var"} {
		    my quads moveToCallFrame \
			{temp @callframe} {temp @callframe} \
		my update-in-callframe [list literal [lindex $var 1]] Nothing
			[list literal [lindex $var 1]] Nothing
		}
	    }
	    unsetArray {
		# TODO - This doesn't complain on unsetting a nonexistent
		#        element, it ignores '-nocomplain'
		set idx [list temp [incr depth -1]]
		set ary [my index-to-var [lindex $insn 2]]
		my generate-move-from-callframe $ary