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
The fix consists in representing float literals by their bit patterns (int64) in the Mach and Linear intermediate languages.
A regression test was added to the test suite.
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%)
Unix.sleepf provides sleep with sub-second resolution.
Unix.sleep is implemented on top of Unix.sleepf.
If a handled signal causes the sleep to return early with an EINTR
error, catch it and restart the sleep for the remaining time.
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.
Add the following syntactic sugars, in both expressions and patterns:
- { f : typ = x } to mean { f = (x : typ) }
- { f : typ } to mean { f = (f : typ) }
In expressions, the type annotation can also be a coercion. For
instance: { f :> typ } to mean { f = (f :> typ) }.
Patch by Valentin Gatien-Baron
(Leo White)
Add support for simple functor types of the form:
S -> T
equivalent to:
functor (_ : S) -> T
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16546 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Jérémie Dimino)
- use inline-records to avoid using Obj.magic while keeping
indirections to the minumum
- change the representation from a cyclic list to a simply-linked
list. The drawback is one more word per queue, but it makes the
implementation clearer
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16545 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
to warn when the argument is matches against a constant pattern.
This attributes is applied on predefined exception constructors
which take an purely informational (with no stability guarantee)
message.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16502 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
compiling the run-time system and C stub code.
Also: select "gnu99" mode (= ISO C99 + GNU extensions).
Also: gcc/clang warnings are errors when in development mode.
(Turned off for release builds.)
Also: clean up and modernize the autoconf tests in config/auto-aux
(Merge of branch 'cc-optim'.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16379 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
There is currently a GC bug in the bytecode debug-info handling, due
to the fact that
void read_main_debug_info(struct debug_info *di)
is passed a internal pointer in the middle of a custom block inside
the OCaml heap. I could only observe the bug when such custom blocks
are allocated on the minor heap -- which does not happen with the
current implementation, but becomes possible after GPR#92 for example
(which let custom blocks with finalizer be allocated in the
minor heap).
This commit fixes this issue by moving debug_info chunks from the
OCaml heap to the C land, stored in a dynamic table. They are
allocated when caml_add_debug_info is called, and removed when
caml_remove_debug_info is called.
(Another approach would be to keep the debug_info inside the OCaml
heap, but make sure that there are no dangling internal pointers. See
GPR#228 for an attack of this by Mark Shinwell.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16356 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
* PR#6816: reject identifiers following numeric literals without spacing, e.g.
let foo = 1 in (fun a b -> a,b) 23foo
(Hugo Heuzard)
(Thanks to Daniel Bünzli for reminding me.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16317 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Hongbo Zhang)
when printing recursive module the old version would print no space
before 'and':
A : ... = struct
...
endand B : ... = ...
this tiny PR fixes such problem
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16307 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Pierre Chambart)
It now reallocates and reinitialises the whole table only when it is
too small. This avoids quadratic behavior when loading a lot of module
with dynlink.
This was problematic on frama-c when inlining increase the code
size. The frame table initialisation took ~0.5 second. This is quite
noticeable on real examples where the whole frama-c analysis is ~1.5s
long.
Also allows to unregister a frametable.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16260 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Clark Gaebel)
These functions are called every tick of the Async scheduler, and
are the only remaining calls to [caml_c_call] every cycle. It would
be nice to remove them, especially since these functions don't
allocate.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16259 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02