|
2007-06-06
| ||
| 01:36 | • Add attachment 1701202.patch to ticket [1701202fff] artifact: 1007342760 user: msofer | |
| 01:36 | • Closed ticket [1701202fff]: Tcl stack reform plus 8 other changes artifact: c2df5c40c7 user: msofer | |
|
2007-05-24
| ||
| 01:21 | • Add attachment 1701202.patch to ticket [1701202fff] artifact: 66d7d223b3 user: dgp | |
| 01:21 | • Ticket [1701202fff] Tcl stack reform status still Open with 4 other changes artifact: 16c2f4521d user: dgp | |
|
2007-04-18
| ||
| 22:42 | • Ticket [1701202fff]: 4 changes artifact: 29b6b8c1ea user: msofer | |
| 22:42 | • Add attachment execEnv.patch to ticket [1701202fff] artifact: 343eb1237a user: msofer | |
| 05:39 | • Ticket [1701202fff] Tcl stack reform status still Open with 4 other changes artifact: a3c712fcfb user: msofer | |
|
2007-04-17
| ||
| 22:52 | • Ticket [1701202fff]: 4 changes artifact: 97c5f3f8ea user: dgp | |
|
2007-04-16
| ||
| 17:54 | • Ticket [1701202fff]: 4 changes artifact: 169f5dbb97 user: msofer | |
| 07:30 | • Ticket [1701202fff]: 4 changes artifact: c8bdabc897 user: msofer | |
| 00:30 | • New ticket [1701202fff]. artifact: 45fb2c4453 user: msofer | |
Tcl stack reform
Closed / Accepted1701202fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 19 years ago
Descriptionplain2007-04-16 00:30:38
Since we started using TclStackAlloc, some of the basic assumptions underlying tebc's mem design ceased being correct. In particular, when the stack is grown the old stack will now typically remain active until every bytecode running in it returns - as the corresponding CallFrames live there, the old stacks remain active.
This means that the recopying of stack items is not really necessary. This patch redesigns the ExecEnv system to work differently: there may be many
stacks (in a doubly-linked list). When there is not enough room left in the active stack, the next one is used if it exists (it will be both the last one and empty) - but no elements are typically copied over (exception: growth for {*}-expansion).
On freeing of a stack requirement, empty stacks that are not last are ckfree'd. In this manner the largest stack allocated remains always here, smaller stacks are ckfreed when they cease being used. This behaviour is
similar to what de facto we have now, with the old copies being blocked by TclStackAlloc'ed frames.
With this patch both performance and memory usage should improve in general, although it is possible to devise cases where it consumes more memory than the current scheme.
Performance improvements (small, seem to be about 5% on my very unreliable benchmariking setup) due to:
(a) CACHE_STACK_INFO now necessary, a running bc can not get its stack changed (except by it using {*}, so the adaptation is localised there)
(b) when a new stack is needed for a new bytecode, no data is copied over. When {*} requires a new stack, only the data corresponding to the current bc is copied over. The current scheme requires a copy of the complete stack contents, including every TclStackAlloc'ed sections.
(c) (epsilon squared) there is no more refcounting of the stacks
Memory improvements: when a new stack is allocated, the complete memory is available as nothing is copied over from older stacks. The *2 growth might be too generous under these circumstances, maybe 1.5 would be enough?
The patch also creates a new TclStackRealloc, that permits resizing of the last TclStackAlloc'ed memory (unused, just very easy to add as it uses functionality needed for {*}).
msoferplain2007-04-16 07:30:39
File Added - 225089: execEnv.patch
msoferplain2007-04-16 17:54:30
Logged In: YES user_id=148712 Originator: YES Typo, missing a "not": CACHE_STACK_INFO is now NOT necessary
dgpplain2007-04-17 22:52:23
Logged In: YES user_id=80530 Originator: NO suspending review until 1702212 is resolved
msoferplain2007-04-18 05:39:31
File Deleted - 225089: File Added - 225397: execEnv.patch Logged In: YES user_id=148712 Originator: YES 1702212 resolved, new patch File Added: execEnv.patch
msoferplain2007-04-18 22:42:02
File Deleted - 225397: File Added - 225536: execEnv.patch Logged In: YES user_id=148712 Originator: YES File Added: execEnv.patch
dgpplain2007-05-24 01:21:57
File Added - 230285: 1701202.patch Logged In: YES user_id=80530 Originator: NO patch updated to current Tcl HEAD File Added: 1701202.patch
msoferplain2007-06-06 01:36:45
File Added - 231859: 1701202.patch Logged In: YES user_id=148712 Originator: YES Removed commented-out flotsam from patch; committed File Added: 1701202.patch
Log in (anonymous is fine) to add a comment.
Attachments:
- 1701202.patch [download] added by msofer on 2007-06-06 01:36:45. [details]
- execEnv.patch [download] added by msofer on 2007-04-18 22:42:02. [details]