Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-08-10
19:19 • Closed ticket [1530474fff]: Shrink the .exe size plus 3 other changes artifact: dba203d8ac user: dkf
19:19 • Ticket [1530474fff]: 4 changes artifact: 4a7b30dc2d user: dkf
2006-08-07
21:17 • Add attachment tclVar.c-patch to ticket [1530474fff] artifact: eec57d95ac user: afredd
21:17 • Ticket [1530474fff] Shrink the .exe size status still Open with 4 other chan... artifact: bc04256fe9 user: afredd
16:03 • Ticket [1530474fff]: 4 changes artifact: 47d7db7df9 user: afredd
16:03 • Add attachment called_with_shared_object.patch to ticket [1530474ffffff... artifact: 196e2417e6 user: afredd
2006-08-05
05:59 • Ticket [1530474fff] Shrink the .exe size status still Open with 4 other chan... artifact: 9acd766eb5 user: hobbs
2006-08-04
15:36 • Ticket [1530474fff]: 4 changes artifact: f2718b224e user: afredd
01:31 • Ticket [1530474fff]: 5 changes artifact: d109b19573 user: hobbs
00:04 • Ticket [1530474fff]: 6 changes artifact: 0cd88cba3e user: dkf
2006-07-31
12:48 • Ticket [1530474fff]: 1 change artifact: f715c10e21 user: dgp
2006-07-28
23:59 • Ticket [1530474fff]: 4 changes artifact: c1f752e63d user: afredd
23:59 • Add attachment tclClock.c-patch to ticket [1530474fff] artifact: 3a914aadfd user: afredd
23:08 • Ticket [1530474fff] Shrink the .exe size status still Open with 4 other chan... artifact: 956438ad47 user: afredd
23:08 • Add attachment tclBasic.c-patch to ticket [1530474fff] artifact: 17fa5eee8e user: afredd
23:08 • Ticket [1530474fff] Shrink the .exe size status still Open with 4 other chan... artifact: 7f4088247f user: afredd
22:46 • Ticket [1530474fff]: 4 changes artifact: f45d9ccca7 user: afredd
15:46 • New ticket [1530474fff]. artifact: a26c867851 user: afredd

Shrink the .exe size

Closed / Fixed1530474fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-07-28 15:46:01
By converting the 24 calls of:

Tcl_Panic("<function> called with shared object");

in the core, into a (new) function call of

TclSharedObjPanic("<function>");

...where TclSharedObjPanic() constructs the previous
message before calling Tcl_Panic() then
the static .exe shrinks by about 4K (from 770048
to 765952). This is more than i'd expected, so
compilers other than VS6 may give less impressive
savings.

Attached patch includes the trivial changes to

tclBinary.c
tclDictObj.c
tclInt.h
tclListObj.c
tclObj.c
tclStringObj.c
afreddplain2006-07-28 22:46:02
File Added - 186616: TclSharedObjPanic.patch
afreddplain2006-07-28 23:08:13
Logged In: YES 
user_id=1386588

To go with the previous changes, here's a patch that
removes the need for the "::tcl::mathfunc::" prefix
on all math function name static strings in tclBasic.c.
For me this shrinks tclBasic.obj from 80963 to 79965,
a saving of 998bytes.
afreddplain2006-07-28 23:08:14
File Added - 186622: tclBasic.c-patch
afreddplain2006-07-28 23:59:09
File Added - 186627: tclClock.c-patch

Logged In: YES 
user_id=1386588


...and one for tclClock.c that shrinks tclClock.obj
from 23,417 to 23,201 by condensing the clock command
initialisation code.
dgp Ticket [1530474fff]: 1 change [History diff]2006-07-31 12:48:14
dkfplain2006-08-04 00:04:45
Logged In: YES 
user_id=79902

Putting this on the back-burner for now; better to do this
sort of thing during (towards the end of?) the beta cycle.
hobbsplain2006-08-04 01:31:05
Logged In: YES 
user_id=72656

I'm interested to know if the same effect can be had by just
using:

Tcl_Panic("%s called with shared object", <function>);

as the string would remain the same, and no new function is
needed (Tcl_Panic already handles varargs).  If so, that
would be a trivially easy to add in patch.
afreddplain2006-08-04 15:36:45
Logged In: YES 
user_id=1386588

> I'm interested to know if the same effect can be had by
> just using:
> 
> Tcl_Panic("%s called with shared object", <function>);

Good idea... yes, this gives the same 4K file
size reduction as with using a TclSharedObjPanic().

Also, spotted in tclExecute.c:

~1043: Tcl_Panic("shared object passed to TclIncrObj")

which could be reworded to match the others.
hobbsplain2006-08-05 05:59:34
Logged In: YES 
user_id=72656

can you (afredd) please provide the alternate patch?  thx
afreddplain2006-08-07 16:03:08
File Added - 187948: called_with_shared_object.patch

Logged In: YES 
user_id=1386588

> can you (afredd) please provide the alternate patch? thx

Sure - here it is.

I've also added in the reworded Tcl_Panic for TclIncrObj.

Note, while i haven't changed them there are 2 possible
 typos in the (original) panic messages. (1) The panic
 at ~1323 of tclListObj.c says "Tcl_ListObjSetElement"
 but is really in TclListObjSetElement (no underscore).
 (2) Similarly, at ~344 in tclBinary.c the panic in the
 function Tcl_SetByteArrayLength says Tcl_SetObjLength.
afreddplain2006-08-07 21:17:33
File Deleted - 186616: 



File Added - 188005: tclVar.c-patch

Logged In: YES 
user_id=1386588


Another few bytes can be saved by removing the
redundant first "if (objc < 1)" test in Tcl_UnsetObjCmd.
ie. are there a negative number of command arguments.
Looks like a harmless mistranslation of the code for the
old behaviour when [unset] was an error.

Anyways saves a few bytes (257) from the tclVar.obj,
and possibly from the .exe too.
dkfplain2006-08-10 19:19:53
Logged In: YES 
user_id=79902

Applied fixes suggested. Will not backport.
dkf Closed ticket [1530474fff]. [History diff]2006-08-10 19:19:54
Log in (anonymous is fine) to add a comment.

Attachments: