Changes On Branch 993ce8428b71df94
Not logged in

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

Changes In Branch dgp-stringcat-delaystringrep Through [993ce8428b] Excluding Merge-Ins

This is equivalent to a diff from 2487a9bc13 to 993ce8428b

2017-06-08
21:15
Another TclStringCatObjv optimization to delay/avoid string rep generation. check-in: f3884d09d4 user: dgp tags: trunk
21:05
Modernize overflow checks. check-in: f4c7382b8a user: dgp tags: dgp-stringcat-delaystringrep
20:58
merge trunk check-in: 993ce8428b user: dgp tags: dgp-stringcat-delaystringrep
20:57
More streamlining check-in: 8d50922091 user: dgp tags: dgp-stringcat-delaystringrep
20:49
Make read and write operations on Tcl_Var handles available in tclInt API. check-in: 2487a9bc13 user: dkf tags: trunk
20:49
Make read and write operations on Tcl_Var handles available in tclInt API. (This will be useful f... check-in: 7d94f61c60 user: dkf tags: core-8-6-branch
12:53
merge core-8-6-branch check-in: 0a9475dd06 user: jan.nijtmans tags: trunk

Changes to generic/tclStringObj.c.
2941
2942
2943
2944
2945
2946
2947


2948
2949
2950
2951
2952
2953
2954








2955
2956




2957




2958
2959
2960
2961
2962
2963
2964
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964


2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980







+
+







+
+
+
+
+
+
+
+
-
-
+
+
+
+

+
+
+
+







		    if ((length += numChars) < 0) {
			goto overflow;
		    }
		}
	    }
	} while (--oc);
    } else {
	Tcl_Obj *pendingPtr = NULL;

	/* Result will be concat of string reps. Pre-size it. */
	ov = objv; oc = objc;
	do {
	    int numBytes;

	    objPtr = *ov++;

	    if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) {
		/* No string rep; Take the chance we can avoid making it */

		last = objc - oc;
		first = last;
		pendingPtr = objPtr;
	    } else {

	    Tcl_GetStringFromObj(objPtr, &numBytes);	/* PANIC? */
	    if (numBytes) {
		Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */
		if (numBytes == 0) {
		    continue;
		}
		last = objc - oc;
		if (pendingPtr) {
		    Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */
		    pendingPtr = NULL;
		}
		if (length == 0) {
		    first = last;
		}
		if ((length += numBytes) < 0) {
		    goto overflow;
		}
	    }
3071
3072
3073
3074
3075
3076
3077


3078
3079
3080
3081
3082
3083
3084
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102







+
+







		    Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
		}
		return TCL_ERROR;
	    }
	    dst = Tcl_GetString(objResultPtr) + start;
	    if (length > start) {
		TclFreeIntRep(objResultPtr);
	    } else {
		/* Can't happen ? */
	    }
	} else {
	    objResultPtr = Tcl_NewObj();	/* PANIC? */
	    if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
		if (interp) {
		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    	"concatenation failed: unable to alloc %u bytes",
Changes to tests/string.test.
1990
1991
1992
1993
1994
1995
1996






























1997
1998
1999
2000
2001
2002
2003
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    set xx [string repeat $x $n]
    set vv [string repeat {$x} $n]
    set vvs [string repeat {$x } $n]
    set r1 [string compare $xx [subst $vv]]
    set r2 [string compare $xx [eval "string cat $vvs"]]
    list $r1 $r2
} {0 0}
test string-29.5 {string cat, efficiency} -body {
    tcl::unsupported::representation [string cat [list x] [list]]
} -match glob -result {*no string representation}
test string-29.6 {string cat, efficiency} -body {
    tcl::unsupported::representation [string cat [list] [list x]]
} -match glob -result {*no string representation}
test string-29.7 {string cat, efficiency} -body {
    tcl::unsupported::representation [string cat [list x] [list] [list]]
} -match glob -result {*no string representation}
test string-29.8 {string cat, efficiency} -body {
    tcl::unsupported::representation [string cat [list] [list x] [list]]
} -match glob -result {*no string representation}
test string-29.9 {string cat, efficiency} -body {
    tcl::unsupported::representation [string cat [list] [list] [list x]]
} -match glob -result {*no string representation}
test string-29.10 {string cat, efficiency} -body {
    tcl::unsupported::representation [string cat [list x] [list x]]
} -match glob -result {*, string representation "xx"}
test string-29.11 {string cat, efficiency} -body {
    tcl::unsupported::representation \
	[string cat [list x] [encoding convertto utf-8 {}]]
} -match glob -result {*no string representation}
test string-29.12 {string cat, efficiency} -body {
    tcl::unsupported::representation \
	[string cat [encoding convertto utf-8 {}] [list x]]
} -match glob -result {*, string representation "x"}
test string-29.13 {string cat, efficiency} -body {
    tcl::unsupported::representation [string cat \
	[encoding convertto utf-8 {}] [encoding convertto utf-8 {}] [list x]]
} -match glob -result {*, string representation "x"}



# cleanup
rename MemStress {}
catch {rename foo {}}
::tcltest::cleanupTests