Skip to content

Commit

Permalink
enable inline allocation of structs with pointers (#34126)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Apr 27, 2020
1 parent 7d27fa8 commit 8073ddf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
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

0 comments on commit 8073ddf

Please sign in to comment.