Merge branch 'bjorn/compiler/optimizations/OTP-11584'

* bjorn/compiler/optimizations/OTP-11584:
  Generalize optimizations of case statements
  Ignore warnings when running sys_core_fold after inlining
Update primary bootstrap
Test open types that may need more than 128 bytes
Teach asn1ct_func:call_gen/4 to quote the generated function name

The function name could contain hyphens or other characters not
allowed in non-quoted function names.
Improve construction of {cons,H,T} instructions

Make sure that we don't construct:

   {cons,{integer,I},{cons,{binary,B},T}}    - OR -
   {cons,{binary,B},{cons,{integer,I},T}}

but:

   {cons,{binary,[{put_bits,I,8,[1]}|B]},T}  - OR -
   {cons,{binary,B++[{put_bits,I,8,[1]}]},T}
Improve optimization of alignment for encoding
Factor out printing of verbose messages
Introduce asn1ct_gen:open_output_file/1
asn1ct_imm: Add a field for intermediate code for call_gen

It will greatly facilitate further optimizations if we include the
intermediate code (if available) in the call_gen tuple.
Keep type information in the apply intermediate instruction

To facilitate inlining of apply calls in the intermediate format.
asn1ct_imm: Add the {set,{var,Src},{var,Dst}} instruction

The {assign,Dst,Src} instruction is difficult to cope with when
doing advanced optimizations, since its source argument is a string
which may contain any expression.

Instead of changing how {assign,_,_} works, we will introduce new
instructions that can be used instead of {assign,_}, and remove
{assign,_,_} in a later commit when it is no longer used.

The first new instruction we will introduce is:

   {set,{var,Src},{var,Dst}}

It is useful for common sub-expression elemination among other things.
For the moment, we will only allow a variable as a source argument,
but we could extend it in the future to allow constants as well.
Generate intermediate code that is easier to optimize

Instead of generating:

   {assign,Dst,"element(2, Val)"}

generate:

   {call,erlang,element,[2,{var,"Val"}],Dst}

The latter expression is easier to understand since there is no
need to parse a string which may contain an arbitrary expression.

While at it, also discontinue the practice to treat "naked"
atoms as variables. A variable must always be given as {var,String}.
asn1ct_imm: Add the intermediate instruction {list,List,Dst}

The {list,List,Dst} instruction gives us as general way to
capture the building of something into a variable. That will make
inlining of intermediate code much easier.

It also allows us to eliminate the versions of the apply, call_gen,
and cond instructions that takes a target variable.

Also remove the optimization in the alignment optimization pass
that attempts to replace calls to complete/1 with calls to
iolist_to_binary/1. That optimization will not work anymore without
rewriting, so we will remove it in this commit and introcude a
more powerful optimization in a future commit.
Optimize code surrounding calls to complete/1

complete/1 is used when encoding open types (as well as in the
encode/2 function in a generated module).

The use of complete/1 for encoding open types used to be optimized
in two different places.

One place was in the alignment optimization pass, where we attempted
to replace the call to complete/1 with a call to iolist_to_binary/1.
That optimization was taken out in a previous commit that introduced
the {list,_,_} intermediate instruction.

The other place was when creating the intermediate representation
for the encoding of the open type. When attempting to wrap primitive
types in an open type, we would attempt to optimize the encoding of
the length decscriptor. We will remove that optimization in this
commit.

Since the previous two optimizations did not optimize encoding of
open types as much as we would want, we will introduce a new
optimization in a separate pass that will go further than the
previous optimizations.
Merge branch 'sverk/bin2term-int-size-estimation-bug'

OTP-11585

* sverk/bin2term-int-size-estimation-bug:
  erts: Fix useless comparisons in binary_SUITE:external_size
  erts: Reduce heap usage for binary_SUITE:deep
  erts: Remove overestimation of heap space in binary_to_term
Merge branch 'sverk/jinterface/unicode-test-bug'

* sverk/jinterface/unicode-test-bug:
  jinterface: Fix unicode bug in test code
(memcheck) Uninitialized structure in gen_challenge
Fix testcase driver_SUITE:consume_timeslice
Merge branch 'rickard/consume_timeslice-testcase-fix'

* rickard/consume_timeslice-testcase-fix:
  Fix testcase driver_SUITE:consume_timeslice
Merge branch 'sverk/term2bin-simplify'

* sverk/term2bin-simplify:
  erts: Refactor ESTACK & WSTACK to use a struct easy to "export"
  erts: Fix benign ESTACK/WSTACK typo
  erts: Fix compiler warnings for NO_JUMP_TABLE
  erts: Run binary_SUITE:trapping even for 32bit
  erts: Extend binary_SUITE:ttb_trap to also cover binary_to_term
  erts: Remove the extra_root feature from the process structure
  erts: Simplify term_to_binary by removing saved ESTACK from root set