diff options
Diffstat (limited to 'erts')
-rw-r--r-- | erts/configure.in | 15 | ||||
-rw-r--r-- | erts/doc/src/Makefile | 11 | ||||
-rw-r--r-- | erts/doc/src/erl_nif.xml | 28 | ||||
-rw-r--r-- | erts/doc/src/erlang.xml | 2 | ||||
-rw-r--r-- | erts/doc/src/notes.xml | 2 | ||||
-rw-r--r-- | erts/emulator/beam/beam_emu.c | 14 | ||||
-rw-r--r-- | erts/emulator/beam/beam_load.c | 46 | ||||
-rw-r--r-- | erts/emulator/beam/break.c | 2 | ||||
-rw-r--r-- | erts/emulator/beam/erl_bif_port.c | 26 | ||||
-rw-r--r-- | erts/emulator/beam/ops.tab | 19 | ||||
-rw-r--r-- | erts/emulator/test/Makefile | 12 | ||||
-rw-r--r-- | erts/emulator/test/beam_SUITE.erl | 35 | ||||
-rw-r--r-- | erts/emulator/test/binary_SUITE.erl | 32 | ||||
-rw-r--r-- | erts/emulator/test/decode_packet_SUITE.erl | 35 | ||||
-rw-r--r-- | erts/emulator/test/fun_r12_SUITE.erl (renamed from erts/emulator/test/fun_r11_SUITE.erl) | 33 | ||||
-rw-r--r-- | erts/lib_src/common/erl_misc_utils.c | 14 |
16 files changed, 136 insertions, 190 deletions
diff --git a/erts/configure.in b/erts/configure.in index 6823133936..e5202b75cb 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -821,13 +821,14 @@ fi AC_CHECK_PROGS(XSLTPROC, xsltproc) if test -z "$XSLTPROC"; then echo "xsltproc" >> doc/CONF_INFO - AC_MSG_WARN([No 'xsltproc' command found: the documentation can not be built]) + AC_MSG_WARN([No 'xsltproc' command found: the documentation cannot be built]) fi AC_CHECK_PROGS(FOP, fop) if test -z "$FOP"; then + FOP="$ERL_TOP/make/fakefop" echo "fop" >> doc/CONF_INFO - AC_MSG_WARN([No 'fop' command found: the documentation can not be built]) + AC_MSG_WARN([No 'fop' command found: going to generate placeholder PDF files]) fi dnl @@ -1693,7 +1694,7 @@ AC_CHECK_FUNCS([getnameinfo getipnodebyname getipnodebyaddr gethostbyname2]) AC_CHECK_FUNCS([ieee_handler fpsetmask finite isnan isinf res_gethostbyname dlopen \ pread pwrite writev memmove strerror strerror_r strncasecmp \ - gethrtime localtime_r gmtime_r mremap memcpy mallopt \ + gethrtime localtime_r gmtime_r mmap mremap memcpy mallopt \ sbrk _sbrk __sbrk brk _brk __brk \ flockfile fstat strlcpy strlcat setsid posix2time setlocale nl_langinfo poll]) if test "X$host" = "Xwin32"; then @@ -1725,7 +1726,6 @@ if test $disable_vfork = true; then fi AC_FUNC_VPRINTF -AC_FUNC_MMAP dnl The AC_DEFINEs are necessary for autoheader to work. :-( dnl for gzio @@ -3729,13 +3729,6 @@ dnl so it is - be adoptable fi ;; *) - if test "$cross_compiling" = "yes"; then - case "$with_ssl" in - "$erl_xcomp_sysroot"*) ;; - *) AC_MSG_ERROR([Invalid path to option --with-ssl=PATH (not a subdirectory to cross system root)]);; - esac - fi - # Option given with PATH to package if test ! -d "$with_ssl" ; then AC_MSG_ERROR(Invalid path to option --with-ssl=PATH) diff --git a/erts/doc/src/Makefile b/erts/doc/src/Makefile index 3dfefa2001..6578923fe1 100644 --- a/erts/doc/src/Makefile +++ b/erts/doc/src/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1997-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # include $(ERL_TOP)/make/target.mk @@ -45,6 +45,7 @@ XML_REF1_FILES = epmd.xml \ XML_REF3_FILES = \ driver_entry.xml \ + erl_nif.xml \ erl_set_memory_block.xml \ erl_driver.xml \ erl_prim_loader.xml \ diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index 0dd46a951a..18b340591c 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -161,8 +161,8 @@ ok <seealso marker="#enif_release_binary">enif_release_binary</seealso> or made read-only by transferring it to an Erlang term with <seealso marker="#enif_make_binary">enif_make_binary</seealso>. - But it does not have do happen in the same NIF call. Read-only binaries - does not have to be released.</p> + But it does not have to happen in the same NIF call. Read-only binaries + do not have to be released.</p> <p>Binaries are sequences of whole bytes. Bitstrings with an arbitrary bit length have no support yet.</p> </item> @@ -199,7 +199,7 @@ ok library with the old destructor function can be safely unloaded. Existing resource objects, of a module that is upgraded, must either be deleted or taken over by the new NIF library. The unloading of a library will be - postponed as long as it exists resource objects with a destructor + postponed as long as there exist resource objects with a destructor function in the library. </p> <p>Here is a template example of how to create and return a resource object.</p> @@ -262,7 +262,7 @@ ok <item><p><c>load</c> is called when the NIF library is loaded and there is no previously loaded library for this module.</p> <p><c>*priv_data</c> can be set to point to some private data - that the library needs in able to keep a state between NIF + that the library needs in order to keep a state between NIF calls. <c>enif_priv_data()</c> will return this pointer. <c>*priv_data</c> will be initialized to NULL when <c>load</c> is called.</p> @@ -325,8 +325,8 @@ ok which a NIF call is made. This pointer should not be dereferenced in any way, but only passed on to API functions. An <c>ErlNifEnv</c> pointer is only valid until - the function, where is what supplied as argument, - returns. There is thus useless and dangerous to store <c>ErlNifEnv</c> + the function, where it was supplied as argument, + returns. It is thus useless and dangerous to store <c>ErlNifEnv</c> pointers in between NIF calls.</p> </item> <tag><marker id="ErlNifFunc"/>ErlNifFunc</tag> @@ -407,7 +407,7 @@ typedef enum { </func> <func><name><ret>int</ret><nametext>enif_alloc_binary(ErlNifEnv* env, unsigned size, ErlNifBinary* bin)</nametext></name> <fsummary>Create a new binary.</fsummary> - <desc><p>Allocate a new binary of size of <c>size</c> + <desc><p>Allocate a new binary of size <c>size</c> bytes. Initialize the structure pointed to by <c>bin</c> to refer to the allocated binary. The binary must either be released by <seealso marker="#enif_release_binary">enif_release_binary()</seealso> @@ -612,8 +612,8 @@ typedef enum { call and then as released.</p></desc> </func> <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_double(ErlNifEnv* env, double d)</nametext></name> - <fsummary>Create an floating-point term</fsummary> - <desc><p>Create an floating-point term from a <c>double</c>.</p></desc> + <fsummary>Create a floating-point term</fsummary> + <desc><p>Create a floating-point term from a <c>double</c>.</p></desc> </func> <func><name><ret>int</ret><nametext>enif_make_existing_atom(ErlNifEnv* env, const char* name, ERL_NIF_TERM* atom)</nametext></name> <fsummary>Create an existing atom term</fsummary> @@ -644,7 +644,7 @@ typedef enum { <fsummary>Create a list term.</fsummary> <desc><p>Create an ordinary list term with length indicated by the function name. Prefer these functions (macros) over the variadic - <c>enif_make_list</c> to get compile time error if the number of + <c>enif_make_list</c> to get a compile time error if the number of arguments does not match.</p></desc> </func> <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list_cell(ErlNifEnv* env, ERL_NIF_TERM head, ERL_NIF_TERM tail)</nametext></name> @@ -670,7 +670,7 @@ typedef enum { obtained by <seealso marker="#enif_alloc_resource">enif_alloc_resource</seealso>. No ownership transfer is done, the resource object still needs to be released by <seealso marker="#enif_release_resource">enif_release_resource</seealso>.</p> - <p>Note that the only defined behaviour when using of a resource term in + <p>Note that the only defined behaviour of using a resource term in an Erlang program is to store it and send it between processes on the same node. Other operations such as matching or <c>term_to_binary</c> will have unpredictable (but harmless) results.</p></desc> @@ -707,7 +707,7 @@ typedef enum { <fsummary>Create a tuple term.</fsummary> <desc><p>Create a tuple term with length indicated by the function name. Prefer these functions (macros) over the variadic - <c>enif_make_tuple</c> to get compile time error if the number of + <c>enif_make_tuple</c> to get a compile time error if the number of arguments does not match.</p></desc> </func> <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple_from_array(ErlNifEnv* env, const ERL_NIF_TERM arr[], unsigned cnt)</nametext></name> @@ -762,7 +762,7 @@ typedef enum { The supplied destructor <c>dtor</c> will be called both for existing instances as well as new instances not yet created by the calling NIF library.</item> </taglist> - <p>The two flag values can be combined with bitwise-or. To avoid unintentionally + <p>The two flag values can be combined with bitwise-or. To avoid unintentional name clashes a good practice is to include the module name as part of the type <c>name</c>. The <c>dtor</c> may be <c>NULL</c> in case no destructor is needed.</p> @@ -795,7 +795,7 @@ typedef enum { </func> <func><name><ret>void</ret><nametext>enif_release_resource(ErlNifEnv* env, void* obj)</nametext></name> <fsummary>Release a resource object.</fsummary> - <desc><p>Release a resource objects obtained from <c>enif_alloc_resource</c>. + <desc><p>Release a resource object obtained from <c>enif_alloc_resource</c>. The object may still be alive if it is referred to by Erlang terms. Each call to <c>enif_release_resource</c> must correspond to a previous call to <c>enif_alloc_resource</c>. References made by <c>enif_make_resource</c> can only be released by the garbage collector.</p></desc> diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index c95a7005ec..cd9bb85f5c 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -5105,7 +5105,7 @@ true</pre> </p> <p><em>NOTE:</em> If other programs on the system have bound to processors, e.g. another Erlang runtime system, you - may loose performance when binding schedulers. Therefore, + may lose performance when binding schedulers. Therefore, schedulers are by default not bound.</p> <p>Schedulers can be bound in different ways. The <c>How</c> argument determines how schedulers are bound. <c>How</c> can diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml index c11509131c..a4867adf22 100644 --- a/erts/doc/src/notes.xml +++ b/erts/doc/src/notes.xml @@ -109,7 +109,7 @@ <item> <p>A number of bugs concerning re and unicode are corrected:</p> - <p>re:compile no longer looses unicode option, which also + <p>re:compile no longer loses unicode option, which also fixes bug in re:split.</p> <p>re:replace now handles unicode charlist replacement argument</p> diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index 834cc8df61..6de423ecf8 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -1414,20 +1414,6 @@ void process_main(void) NextPF(2, next); } - OpCase(put_string_IId): - { - unsigned char* s; - int len; - Eterm result; - - len = Arg(0); /* Length. */ - result = NIL; - for (s = (unsigned char *) Arg(1); len > 0; s--, len--) { - PutList(make_small(*s), result, result, StoreSimpleDest); - } - StoreBifResult(2, result); - } - /* * Send is almost a standard call-BIF with two arguments, except for: * 1) It cannot be traced. diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index bbfeac5397..5e4375fc96 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -277,7 +277,6 @@ typedef struct { BeamInstr* code; /* Loaded code. */ int ci; /* Current index into loaded code. */ Label* labels; - BeamInstr put_strings; /* Linked list of put_string instructions. */ BeamInstr new_bs_put_strings; /* Linked list of i_new_bs_put_string instructions. */ StringPatch* string_patches; /* Linked list of position into string table to patch. */ BeamInstr catches; /* Linked list of catch_yf instructions. */ @@ -1388,7 +1387,6 @@ read_code_header(LoaderState* stp) stp->code[MI_COMPILE_SIZE_ON_HEAP] = 0; stp->code[MI_NUM_BREAKPOINTS] = 0; - stp->put_strings = 0; stp->new_bs_put_strings = 0; stp->catches = 0; return 1; @@ -2130,34 +2128,6 @@ load_code(LoaderState* stp) /* Remember offset for the on_load function. */ stp->on_load = ci; break; - case op_put_string_IId: - { - /* - * At entry: - * - * code[ci-4] &&lb_put_string_IId - * code[ci-3] length of string - * code[ci-2] offset into string table - * code[ci-1] destination register - * - * Since we don't know the address of the string table yet, - * just check the offset and length for validity, and use - * the instruction field as a link field to link all put_string - * instructions into a single linked list. At exit: - * - * code[ci-4] pointer to next put_string instruction (or 0 - * if this is the last) - */ - Uint offset = code[ci-2]; - Uint len = code[ci-3]; - unsigned strtab_size = stp->chunks[STR_CHUNK].size; - if (offset > strtab_size || offset + len > strtab_size) { - LoadError2(stp, "invalid string reference %d, size %d", offset, len); - } - code[ci-4] = stp->put_strings; - stp->put_strings = ci - 4; - } - break; case op_bs_put_string_II: { /* @@ -3593,22 +3563,6 @@ freeze_code(LoaderState* stp) } CHKBLK(ERTS_ALC_T_CODE,code); - - /* - * Go through all put_strings instructions, restore the pointer to - * the instruction and convert string offsets to pointers (to the - * LAST character). - */ - - index = stp->put_strings; - while (index != 0) { - Uint next = code[index]; - code[index] = BeamOpCode(op_put_string_IId); - code[index+2] = (BeamInstr) (str_table + code[index+2] + code[index+1] - 1); - index = next; - } - CHKBLK(ERTS_ALC_T_CODE,code); - /* * Go through all i_new_bs_put_strings instructions, restore the pointer to * the instruction and convert string offsets to pointers (to the diff --git a/erts/emulator/beam/break.c b/erts/emulator/beam/break.c index d93c031db2..dbe864f941 100644 --- a/erts/emulator/beam/break.c +++ b/erts/emulator/beam/break.c @@ -327,7 +327,7 @@ print_process_info(int to, void *to_arg, Process *p) (unsigned)(OLD_HEND(p) - OLD_HEAP(p)) ); erts_print(to, to_arg, "Heap unused: %bpu\n", (p->hend - p->htop)); erts_print(to, to_arg, "OldHeap unused: %bpu\n", - (OLD_HEAP(p) == NULL) ? 0 : (OLD_HEND(p) - OLD_HEAP(p)) ); + (OLD_HEAP(p) == NULL) ? 0 : (OLD_HEND(p) - OLD_HTOP(p)) ); if (garbing) { print_garb_info(to, to_arg, p); diff --git a/erts/emulator/beam/erl_bif_port.c b/erts/emulator/beam/erl_bif_port.c index 0389177fbe..2ba9dc00b7 100644 --- a/erts/emulator/beam/erl_bif_port.c +++ b/erts/emulator/beam/erl_bif_port.c @@ -1079,27 +1079,33 @@ struct packet_callback_args Eterm res; /* Out */ int string_as_bin; /* return strings as binaries (http_bin): */ byte* aligned_ptr; + Uint bin_sz; Eterm orig; Uint bin_offs; byte bin_bitoffs; }; +#define in_area(ptr,start,nbytes) \ + ((unsigned long)((char*)(ptr) - (char*)(start)) < (nbytes)) + static Eterm http_bld_string(struct packet_callback_args* pca, Uint **hpp, Uint *szp, const char *str, Sint len) { Eterm res = THE_NON_VALUE; Uint size; + int make_subbin; if (pca->string_as_bin) { size = heap_bin_size(len); - + make_subbin = (size > ERL_SUB_BIN_SIZE + && in_area(str, pca->aligned_ptr, pca->bin_sz)); if (szp) { - *szp += (size > ERL_SUB_BIN_SIZE) ? ERL_SUB_BIN_SIZE : size; + *szp += make_subbin ? ERL_SUB_BIN_SIZE : size; } if (hpp) { res = make_binary(*hpp); - if (size > ERL_SUB_BIN_SIZE) { + if (make_subbin) { ErlSubBin* bin = (ErlSubBin*) *hpp; bin->thing_word = HEADER_SUB_BIN; bin->size = len; @@ -1330,7 +1336,7 @@ BIF_RETTYPE decode_packet_3(BIF_ALIST_3) int packet_sz; /*-------Binaries involved: ------------------*/ byte* bin_ptr; /*| orig: original binary */ byte bin_bitsz; /*| bin: BIF_ARG_2, may be sub-binary of orig */ - Uint bin_sz; /*| packet: prefix of bin */ + /*| packet: prefix of bin */ char* body_ptr; /*| body: part of packet to return */ int body_sz; /*| rest: bin without packet */ struct packet_callback_args pca; @@ -1391,18 +1397,18 @@ BIF_RETTYPE decode_packet_3(BIF_ALIST_3) } - bin_sz = binary_size(BIF_ARG_2); + pca.bin_sz = binary_size(BIF_ARG_2); ERTS_GET_BINARY_BYTES(BIF_ARG_2, bin_ptr, pca.bin_bitoffs, bin_bitsz); if (pca.bin_bitoffs != 0) { - pca.aligned_ptr = erts_alloc(ERTS_ALC_T_TMP, bin_sz); - erts_copy_bits(bin_ptr, pca.bin_bitoffs, 1, pca.aligned_ptr, 0, 1, bin_sz*8); + pca.aligned_ptr = erts_alloc(ERTS_ALC_T_TMP, pca.bin_sz); + erts_copy_bits(bin_ptr, pca.bin_bitoffs, 1, pca.aligned_ptr, 0, 1, pca.bin_sz*8); } else { pca.aligned_ptr = bin_ptr; } - packet_sz = packet_get_length(type, (char*)pca.aligned_ptr, bin_sz, + packet_sz = packet_get_length(type, (char*)pca.aligned_ptr, pca.bin_sz, max_plen, trunc_len, &http_state); - if (!(packet_sz > 0 && packet_sz <= bin_sz)) { + if (!(packet_sz > 0 && packet_sz <= pca.bin_sz)) { if (packet_sz < 0) { goto error; } @@ -1458,7 +1464,7 @@ error: rest = (ErlSubBin *) hp; rest->thing_word = HEADER_SUB_BIN; - rest->size = bin_sz - packet_sz; + rest->size = pca.bin_sz - packet_sz; rest->offs = pca.bin_offs + packet_sz; rest->orig = pca.orig; rest->bitoffs = pca.bin_bitoffs; diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab index ce1df74f03..9e8ac74f40 100644 --- a/erts/emulator/beam/ops.tab +++ b/erts/emulator/beam/ops.tab @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1997-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -66,7 +66,6 @@ func_info M=a a==am_module_info A=u==1 | label L | move n r => too_old_compiler bif1 Fail u$func:erlang:is_constant/1 Src Dst => too_old_compiler - # # All the other instructions. # @@ -115,12 +114,6 @@ init Y1 | init Y2 => init2 Y1 Y2 %macro: init2 Init2 -pack %macro: init3 Init3 -pack -# -# Warning: The put_string instruction is specially treated in the loader. -# Don't change the instruction format unless you change the loader too. -# -put_string I I d - # Selecting values select_val S=q Fail=f Size=u Rest=* => const_select_val(S, Fail, Size, Rest) @@ -1311,7 +1304,7 @@ fmul p FR1 FR2 FR3 => i_fmul FR1 FR2 FR3 fdiv p FR1 FR2 FR3 => i_fdiv FR1 FR2 FR3 fnegate p FR1 FR2 => i_fnegate FR1 FR2 -fconv Int=iq Dst=l => move Int x | fconv x Dst +fconv Arg=iqan Dst=l => move Arg x | fconv x Dst fmove q l fmove d l diff --git a/erts/emulator/test/Makefile b/erts/emulator/test/Makefile index b1374950b2..df2faf1450 100644 --- a/erts/emulator/test/Makefile +++ b/erts/emulator/test/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1997-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -61,7 +61,7 @@ MODULES= \ exception_SUITE \ float_SUITE \ fun_SUITE \ - fun_r11_SUITE \ + fun_r12_SUITE \ gc_SUITE \ guard_SUITE \ hash_SUITE \ diff --git a/erts/emulator/test/beam_SUITE.erl b/erts/emulator/test/beam_SUITE.erl index cc1626630b..228ff15341 100644 --- a/erts/emulator/test/beam_SUITE.erl +++ b/erts/emulator/test/beam_SUITE.erl @@ -1,26 +1,26 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(beam_SUITE). -export([all/1, packed_registers/1, apply_last/1, apply_last_bif/1, - buildo_mucho/1, heap_sizes/1, big_lists/1]). + buildo_mucho/1, heap_sizes/1, big_lists/1, fconv/1]). -export([applied/2]). @@ -279,3 +279,26 @@ b() -> _} -> ok end. + +fconv(Config) when is_list(Config) -> + ?line do_fconv(atom), + ?line do_fconv(nil), + ?line do_fconv(tuple_literal), + ?line 3.0 = do_fconv(1.0, 2.0), + ok. + +do_fconv(Type) -> + try + do_fconv(Type, 1.0), + test_server:fail() + catch + error:badarith -> + ok + end. + +do_fconv(atom, Float) when is_float(Float) -> + Float + a; +do_fconv(nil, Float) when is_float(Float) -> + Float + []; +do_fconv(tuple_literal, Float) when is_float(Float) -> + Float + {a,b}. diff --git a/erts/emulator/test/binary_SUITE.erl b/erts/emulator/test/binary_SUITE.erl index db2b3e10db..7ecc31aa29 100644 --- a/erts/emulator/test/binary_SUITE.erl +++ b/erts/emulator/test/binary_SUITE.erl @@ -55,7 +55,6 @@ otp_5484/1,otp_5933/1, ordering/1,unaligned_order/1,gc_test/1, bit_sized_binary_sizes/1, - bitlevel_roundtrip/1, otp_6817/1,deep/1,obsolete_funs/1,robustness/1,otp_8117/1, otp_8180/1]). @@ -70,7 +69,7 @@ all(suite) -> bad_binary_to_term_2,safe_binary_to_term2, bad_binary_to_term, bad_terms, t_hash, bad_size, bad_term_to_binary, more_bad_terms, otp_5484, otp_5933, ordering, unaligned_order, - gc_test, bit_sized_binary_sizes, bitlevel_roundtrip, otp_6817, otp_8117, + gc_test, bit_sized_binary_sizes, otp_6817, otp_8117, deep,obsolete_funs,robustness,otp_8180]. init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> @@ -1150,35 +1149,6 @@ bsbs_1(A) -> Bin = binary_to_term(<<131,$M,5:32,A,0,0,0,0,0>>), BinSize = bit_size(Bin). -bitlevel_roundtrip(Config) when is_list(Config) -> - case ?t:is_release_available("r11b") of - true -> bitlevel_roundtrip_1(); - false -> {skip,"No R11B found"} - end. - -bitlevel_roundtrip_1() -> - Name = bitlevelroundtrip, - ?line N = list_to_atom(atom_to_list(Name) ++ "@" ++ hostname()), - ?line ?t:start_node(Name, slave, [{erl,[{release,"r11b"}]}]), - - ?line {<<128>>,1} = roundtrip(N, <<1:1>>), - ?line {<<64>>,2} = roundtrip(N, <<1:2>>), - ?line {<<16#E0>>,3} = roundtrip(N, <<7:3>>), - ?line {<<16#70>>,4} = roundtrip(N, <<7:4>>), - ?line {<<16#10>>,5} = roundtrip(N, <<2:5>>), - ?line {<<16#8>>,6} = roundtrip(N, <<2:6>>), - ?line {<<16#2>>,7} = roundtrip(N, <<1:7>>), - ?line {<<8,128>>,1} = roundtrip(N, <<8,1:1>>), - ?line {<<42,248>>,5} = roundtrip(N, <<42,31:5>>), - - ?line ?t:stop_node(N), - ok. - -roundtrip(Node, Term) -> - {badrpc,{'EXIT',Res}} = rpc:call(Node, erlang, exit, [Term]), - io:format("<<~p bits>> => ~w", [bit_size(Term),Res]), - Res. - deep(Config) when is_list(Config) -> ?line deep_roundtrip(lists:foldl(fun(E, A) -> [E,A] diff --git a/erts/emulator/test/decode_packet_SUITE.erl b/erts/emulator/test/decode_packet_SUITE.erl index 13f17e972c..6cde286871 100644 --- a/erts/emulator/test/decode_packet_SUITE.erl +++ b/erts/emulator/test/decode_packet_SUITE.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -24,10 +24,10 @@ -include("test_server.hrl"). -export([all/1,init_per_testcase/2,fin_per_testcase/2, - basic/1, packet_size/1, neg/1, http/1, line/1, ssl/1]). + basic/1, packet_size/1, neg/1, http/1, line/1, ssl/1, otp_8536/1]). all(suite) -> - [basic, packet_size, neg, http, line, ssl]. + [basic, packet_size, neg, http, line, ssl, otp_8536]. init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) -> Seed = {S1,S2,S3} = now(), @@ -504,6 +504,27 @@ ssl(Config) when is_list(Config) -> F(v2hello), ok. +otp_8536(doc) -> ["Corrupt sub-binary-strings from httph_bin"]; +otp_8536(Config) when is_list(Config) -> + lists:foreach(fun otp_8536_do/1, lists:seq(1,50)), + ok. + +otp_8536_do(N) -> + Data = <<"some data 123">>, + Letters = <<"bcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba">>, + <<HdrTail:N/binary,_/binary>> = Letters, + Hdr = <<$A, HdrTail/binary>>, + Bin = <<Hdr/binary, ": ", Data/binary, "\r\n\r\n">>, + + io:format("Bin='~p'\n",[Bin]), + ?line {ok,{http_header,0,Hdr2,undefined,Data2},<<"\r\n">>} = decode_pkt(httph_bin, Bin, []), + + %% Do something to trash the C-stack, how about another decode_packet: + decode_pkt(httph_bin,<<Letters/binary, ": ", Data/binary, "\r\n\r\n">>, []), + + %% Now check that we got the expected binaries + {Hdr, Data} = {Hdr2, Data2}. + decode_pkt(Type,Bin) -> decode_pkt(Type,Bin,[]). decode_pkt(Type,Bin,Opts) -> diff --git a/erts/emulator/test/fun_r11_SUITE.erl b/erts/emulator/test/fun_r12_SUITE.erl index 61ba816cc8..f21299ba67 100644 --- a/erts/emulator/test/fun_r11_SUITE.erl +++ b/erts/emulator/test/fun_r12_SUITE.erl @@ -1,24 +1,23 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% --module(fun_r11_SUITE). --compile(r11). +-module(fun_r12_SUITE). -export([all/1,init_per_testcase/2,fin_per_testcase/2,dist_old_release/1]). @@ -37,36 +36,36 @@ fin_per_testcase(_Case, Config) -> ok. dist_old_release(Config) when is_list(Config) -> - case ?t:is_release_available("r11b") of + case ?t:is_release_available("r12b") of true -> do_dist_old(Config); - false -> {skip,"No R11B found"} + false -> {skip,"No R12B found"} end. do_dist_old(Config) when is_list(Config) -> ?line Pa = filename:dirname(code:which(?MODULE)), - Name = fun_dist_r11, + Name = fun_dist_r12, ?line {ok,Node} = ?t:start_node(Name, peer, [{args,"-pa "++Pa}, - {erl,[{release,"r11b"}]}]), + {erl,[{release,"r12b"}]}]), ?line Pid = spawn_link(Node, fun() -> receive Fun when is_function(Fun) -> - R11BFun = fun(H) -> cons(H, [b,c]) end, - Fun(Fun, R11BFun) + R12BFun = fun(H) -> cons(H, [b,c]) end, + Fun(Fun, R12BFun) end end), Self = self(), - Fun = fun(F, R11BFun) -> + Fun = fun(F, R12BFun) -> {pid,Self} = erlang:fun_info(F, pid), {module,?MODULE} = erlang:fun_info(F, module), - Self ! {ok,F,R11BFun} + Self ! {ok,F,R12BFun} end, ?line Pid ! Fun, ?line receive - {ok,Fun,R11BFun} -> - ?line [a,b,c] = R11BFun(a); + {ok,Fun,R12BFun} -> + ?line [a,b,c] = R12BFun(a); Other -> ?line ?t:fail({bad_message,Other}) end, diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c index 9c25d33a3c..f70db86960 100644 --- a/erts/lib_src/common/erl_misc_utils.c +++ b/erts/lib_src/common/erl_misc_utils.c @@ -1,19 +1,19 @@ /* * %CopyrightBegin% - * - * Copyright Ericsson AB 2006-2009. All Rights Reserved. - * + * + * Copyright Ericsson AB 2006-2010. All Rights Reserved. + * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in * compliance with the License. You should have received a copy of the * Erlang Public License along with this software. If not, it can be * retrieved online at http://www.erlang.org/. - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. - * + * * %CopyrightEnd% */ @@ -373,8 +373,8 @@ erts_get_cpu_topology(erts_cpu_info_t *cpuinfo, return 0; memcpy((void *) topology, (void *) cpuinfo->topology, - cpuinfo->configured*sizeof(erts_cpu_topology_t)); - return cpuinfo->configured; + cpuinfo->topology_size*sizeof(erts_cpu_topology_t)); + return cpuinfo->topology_size; } int |