Age | Commit message (Collapse) | Author |
|
It was not possible to preserve extra arguments in transformations.
The following (hypothetical) example will now work:
some_op Lit=c SizeArg Rest=* => move Lit x | some_op x SizeArg Rest
|
|
|
|
Perl 5.16.1 (and perhaps other versions) issues the following
warning:
defined(@array) is deprecated at utils/beam_makeops line 1714.
(Maybe you should just omit the defined()?)
for the following line:
$prev_last = pop(@{$gen_transform{$key}})
if defined @{$gen_transform{$key}}; # LINE 1714
The documentation for "defined" says that its use on hashes and
arrays is deprecated and that it may stop working in a future
release.
Simply removing "defined" (as suggested by the warning message)
will not work, as there will be an error when trying to use an
undefined value as an array reference:
Can't use an undefined value as an ARRAY reference at
utils/beam_makeops line 1714.
What we must do is to check whether $gen_transform{$key} is
defined before trying to use it as an array reference.
Noticed-by: Tuncer Ayaz
|
|
|
|
|
|
|
|
|
|
|
|
'store_var' is always followed by 'next_arg'.
|
|
'next_instr' is always followed by 'is_op'.
|
|
Since the 'new_instr' instruction always occurs before the
'store_op' instruction, we can merge the instructions into one.
Also, there is no need to include the arity of the BEAM
instruction as an operand, since the arity can be looked up
based on the opcode.
|
|
A 'call' instruction in the loader transformation language is
always followed by an 'end' instruction, so we can replace the
'call' instruction with a 'call_end' instruction.
|
|
If the left part of a transformation will always match, omit the
the 'try_me_else' and 'fail' instructions.
As part of this optimization, make it an error to have a
transformation that can never be reached because of a previous
transformation that will always match. (Remove one transformation
from ops.tab that was found to be unreachable.)
|
|
|
|
This optimization will save some space (in the loader tables) and
some loading time.
|
|
Fix the incorrect code that attempted to remove a single
'next_arg' instructions before 'next_instr'.
|
|
It is more useful to have a helper function that can test for
any instruction.
|
|
|
|
The handling of large values for other tags than TAG_i (integer) is
buggy. Any tag value equal to or greater than 2^40 (5 bytes) will
abort loading. Tag values fitting in 5 bytes will be truncated to 4
bytes values.
Those bugs cause real problems because the bs_init2/6 and
bs_init_bits/6 instructions unfortunately use TAG_u to encode literal
sizes (using TAG_i would have been a better choice, but it is too late
to change that now). Any binary size that cannot fit in an Uint
should cause a system_limit exception at run-time, but instead the
buggy handling will either cause an emulator crash (for values in the
range 2^32 to 2^40-1) or abort loading.
In this commit, implement overflow checking of tag values as a
preparation for fixing the binary construction instructions. If any
tag value cannot fit in an Uint (except for TAG_i), change the
tag to the special TAG_o overflow tag.
|
|
We want to make sure that a tag/type name is not defined more than
once and that we don't define too many primitive tags. Primitive
tags must be named with lowercase letters (or they will be confused
with variable names in transformations in the ops.tab file).
|
|
|
|
In many (not all) cases, the value for the 'I' type will
fit into 32 bits.
|
|
We don't want the packable types listed in two places.
|
|
Introduce a new 'Q' type, similar to 'P' except that it
can be packed.
|
|
In the 32-bit BEAM emulator, it is only possible to pack
3 register operands into one word. Therefore, the move2
instruction (that has 4 operands) needs two words for its
operands.
Take advantage of the larger wordsize in the 64-bit emulator
and pack up to 4 operands into a single word.
|
|
Giving the beam_makeops script access to the external word
size (=the size of instruction words) will allow it to pack
more operands into a word for the 64 bits emulator.
|
|
In the transformation engine in the loader, an is_eq/1 instruction
is currently always preceded by an is_type/1 instruction. Therefore,
save a word and slight amount of time by combining those
instructions into an is_type_eq/2 instruction.
|
|
|
|
|
|
|
|
* pan/otp_8332_halfword:
Teach testcase in driver_suite the new prototype for driver_async
wx: Correct usage of driver callbacks from wx thread
Adopt the new (R13B04) Nif functionality to the halfword codebase
Support monitoring and demonitoring from driver threads
Fix further test-suite problems
Correct the VM to work for more test suites
Teach {wordsize,internal|external} to system_info/1
Make tracing and distribution work
Turn on instruction packing in the loader and virtual machine
Add the BeamInstr data type for loaded BEAM code
Fix the BEAM dissambler for the half-word emulator
Store pointers to heap data in 32-bit words
Add a custom mmap wrapper to force heaps into the lower address range
Fit all heap data into the 32-bit address range
|
|
|
|
Store Erlang terms in 32-bit entities on the heap, expanding the
pointers to 64-bit when needed. This works because all terms are stored
on addresses in the 32-bit address range (the 32 most significant bits
of pointers to term data are always 0).
Introduce a new datatype called UWord (along with its companion SWord),
which is an integer having the exact same size as the machine word
(a void *), but might be larger than Eterm/Uint.
Store code as machine words, as the instructions are pointers to
executable code which might reside outside the 32-bit address range.
Continuation pointers are stored on the 32-bit stack and hence must
point to addresses in the low range, which means that loaded beam code
much be placed in the low 32-bit address range (but, as said earlier,
the instructions themselves are full words).
No Erlang term data can be stored on C stacks (enforced by an
earlier commit).
This version gives a prompt, but test cases still fail (and dump core).
The loader (and emulator loop) has instruction packing disabled.
The main issues has been in rewriting loader and actual virtual
machine. Subsystems (like distribution) does not work yet.
|
|
We don't want to have dates in files that are checked-in as
part of the bootstrap compiler (such as beam_opcodes.{erl,hrl})
as a new version will be created every time.
|
|
|