Age | Commit message (Collapse) | Author |
|
* jv/autoimport-binary_to_term_2:
Change binary_to_term/2 to be auto-imported
OTP-8671 jv/autoimport-binary_to_term_2
Now, binary_to_term/2 is auto-imported. This will cause a compile warning
if and only if a module has got a local function with that name.
|
|
See dwShareMode on
http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
|
|
Port locks could be prematurely destroyed.
|
|
Missing memory barriers in erts_poll() could cause the runtime system to
hang indefinitely.
|
|
This BIF was only used by the now broken SAE support.
|
|
The experimental Standalone Erlang (SAE) support based on
Joe Armstrong's work has long been broken. Remove the remaining
code and Makefile rules.
|
|
* sv/socket-error-portability:
inet_drv.c: Remove red herring
use macro to portably test for socket system call errors
OTP-8654 sv/socket-error-portability
On some combination of Montavista Linux on Cavium Octeon processors, some
socket-related system calls returned other numbers than -1 for errors. This
caused a core dump in inet_drv.c. Now the code works around this problem.
|
|
* se/spawn_drv_win_deadlock:
Fix deadlock in spawn driver on windows
OTP-8641 se/spawn_drv_win_deadlock
Windows: Closing port of program that stalled without reading all data
could deadlock scheduler thread.
|
|
* ta/extend-nif-api:
erl_nif: add make_atom_len, make_existing_atom_len and make_string_len
erl_nif: add enif_get_atom_length and enif_get_list_length
erl_nif: add enif_is_list and enif_is_tuple
OTP-8640 ta/extend-nif-api
New NIF API functions: enif_make_atom_len, enif_make_existing_atom_len,
enif_make_string_len, enif_get_atom_length, enif_get_list_length,
enif_is_list, enif_is_tuple (by Tuncer Ayaz)
|
|
Remove redundant "!defined(__WIN32__)". It is used inside
the #else branch of a "#ifdef __WIN32__", so it serves no
useful purpose except to fool unsuspecting readers.
|
|
On some combinations of Montavista Linux running on Cavium Octeon
chips, some socket-related system calls erroneously return negative
numbers other than -1 to indicate errors, but inet_drv.c specifically
compares against -1 to test for errors. The result is that beam dumps
core due to the code treating these negative numbers as success
indicators, as counts/offsets of bytes written, etc. thereby
corrupting its own internal data structures.
To fix this, introduce a portability macro to test the result of
socket system calls. The test remains unchanged on Windows but for
other platforms the macro considers all return values that are less
than zero to be errors.
Though POSIX specifies that errors from these system calls are
indicated by a return value of -1, treating all negative return values
as errors is also safe, as described in detail below. In networking
programming, treating all negative return values from system calls as
errors is very common practice -- see the examples in W. Richard
Stevens's popular and highly lauded network programming books, for
example.
For system calls that return 0 to indicate success, treating all
negative numbers as errors is safe because only 0 is specified to
indicate success. These include:
getsockname
getpeername
getsockopt
gethostname
bind
listen
connect
close
shutdown
Likewise, for system calls that return non-negative numbers to
indicate success, treating all negative numbers as errors is also
safe. These functions typically return signed integers of type
ssize_t, and they treat any parameters of type size_t that cannot fit
within the ssize_t return value, such as numbers of bytes to read or
write, as errors (specifically EINVAL). For example, in the "ERRORS"
section of the man page for writev from several varieties of Linux, it
states that EINVAL is returned when the total length of the I/O is
more than can be expressed by the ssize_t return value.
These calls include:
recv
recvfrom
recvmsg
writev
send
sendto
sendmsg
Finaly, the socket() system call is also similar to these in that it
returns a signed type (int) with all non-negative return values
indicating success, so treating all negative return values as errors
is safe.
|
|
* fm/file-operations:
Update preloaded modules
Add file:advise/4 - a wrapper to the POSIX syscall posix_fadvise
Add file:datasync/1 for syncing file contents only
sys.h: Correct the get_int64() macro
OTP-8637 fm/file-operations
The functions file:advise/4 and file:datasync/1 have been added. (Thanks to
Filipe David Manana.)
|
|
A misbehaving port program that does not read all data written to the port
may deadlock the scheduler thread when it calls port_close. The chosen solution
was to use the new function CancelIoEx if it exist (Vista) otherwise let the
spawn driver wait for a short while (10ms) and then to spawn a thread that will
wait for the port program to exit.
|
|
Add new NIF API functions
- enif_make_atom_len
- enif_make_existing_atom_len
- enif_make_string_len
These are basically the same as enif_make_atom,
enif_make_existing_atom and enif_make_string except that the
new functions require a length parameter instead of a
null-terminated C-string.
Signed-off-by: Tuncer Ayaz <[email protected]>
|
|
Add new NIF API functions
- enif_get_atom_length
- enif_get_list_length
Signed-off-by: Tuncer Ayaz <[email protected]>
|
|
Add new NIF API functions
- enif_is_list
- enif_is_tuple
Signed-off-by: Tuncer Ayaz <[email protected]>
|
|
While binary_to_term/2 was added in R13B04, it wasn't auto-imported. This
conformed to longstanding policy of not changing auto-imports between major
versions. This patch contains changes to auto-import binary_to_term/2 to
coincide with the release of R14.
|
|
* bg/compiler-cover-and-clean:
v3_life: Remove clause that cannot match in match_fail/3
v3_life tests: Cover exception handling code in v3_life:function/1
beam_type: Remove redundant clause
v3_core tests: Cover make_bool_switch_guard/5
v3_core tests: Cover handling of pattern aliases
v3_core: Remove a clause in is_simple/1 that cannot match
v3_core: Remove unused support for generating compilation errors
Remove stray support for the put_literal/2 instruction
Remove stray support for the bs_bits_to_bytes2/2 instruction
Remove the bs_bits_to_bytes/3 instruction
Cover handling of 'math' BIFs
beam_bool: Remove a clause in live_regs/1 that cannot match
beam_bool: Cover handling of bs_context_to_binary in initialized_regs/2
beam_bool: Remove a clause in initialized_regs/2 that cannot match
beam_block: Remove a clause that will never be executed
erts: Stop supporting non-literal empty tuples
compile: Remove code that is only executed on Solaris
Do not cover-analyze core_scan
core_SUITE_data: Don't ignore *.core files in this directory
OTP-8636 bg/compiler-cover-and-clean
|
|
Signed-off-by: Tuncer Ayaz <[email protected]>
|
|
Useful for informing the Operating System about the access pattern
for a file's data, so that it can adapt the caching strategy to
maximize disk IO performance.
|
|
file:datasync/1 invokes the POSIX system call "int fdatasync(int fd)".
This system call is similar to "fsync" but, unlike fsync, it does not
update the metadata associated with the file (like the access time for
example). It's used by many DBMSs (MySQL and SQLite of example) to
increase disk IO performance, as it avoids disk seeks and disk write
operations compared to fsync.
More details on it at:
http://linux.die.net/man/2/fdatasync
An example, from the MySQL source:
http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1-telco-6.1/annotate/head%3A/mysys/my_sync.c#L61
This new function just calls fsync on systems not implementing fdatasync.
|
|
The get_int64() macro has never been used (it was probably added
for completeness at the same time that put_int64() was added),
but it was not actually used and therefore it does not actually
work.
|
|
put_literal/2 was an experimental instruction added in R11 to
support literals, but before the R12 release support for literals
was implemented for all instruction, making the put_literal/2
instruction redundant. Although the beam_disasm module supports
dissambley of instructions in older releases, there is
no reason to have it support experimental instructions.
|
|
The last compiler to generate code that uses the bs_bits_to_bytes/3
instruction was the R11 compiler. Since we don't support loading
R11 *.beam files in R14, removing the remaining support for the
instruction.
|
|
Since R12B, empty tuples are literals. Thus the compiler will no
longer generate the instruction:
put_tuple 0 Destination
for creating an empty tuple. It is now time to stop supporting
that instruction in the run-time system.
While we are at it, correct a typo.
|
|
* pan/otp_8217_binary:
Add documentation for binary module
Add more tests and make some go easier on small systems
Correct Boyer More and trapping for longest_common_suffix
Add longer timetrap to testcases and add binary to app file
Add guard BIFs binary_part/2,3
Add binary:{encode,decode}_unsigned({1,2}
Add referenced_byte_size/1
Add binary:list_to_bin/1 and binary:copy/1,2
Add bin_to_list/{1,2,3}
Add binary:longest_common_prefix/longest_common_suffix
Add binary:part to erl_bif_binary.c
Move binary module bif's to erl_bif_binary.c
Count reductions for process even when not trapping
Add random compare testcase
Teach BIF's binary:match/matches interrupting/restarting
Teach binary.c the semantics to take longest instead of shortest match
Initial commit of the binary EEP
OTP-8217 Implement EEP31
The module binary from EEP31 (and EEP9) is implemented.
|
|
Correct behaviour of copy/2 witn 0 copies.
|
|
Even more tests added to cover more error cases, some tests
made easier on systems with small memories and timeouts made longer
due to timetraps on solaris daily builds.
|
|
Add testcases and clean up to get better code coverage.
|
|
Add the gc_bif's to the VM.
Add infrastructure for gc_bif's (guard bifs that can gc) with two and.
three arguments in VM (loader and VM).
Add compiler support for gc_bif with three arguments.
Add compiler (and interpreter) support for new guard BIFs.
Add testcases for new guard BIFs in compiler and emulator.
|
|
Add testcases for encode/decode_unsigned/1,2.
|
|
Add testcases for referenced_byte_size/1.
Add failure tests for referenced_byte_size.
|
|
Add testcases for binary:list_to_bin/1 and binary:copy/1,2.
Add reference implementation of list_to_bin/1.
|
|
Add testcases for bin_to_list.
Teach binref.erl bin_to_list.
|
|
Add allcoator parameter to erts_get_aligned_binary_bytes_extra.
Add testcases for the functions above.
Add reference implementation for the functions above.
|
|
Change name of the 'scope' option for binary:match/matches.
Add split and replace to binary.erl.
Cleanup comments etc in binary.erl and atom.names
Add testcases for part, split, replace and scopes.
|
|
|
|
Set loop factors to 10.
Teach erts_debug:set_internal_state to limit loop factor for binary.
Add random tests for matches and match with multiple searchstrings.
|
|
Fix heap-hole when trapping in binary.c
Fix boyer more segfaulting when searchstring is longer than haystack
|
|
Add Boyer More implementation of binary:matches.
Cleanup and removed unused code.
|
|
Add testcase embryos and reference implementation.
Change name of compile function according to EEP31.
|
|
|
|
erts_poll_info_kp() [defined in erts/emulator/sys/common/erl_poll.c
via some name-mangling trickery] contains a code path that can end
up in an infinite loop, causing a livelock. There is a block of code
inside #if ERTS_POLL_USE_UPDATE_REQUESTS_QUEUE that is supposed to
iterate over a linked list of ErtsPollSetUpdateRequestsBlocks and
update two variables based on the sizes of these blocks. The bug is
that the loop forgets to advance the list pointer to the next element,
so if the loop is entered at all (the initial list pointer is non-NULL),
the thread falls into an infinite loop.
This patch, against R13B03 but applies fine to today's git, fixes the
bug by adding a statement to advance the list pointer in the loop.
All other loops over this list appear to be correct.
Thanks to Chetan Ahuja for the original report of a livelock problem
in erts_poll_info_kp().
|
|
* bg/opt-receive:
Test that gen_server:call/2,3 are fast even with a huge message queue
erts: Add tests for the receive optimization
Update primary bootstrap
erts: Implement recv_mark/1 and recv_set/1 for real
compiler tests: Cover the error handling code in beam_receive
compiler test: Test optimization of receive statements
Optimize selective receives in the presence of a large message queue
Introduce the new recv_mark/1 and recv_mark/1 instructions
Compile tests that communicate with R12 nodes with the r12 option
Move p_run/2 to test_lib
gen: Inline wait_resp_mon/2 to help the compiler optimize
OTP-8623 bg/opt-receive
reveive statements that can only read out a newly created reference are now
specially optimized so that it will execute in constant time regardless of
the number of messages in the receive queue for the process. That
optimization will benefit calls to gen_server:call(). (See gen:do_call/4
for an example of a receive statement that will be optimized.)
|
|
|
|
The recv_mark/1 instruction will both save the current
position in the message queue and a mark (the address of the
loop_rec/2 instruction just following the recv_set/1
instruction). The recv_mark/1 instruction will only
use the saved position if the mark is correct.
The reason for saving and verifying the mark is that
the compiler does not need to guarantee that no other
receive instruction can be executed in between the
recv_mark/1 and recv_set/1 instructions (the mark will
be cleared by the remove_message/0 instruction when a message
is removed from the message queue). That means that arbitrary
function calls in between those instruction can be allowed.
|
|
Make the recv_mark/1 and recv_mark/1 instructions known to the
compiler and run-time system. For the moment, make the loader ignore
any occurrences of those instructions in BEAM files.
Also update hipe_beam_to_icode to ignore those instructions.
|
|
R12 nodes cannot load code that use the optimized receive that
we are about to implement.
|
|
|
|
The erlang:open_port spawn and spawn_executable directives can include
an {env, Env} directive to set up environment variables for the
spawned process. A bug in ert/emulator/sys/unix/sys.c prevented
applications from using {env, Env} to set an environment variable
whose value ended with a '=' (equal sign) character; the code mistook
the trailing equal sign as an indication that an environment variable
was to be cleared from the environment of the spawned process.
For example, passing an {env, Env} of
{env, [{"foo", "bar="}]}
would result in the code in sys.c seeing a string of the form
"foo=bar="
The code would see the final '=' character and assume the directive
wanted to clear a variable named "foo=bar" from the environment of the
spawned process, rather than seeing it as a directive to set the
environment variable "foo" to the value "bar=".
Fix this problem and add a new regression test for it to the port test
suite.
|