Commit Graph

1154 Commits (4f6e4144ffb339eb785d475fa342c47aa8682daf)

Author SHA1 Message Date
Xavier Leroy 77cf36cf82 Merge pull request #331 from ocaml/win32-sockets
Windows sockets in asynchronous mode
2015-12-09 11:51:36 +01:00
alainfrisch e888e099e2 Revert commits related to #330.
1. Revert "Switch to -custom for bytecode tests."
This reverts commit 6b7f81caf5.

2. Revert "Fix Changelog."
This reverts commit d94488d7b5.

3.Revert "Fix testsuite: use binary channels."
This reverts commit 840f7ca506.

4. Revert "Fix testsuite: do not require a globally installed ocamlrun."
This reverts commit 0388ef46d9.

5. Revert "Merge branch 'trunk' of https://github.com/bvaugon/ocaml into bvaugon-trunk"
This reverts commit 1ff6db10bf, reversing
changes made to 89d116c514.
2015-12-08 14:44:29 +01:00
alainfrisch 1ff6db10bf Merge branch 'trunk' of https://github.com/bvaugon/ocaml into bvaugon-trunk 2015-12-04 16:31:59 +01:00
Louis Gesbert 24e42d4d22 Add v=0x400 to OCAMLRUNPARAM to print more Gc stats on exit
In a format following that of Gc.print_stat. I chose to print only the "quick_stat"
values rather than call gc_ctrl.c::heap_stats because it's lighter, and the extra
information is typically not very useful at program exit.

Also adds documentation for the 0x400 flag (in man and Gc module)

This replaces the previous undocumented 0x400 that only displayed the
total (minwords + majwords - prowords) and with a different format,
since keeping both wouldn't provide more information.
2015-12-04 21:09:27 +09:00
Xavier Leroy b6442d5957 Branch win32-sockets: missing includes in byterun/unix.c + add test.
The "socketsbuf.ml" test checks that buffered I/O channels over sockets work properly.  (Regression test for PR#5578.)
2015-12-04 12:01:10 +01:00
Xavier Leroy aacb6d5861 Branch win32-sockets: move do_read and do_write to OS-specific file.
This way, error handling is done in the OS-specific file (unix.c or win32.c).
In turn, this makes it easier to report a good Sys_error exception
in case of Win32 socket I/O error.
2015-12-04 11:40:11 +01:00
Benoit Vaugon 5e3964da86 Fix "weak hash of serialised closures" from mantis #0005942. 2015-12-04 00:51:44 +01:00
Xavier Leroy bdc8db8649 Typo in do_read (byterun/io.c) 2015-12-01 15:50:55 +01:00
Xavier Leroy 15ac614a89 Experiment: Win32 sockets in non-synchronous mode.
This is an attempt to address PR#4466, #5325, #6771.  Not tested yet.
2015-11-30 11:42:16 +01:00
Mark Shinwell 35dc44a00f Someone didn't compile their code 2015-11-30 11:04:11 +01:00
Mark Shinwell c1c84310b5 Someone didn't compile their code 2015-11-30 09:28:38 +00:00
alainfrisch 6c90da49f1 GPR#210: runtime warnings are disabled by default. 2015-11-30 10:18:10 +01:00
alainfrisch 37ad7ece0e GPR#210: keep unflushed out channels around to be able to flush them during at_exit. 2015-11-30 09:57:30 +01:00
alainfrisch 657e6be3dd Be more consistent in caml_alloc_shr_no_raise: it can never raise. 2015-11-23 13:52:04 +01:00
alainfrisch 95233ec9ca Cosmetic (as suggested by G. Scherer). 2015-11-23 13:51:02 +01:00
alainfrisch 092c5e4506 Fixes for MSVC. 2015-11-23 13:30:34 +01:00
Alain Frisch 4788ab33d6 Merge pull request #283 from mlasson/trunk
Fix memory leaks in intern.c when OOM is raised
2015-11-23 13:25:34 +01:00
Marc Lasson bf0fc9fc9c Apply xleroy patch to implement alloc_shr_no_raise 2015-11-23 12:09:16 +01:00
alainfrisch a9ef6428fc MSVC (at least some old version) does not support inline. Use _inline instead. This #define should perhaps go somewhere else, e.g. caml/misc.h (defined as caml_inline?). 2015-11-23 09:58:44 +01:00
alainfrisch 4c8affc1ca MSVC doesn't support variable declaration within code blocks. 2015-11-23 09:49:23 +01:00
Marc Lasson 448d365d32 Update changelog & remove useless vertical spaces 2015-11-20 17:51:43 +01:00
Marc Lasson 1a2c6310fc Adds a function intern_init to set global state 2015-11-20 17:51:00 +01:00
Marc Lasson 061525dae0 Typo in comment 2015-11-20 17:45:07 +01:00
Marc Lasson 66714a3af1 Use a global variable to implement caml_alloc_shr_no_raise 2015-11-20 17:45:07 +01:00
Marc Lasson 8414d46214 Simplify intern state. 2015-11-20 17:45:07 +01:00
Marc Lasson 15b51b1c7b Assert intern is in a clean state
Assert that intern is in a clean state at the beginning of demarshaling
primitives.
2015-11-20 17:38:35 +01:00
Marc Lasson d6d3744d6f Idempotent intern_cleanup 2015-11-20 17:37:45 +01:00
Marc Lasson 01ef4800b3 alloc_shr is a wrapper around alloc_shr_no_raise
It is explicitly unfolded in the minor_gc.c for performance.
2015-11-20 17:37:45 +01:00
Marc Lasson 522453659a Remove useless declaration in memory.h. 2015-11-20 17:37:45 +01:00
Marc Lasson 4e2891b97b Remove useless stdio #include 2015-11-20 17:37:45 +01:00
Marc Lasson 5766c2de36 Delete stat_alloc_no_raise and duplicate alloc_shr
I replaced all calls to stat_alloc_no_raise by plain mallocs.
Also, I reimplemented alloc_shr_no_raise by duplicating the code of alloc_shr to avoid any overhead induced by an extra function call.
2015-11-20 17:37:45 +01:00
Marc Lasson d4d7bcd48e Fix indentation. 2015-11-20 17:37:45 +01:00
Marc Lasson ddd51af088 Fix memory leaks in intern.c in alloc_shr case
Prevents the function `caml_alloc_shr` to raise an OOM exception
before intern_cleanup could be called (this complete commit 1e62f1b).

It defines a new caml_alloc_shr_no_raise function.
2015-11-20 17:37:45 +01:00
Marc Lasson bd471eb198 Fix a memory leak in concat_array
There is a memory leak when the second or the third call to `caml_stack_alloc`
in `caml_array_concat` raises Out_of_memory. This will fix it.
2015-11-20 17:37:45 +01:00
Marc Lasson de7424404b Fix memory leaks in intern.c when OOM is raised
In the function, `intern_alloc` a call to caml_alloc_for_heap is very likely to
return NULL when reading a big marshaled value. If that happens, before raising
out_of_memory, it should call the `intern_cleanup` function to free the stack
as well as `intern_input` that may have been malloced by `caml_input_val`.
Similarly, `intern_cleanup` should also be called when we are not able to
allocate `intern_obj_table`. To do that, I added a function
`caml_stat_alloc_no_raise` which, like its brother, `caml_stat_alloc` wraps
some debugging information around a call to malloc. I could have used directly
malloc instead of adding a new function to memory.c, as it is done in other
places of the code (it has the drawback of not adding the debug tag).

Note that this fix is not perfect. The function `intern_alloc` could also raise
out_of_memory through its call to `caml_alloc_shr`. It is less likely to happen
since caml_alloc_shr is only called when the input is smaller than Max_wosize
but it could happen. In that case, there will be leak (but a smaller one).
2015-11-20 17:37:45 +01:00
Damien Doligez 60e7055d9f fix wrong C++ bracketing in hash.h 2015-11-20 15:51:37 +01:00
Xavier Leroy bf2033e127 If <stdint.h> not available (e.g. MSVC), define {u,}int16_t types ourselves. 2015-11-19 10:45:54 +01:00
Xavier Leroy 0c5e862a3e GPR#268: Hexadecimal notation for floating-point numbers
Merge of branch 'hex-float'.

- Add support in byterun/floats.c for conversions between floats and strings in hex notation. We cannot rely on the C standard library here because Microsoft consistently fails at supporting hex notation as standardized in C99. Instead, the conversions are implemented from scratch.
- Add support in the lexer so that hex float literals are recognized in OCaml sources.
- Add support in formats. The ISO C99 format letters for hex floats are %a and %A, but %a is already taken. I chose %h and %H, which are rejected today as bad formats (hence no backward incompatibility) and don't mean anything in C either (h is a modifier, not a format letter).
- Add support in printf. All the trimmings are there in the implementation of %h and %H, including sign modifier and fixed precision.
- Benoit Vaugon contributed support in scanf.

Resolved conflicts:
	boot/ocamlc
	boot/ocamldep
	boot/ocamllex
	parsing/lexer.mll
2015-11-19 10:37:20 +01:00
Xavier Leroy 4fd254e325 Merge pull request #224 from ocaml/big-marshal
PR#6910 and GPR#224: extend marshaling to support data encodings beyond 4 Gb
2015-11-19 09:56:43 +01:00
Xavier Leroy e7f339e6bd Improve speed of classify_float
As suggested in the discussion of GPR#272:
- Do not go through fpclassify()  (speedup: 2 to 3)
- Add 64-bit variant of the code  (additional speedup: 10%-20%)
2015-11-15 16:43:46 +01:00
Xavier Leroy dc2a98c3a5 PR#6945 and GPR#227: protect Sys and Unix functions against string arguments containing the null character '\000'
Continuation of commit dc043a7:
- Protect Sys.command
2015-11-13 14:57:12 +01:00
Jacques Garrigue eb0de16ee0 Fix PR#4166, PR#6959: force linking when calling external C primitives 2015-11-13 13:59:14 +09:00
Xavier Leroy dc043a7b62 PR#6945 and GPR#227: protect Sys and Unix functions against string arguments containing the null character '\000'
Implementation notes:
- Based on c-cube's GPR#227 code, but many Unix functions were missing.
- For Unix.bind and Unix.connect to a PF_UNIX address, tolerate
  file names whose first character is '\000': in Linux, these have
  a meaning as "abstract socket addresses", and in other operating
  systems, the resulting empty path name causes a EINVAL error
  (tested under MacOS X).
- Very lightly tested.
- win32unix remains to be fixed.
2015-11-11 17:07:44 +01:00
Damien Doligez 7cb9a80744 simplify .gitignore; remove .ignore files and tools/setignore; adjust tools/check-typo 2015-11-06 16:25:05 +01:00
François Bobot 203c444fd4 Make `Pervasives.ldexp` unboxed and noalloc 2015-11-05 13:07:03 +01:00
François Bobot c0f19965f4 Make specialized compare unboxed
- float
    - int32
    - int64
    - nativeint

  Not for int because the comparison is done directly on the untagged version.
  Useful mainly for floats since they can be stored unboxed in records or arrays.
2015-11-05 13:07:03 +01:00
François Bobot 3c76d0678d Make `Sys.time` unboxed and noalloc 2015-11-05 13:07:03 +01:00
alainfrisch 26c9b9007f Add a note suggesting to switch to the emulation of clasify_float as a faster alternative to calling the libc. 2015-11-03 21:07:33 +01:00
alainfrisch 364f1cb79f Merge branch 'trunk' of github.com:ocaml/ocaml into unbox_classify_float 2015-11-03 21:03:07 +01:00
alainfrisch 1f3eac9b94 No need to use CAMLprim for native form of primitives. 2015-11-03 21:02:30 +01:00