about summary refs log tree commit diff
path: root/src/rt/rust_task.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2013-06-16 14:51:50 +0200
committerBjörn Steinbrink <bsteinbr@gmail.com>2013-06-16 17:52:46 +0200
commit642cd467c6b49f50b42d833480b875ca5eb64e32 (patch)
treef8711972df699b79546d4355d374d0a11f826cf9 /src/rt/rust_task.cpp
parentebca26cd542e2e733bf11c7be7b541b54b0f9ef2 (diff)
downloadrust-642cd467c6b49f50b42d833480b875ca5eb64e32.tar.gz
rust-642cd467c6b49f50b42d833480b875ca5eb64e32.zip
Avoid quadratic growth of cleanup blocks
Currently, cleanup blocks are only reused when there are nested scopes, the
child scope's cleanup block will terminate with a jump to the parent
scope's cleanup block. But within a single scope, adding or revoking
any cleanup will force a fresh cleanup block. This means quadratic
growth with the number of allocations in a scope, because each
allocation needs a landing pad.

Instead of forcing a fresh cleanup block, we can keep a list chained
cleanup blocks that form a prefix of the currently required cleanups.
That way, the next cleanup block only has to handle newly added
cleanups. And by keeping the whole list instead of just the latest
block, we can also handle revocations more efficiently, by only
dropping those blocks that are no longer required, instead of all of
them.

Reduces the size of librustc by about 5% and the time required to build
it by about 10%.
Diffstat (limited to 'src/rt/rust_task.cpp')
0 files changed, 0 insertions, 0 deletions