Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable inline allocation of structs with pointers #34126

Merged
merged 1 commit into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ Language changes
* The line number of function definitions is now added by the parser as an
additional `LineNumberNode` at the start of each function body ([#35138]).

Compiler/Runtime improvements
-----------------------------

* Immutable structs (including tuples) that contain references can now be allocated
on the stack, and allocated inline within arrays and other structs ([#33886]).
This significantly reduces the number of heap allocations in some workloads.
Code that requires assumptions about object layout and addresses (usually for
interoperability with C or other languages) might need to be updated; for
example any object that needs a stable address should be a `mutable struct`.

Command-line option changes
---------------------------

Expand All @@ -79,9 +89,6 @@ Command-line option changes

* Color now defaults to on when stdout and stderr are TTYs ([#34347])

Command-line option changes
---------------------------

* `-t N`, `--threads N` starts Julia with `N` threads. This option takes precedence over
`JULIA_NUM_THREADS`. The specified number of threads also propagates to worker
processes spawned using the `-p`/`--procs` or `--machine-file` command line arguments.
Expand Down
9 changes: 4 additions & 5 deletions src/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,10 @@ void jl_compute_field_offsets(jl_datatype_t *st)
// now finish deciding if this instantiation qualifies for special properties
assert(!isbitstype || st->layout->npointers == 0); // the definition of isbits
if (isinlinealloc && st->layout->npointers > 0) {
//if (st->ninitialized != nfields)
// isinlinealloc = 0;
//else if (st->layout->fielddesc_type != 0) // GC only implements support for this
// isinlinealloc = 0;
isinlinealloc = 0;
if (st->ninitialized != nfields)
isinlinealloc = 0;
else if (st->layout->fielddesc_type != 0) // GC only implements support for this
isinlinealloc = 0;
}
st->isbitstype = isbitstype;
st->isinlinealloc = isinlinealloc;
Expand Down