Revision 20a3e85388c5a20f5dfcf3798c0a6d96c62ed379 authored by Shuhei Kadowaki on 10 January 2022, 10:24:26 UTC, committed by Shuhei Kadowaki on 10 January 2022, 13:11:51 UTC
This commit changes the semantics of `BoundsError` so that it doesn't capture arrays/tuples passed to its constructor. The change wouldn't improve any performance by itself because the `BoundsError` constructor is mostly called on error paths and thus it is opaque to analyses/optimizers when compiling a caller context. Rather it's supposed to be a building block for broadening the possibility of certain memory optimizations in the future such as copy elision for `ImmutableArray` construction and stack allocation of `Array`s, by allowing us to assume the invariant that primitive indexing operations into array/tuple indexing don't escape it so that our escape analyses can achieve further accuracy. Specifically, when `BoundsError` constructor will now compute the "summary" of its `Array`/`Tuple` argument, rather than capturing it for the later inspection. Assuming `Base.summary(x::Array)` or `Base.summary(x::Tuple)` don't escape `x`, we can assume that `BoundsError` doesn't escape `x`. This change won't appear as breaking in most cases since `showerror` will print the exact same error message as before, but obviously this is technically breaking since we can no longer access to the original arrays/tuples by catching `BoundsError`. I'd say this breaking semantic change would be still acceptable, since I think it's enough if we can know size/type of arrays/tuples from `BoundsError` in most cases. As a last note, I didn't change the semantics for arbitrary user objects, since we still don't have a good infrastructure to tell the compiler some primitive assumptions/rules about user type objects anyway.
1 parent dbd10e0
File | Mode | Size |
---|---|---|
.buildkite | ||
.devcontainer | ||
.github | ||
base | ||
cli | ||
contrib | ||
deps | ||
doc | ||
etc | ||
src | ||
stdlib | ||
test | ||
.clang-format | -rw-r--r-- | 3.3 KB |
.codecov.yml | -rw-r--r-- | 52 bytes |
.gitattributes | -rw-r--r-- | 65 bytes |
.gitignore | -rw-r--r-- | 433 bytes |
.mailmap | -rw-r--r-- | 11.1 KB |
CITATION.bib | -rw-r--r-- | 513 bytes |
CITATION.cff | -rw-r--r-- | 942 bytes |
CONTRIBUTING.md | -rw-r--r-- | 22.5 KB |
HISTORY.md | -rw-r--r-- | 333.2 KB |
LICENSE.md | -rw-r--r-- | 1.3 KB |
Make.inc | -rw-r--r-- | 49.3 KB |
Makefile | -rw-r--r-- | 25.6 KB |
NEWS.md | -rw-r--r-- | 9.9 KB |
README.md | -rw-r--r-- | 7.4 KB |
THIRDPARTY.md | -rw-r--r-- | 3.7 KB |
VERSION | -rw-r--r-- | 10 bytes |
julia.spdx.json | -rw-r--r-- | 35.0 KB |
sysimage.mk | -rw-r--r-- | 4.0 KB |
Computing file changes ...