aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
AgeCommit message (Collapse)Author
2010-08-10Merge branch 'rickard/ethread-rewrite/OTP-8544' into devRickard Green
* rickard/ethread-rewrite/OTP-8544: Rewrite ethread library
2010-08-10Rewrite ethread libraryRickard Green
Large parts of the ethread library have been rewritten. The ethread library is an Erlang runtime system internal, portable thread library used by the runtime system itself. Most notable improvement is a reader optimized rwlock implementation which dramatically improve the performance of read-lock/read-unlock operations on multi processor systems by avoiding ping-ponging of the rwlock cache lines. The reader optimized rwlock implementation is used by miscellaneous rwlocks in the runtime system that are known to be read-locked frequently, and can be enabled on ETS tables by passing the `{read_concurrency, true}' option upon table creation. See the documentation of `ets:new/2' for more information. The ethread library can now also use the libatomic_ops library for atomic memory accesses. This makes it possible for the Erlang runtime system to utilize optimized atomic operations on more platforms than before. Use the `--with-libatomic_ops=PATH' configure command line argument when specifying where the libatomic_ops installation is located. The libatomic_ops library can be downloaded from: http://www.hpl.hp.com/research/linux/atomic_ops/ The changed API of the ethread library has also caused modifications in the Erlang runtime system. Preparations for the to come "delayed deallocation" feature has also been done since it depends on the ethread library. Note: When building for x86, the ethread library will now use instructions that first appeared on the pentium 4 processor. If you want the runtime system to be compatible with older processors (back to 486) you need to pass the `--enable-ethread-pre-pentium4-compatibility' configure command line argument when configuring the system.
2010-07-29Merge branch 'cg/small-typos' into devBjörn Gustavsson
2010-07-29Merge branch 'ta/doc-fixes' into devBjörn Gustavsson
2010-07-26Remove extra leading spaces in filename docTuncer Ayaz
2010-07-26Fix minor typos and errors in documentationCristian Greco
2010-07-20Merge branch 'sverker/one_offheap_list/OTP-8737' into devSverker Eriksson
* sverker/one_offheap_list/OTP-8737: One off-heap list, to eliminate two words per ETS object.
2010-07-20One off-heap list, to eliminate two words per ETS object.Sverker Eriksson
Merging the three off-heap lists (binaries, funs and externals) into one list. This reduces memory consumption by two words (pointers) per ETS object.
2010-07-20Merge branch 'sverker/ets_select_hang/OTP-8732' into devSverker Eriksson
* sverker/ets_select_hang/OTP-8732: Fix ets:select hanging on ordered_set with empty list as key.
2010-07-07Fix ets:select hanging on ordered_set with empty list as key.Sverker Eriksson
erl_db_tree.c incorrectly used NIL (empty list) as "lastkey" to mark start of the iteration. A real NIL key could then cause a select or match iteration to be restarted over and over again if the last key before a trap happended to be NIL. Changed NIL to THE_NON_VALUE. Should be ok as the initial key value can never be put into any continuation tuple.
2010-07-07Merge branch 'pg/beam_lib_cmp_2_return_type_specification' into devRaimo Niskanen
* pg/beam_lib_cmp_2_return_type_specification: Fix beam_lib:cmp/2 return type specification
2010-07-07Merge branch 'cf/timer_tc' into devRaimo Niskanen
* cf/timer_tc: Add timer:tc/2 to measure the elapsed time of anonymous functions Conflicts: lib/stdlib/doc/src/timer.xml
2010-07-07Merge branch 'ks/cleanups' into devRaimo Niskanen
* ks/cleanups: compiler: Fix incorrect types and specs escript: Add more types to records debugger: Clean up as suggested by tidier docbuilder: Clean up as suggested by tidier Conflicts: lib/debugger/src/dbg_iload.erl lib/debugger/src/dbg_ui_trace_win.erl
2010-07-06Documentation clarifications for now/0 and timer:tc/3Raimo Niskanen
2010-06-18Update Erlang system version to R14BBjörn-Egil Dahlberg
2010-06-17Fix beam_lib:cmp/2 return type specificationPaul Guyot
Specify that beam_lib:cmp/2 can return {error, beam_lib, different_chunks} if a chunk is only present in one of the beams.
2010-06-11Update deprecations for sslBjörn Gustavsson
2010-06-11Update release notesBjörn Gustavsson
2010-06-09Merge branch 'pan/otp_8683_compiler_warnings' into HEADErlang/OTP
* pan/otp_8683_compiler_warnings: Remove (harmless) warning regarding auto-imported BIF max/2 Update primary bootstrap Correct warnings and errors for auto-imported bif clashes Conflicts: bootstrap/lib/stdlib/ebin/erl_lint.beam
2010-06-09Correct warnings and errors for auto-imported bif clashesPatrik Nyblom
warn_unused_import works correctly (does not give warnings when overridden). Local call in guard gives its own error pointing out the local/imported function. Use of the phrase "overridden auto-imported bif" instead of "redefined auto-imported bif" in textual error messages.
2010-06-07Remove tid() from the predefined builtin types.Kostis Sagonas
Change erl_lint not to recognize this type as builtin and add a new erl_lint.beam version in bootstrap. Add an -opaque type declaration for this type in ets.erl and also declare this as an exported type. Use this type in file debugger/src/dbg_iload.erl in a spec. While at it, also clean up this later file a bit.
2010-06-07escript: Add more types to recordsKostis Sagonas
While at it, also do some cleanups.
2010-06-07Fix confusing dialyzer warnings for is_record/2 with illegal recordsBjörn Gustavsson
In commit 1858cb81391d2bce29b4b7620574ca60128cebf7, erl_expand_records started to optimize is_record/2 in guards by replacing it with pattern matching (if possible). Unfortunately, dialyzer will no longer see the code before the optimization, so any warnings produced in code such as: case ExprNotProducingRecord#rec{} of X when is_record(X, rec, N) -> ... will refer to the optimized code and not the source code, which is confusing for the user. Introduce the no_is_record_optimization option for turning off the optimization and use it in dialyzer. Reported-by: Kostis Sagonas
2010-06-04Merge branch 'ks/dialyzer' into devErlang/OTP
* ks/dialyzer: dialyzer: Build the PLT even if there are unresolved remote types proplists: Export the type property() erl_lint: Issue warnings for undefined exported types Minor fix in a print message Add handling of unknown types Add declaration for exported types Add types and specs; performed some cleanups also erl_scan: Add declarations for exported types stdlib: Add declarations for exported types hipe: Add declarations for exported types compiler: Add declarations for exported types syntax_tools: Add declarations for exported types kernel: Add declaration for exported types Support -export_type() in dialyzer and erl_types Add infrastructure for the -export_type() attribute OTP-8678 ks/dialyzer
2010-06-03proplists: Export the type property()Björn Gustavsson
2010-06-03erl_lint: Issue warnings for undefined exported typesKostis Sagonas
2010-06-03Add declaration for exported typesKostis Sagonas
2010-06-03Add types and specs; performed some cleanups alsoKostis Sagonas
2010-06-03erl_scan: Add declarations for exported typesKostis Sagonas
While at it, added some types to a record and did some cleanups suggested by tidier.
2010-06-03stdlib: Add declarations for exported typesKostis Sagonas
2010-06-03Add infrastructure for the -export_type() attributeKostis Sagonas
erl_lint has been updated so that it takes the new -export_type() attribute into account. This means: - do not complain about types which are defined but nowhere used in the module but exported to other modules - check that all types which are exported are indeed defined in the module - warn when there are multiple occurrences of exported types. In doing this change, I've also taken the liberty to introduce many types and specs for functions of this module and to do small cleanups here and there.
2010-06-03OTP-8665 epp bugHans Bolinder
The Erlang code preprocessor (epp) did not correctly handle premature end-of-input when defining macros. This bug, introduced in STDLIB 1.16, has been fixed.
2010-06-03Merge branch 'pan/otp_8579_autoimport_override' into devErlang/OTP
* origin/pan/otp_8579_autoimport_override: Update preloaded modules Update primary bootstrap Remove outcommented code from erl_lint Make port_command/3 auto-imported Remove (harmless) warnings about min/max in core applications Autoimport min/2 and max/2 Improve coverage of erl_int in testcases Change warning to error for nowarn_bif_clash compiler directive Add -compile({no_auto_import,[F/A]}) doc to compiler.xml Add some testcases to compiler to verify that overriding really happens Return nowarn_bif_clash functionality but with warning Teach erl_lint to better override BIFs with local functions and imports Teach compiler to override autoimport with import First prototype for local functions overriding autoimported OTP-8579 Local functions should override auto-imported Local and imported functions now override the autoimported BIFs when the names clash. The pre R14 behaviour was that autoimported BIFs would override local functions. To avoid that old programs change behaviour, the following will generate an error: Doing a call without explicit module name to a local function having a name clashing with the name of an autoimported BIF that was present (and autoimported) before OTP R14A Explicitly importing a function having a name clashing with the name of an autoimported BIF that was present (and autoimported) before OTP R14A Using any form of the old compiler directive nowarn_bif_clash If the BIF was added or autoimported in OTP R14A or later, overriding it with an import or a local function will only result in a warning, To resolve clashes, you can either use the explicit module name erlang to call the BIF, or you can remove the autoimport of that specific BIF by using the new compiler directive -compile({no_auto_import,[F/A]})., which makes all calls to the local or imported function without explicit module name pass without warnings or errors. The change makes it possible to add autoimported BIFs without breaking or silently changing old code in the future. However some current code ingeniously utilizing the old behaviour or the nowarn_bif_clash compiler directive, might need changing to be accepted by the compiler.
2010-06-03Merge branch 'pan/otp_8577_re_pattern_doc' into devErlang/OTP
* pan/otp_8577_re_pattern_doc: Add documentation of what part of a re mp() can be used for guard tests OTP-8577 Document re_pattern properties Some properties of a compiled re pattern are defined to allow for guard tests.
2010-06-02Remove outcommented code from erl_lintPatrik Nyblom
2010-06-02Make port_command/3 auto-importedPatrik Nyblom
2010-06-02Remove (harmless) warnings about min/max in core applicationsPatrik Nyblom
2010-06-02Autoimport min/2 and max/2Patrik Nyblom
2010-06-02Improve coverage of erl_int in testcasesPatrik Nyblom
2010-06-02Change warning to error for nowarn_bif_clash compiler directivePatrik Nyblom
2010-06-02Return nowarn_bif_clash functionality but with warningPatrik Nyblom
Wrote and changed some tests in stdlib:erl_lint_SUITE nowarn_bif_clash is obsoleted but will remove warnings and errors about bif clashes. The recommended way is to use no_auto_import directives instead. Hopefully erlang.erl is the only user in the world of nowarn_bif_clash.
2010-06-02Teach erl_lint to better override BIFs with local functions and importsPatrik Nyblom
Added only a few testcases in compiler:error_SUITE and guard_SUITE The new behaviour of warnings and errors when overriding autoimported BIF's: Bifs that were autoimported before R14 are dangerous because old code using them and overriding them in exports can start behaving differently. For newly added autoimports this can't happen to the new code that wants to (or dont want to) use them, why only warnings are added for the BIFs autoimported after the compilator change. Errors are issued only for code that could have worked in one way in R13 and now will behave in a different way. If overriding autoimport with local function: - if explicit -compile directive supresses autoimport -> no message else - if called from inside module - if pre R14 autoimported bif -> error else -> warning else -> no message If overriding autoimport with import directive - if explicit -compile directive supresses autoimport -> no message else (regardless of actual usage) - if pre R14 autoimported bif -> error else -> warning Calls of local functions or imports overriding autoimported functions (either post R14 or by using explicit -compile supressions of autoimport) always goes to the local function or the imported. The compileation errors are added to not let code like this silently and disastrously change its semantic (probably to an infinite loop) between R13 and R14: ---------- -module(m). -export([length/1]). length(X) -> ... Y = length(Z), .... ---------- The user has to select if he/she wants to call length in 'erlang' explicitly or if the overriding semantics is desired, in which case the -compile directive has to be used. -compile({no_auto_import,[F/A]}). Is added to allow to override the autoimports so that code gets unanbiguous. The directive will remove an autoimport even if there is no local function or import overriding, because any other behaviour would be inconsistent and confusing. record_info and module_info can never be overridden.
2010-06-02Teach compiler to override autoimport with importPatrik Nyblom
2010-06-02First prototype for local functions overriding autoimportedPatrik Nyblom
Import directives still not sorted out!
2010-06-02OTP-8664 Erlang parser augmented with operators for integer typesHans Bolinder
Expressions evaluating to integers can now be used in types and function specifications where hitherto only integers were allowed ("Erlang_Integer").
2010-06-02Merge branch 'jv/autoimport-binary_to_term_2' into devErlang/OTP
* 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.
2010-06-02Evaluate element/2 at compile-time using type informationBjörn Gustavsson
The erl_expand_records compiler pass translates the following code: h(X) when X#r1.a =:= 1 -> ok. to (essentially): h({r1,V1,V2}=X) when element(2, X) =:= 1 -> ok. Since the guard can only be executed when the pattern matching has succeeded, we know that the second element in the tuple X must have been bound to V2. Thus we can eliminate the call to element/2 like this: h({r1,V1,V2}=X) when V1 =:= 1 -> ok.
2010-06-02erl_expand_records: Replace is_record() with matchingBjörn Gustavsson
The compiler currently generates better code for: f(#r1{}) -> r1; f(#r2{}) -> r2; f(#r3{}) -> r3. than for: g(X) when is_record(X, r1) -> r1; g(X) when is_record(X, r2) -> r2; g(X) when is_record(X, r3) -> r3. The compiler generates good code for pattern matching (as in f/1), but in g/1 there are no patterns to match, and the clause to be executed must be chosen by evaluating the guards sequentially until one succeeds. Make the compiler generate better code by replacing calls to is_record() with matching in the function head (basically, g/1 will automatically be rewritten to do pattern matching as in f/1). Note that this rewrite will also benefit code such as: h(X) when X#r1.a =:= 1 -> ok. because it would have been rewritten to: h(X) when (is_record(X, r1, 3) orelse fail) and (element(2, X) =:= 1) -> ok. which in turn will be rewritten to: h({r1,_,_}=X) when (true orelse fail) and (element(2, X) =:= 1) -> ok. (That will be further simplified in later compiler passes.)
2010-06-02Add documentation of what part of a re mp() can be used for guard testsPatrik Nyblom
2010-05-31OTP-8657 New Erlang scanner tokens: '..' and '...'Hans Bolinder
The Erlang scanner has been augmented with two new tokens: .. and ....