Faire cohabiter les threads bytecode et les threads systeme. Ajout option ocamlc -vmthread.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5705 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
e6b55ae07f
commit
680a54d3c2
11
Changes
11
Changes
|
@ -49,6 +49,10 @@ Both compilers:
|
|||
- Added warning "E" for "fragile patterns": pattern matchings that would
|
||||
not be flagged as partial if new constructors were added to the data type.
|
||||
|
||||
Bytecode compiler:
|
||||
- Added option -vmthread to select the threads library with VM-level
|
||||
scheduling. The -thread option now selects the system threads library.
|
||||
|
||||
Native-code compiler:
|
||||
- New port: AMD64 (Opteron).
|
||||
- Fixed instruction selection bug on expressions of the kind (raise Exn)(arg).
|
||||
|
@ -108,12 +112,11 @@ Other libraries:
|
|||
- Str: reimplemented regexp matching engine, now less buggy, faster,
|
||||
and LGPL instead of GPL.
|
||||
- Graphics: fixed draw_rect and fill_rect bug under X11.
|
||||
- System threads and bytecode threads libraries can be both installed.
|
||||
- System threads: better implementation of Thread.exit.
|
||||
- Bytecode threads: fixed two library initialization bugs.
|
||||
- Unix:
|
||||
Make Unix.openfile blocking to account for named pipes.
|
||||
GC bug in Unix.*stat fixed.
|
||||
Fixed problem with Unix.dup2 on Windows.
|
||||
- Unix: make Unix.openfile blocking to account for named pipes;
|
||||
GC bug in Unix.*stat fixed; fixed problem with Unix.dup2 on Windows.
|
||||
|
||||
Ocamllex:
|
||||
- Can name parts of the matched input text, e.g.
|
||||
|
|
|
@ -34,7 +34,6 @@ tk_defs=''
|
|||
tk_libs=''
|
||||
tk_x11=yes
|
||||
dl_defs=''
|
||||
posix_threads=no
|
||||
verbose=no
|
||||
withcurses=yes
|
||||
withsharedlibs=yes
|
||||
|
@ -81,7 +80,7 @@ while : ; do
|
|||
-x11lib*|--x11lib*)
|
||||
x11_lib_dir=$2; shift;;
|
||||
-with-pthread*|--with-pthread*)
|
||||
posix_threads=yes;;
|
||||
;; # Ignored for backward compatibility
|
||||
-no-tk|--no-tk)
|
||||
tk_wanted=no;;
|
||||
-tkdefs*|--tkdefs*)
|
||||
|
@ -1037,38 +1036,45 @@ if sh ./searchpath as; then :; else bignum_arch=C; fi
|
|||
|
||||
echo "BIGNUM_ARCH=$bignum_arch" >> Makefile
|
||||
|
||||
# Determine if the threads library is supported
|
||||
# Determine if the POSIX threads library is supported
|
||||
|
||||
if test "$posix_threads" = "yes"; then
|
||||
echo "Threads library supported (using POSIX system threads)."
|
||||
case "$host" in
|
||||
*-*-solaris*) pthread_link="-lpthread -lposix4";;
|
||||
*-*-freebsd*) pthread_link="-pthread";;
|
||||
*-*-openbsd*) pthread_link="-pthread";;
|
||||
*) pthread_link="-lpthread";;
|
||||
esac
|
||||
|
||||
if ./hasgot -i pthread.h $pthread_link pthread_self; then
|
||||
echo "POSIX threads library supported."
|
||||
otherlibraries="$otherlibraries systhreads"
|
||||
bytecccompopts="$bytecccompopts -D_REENTRANT"
|
||||
nativecccompopts="$nativecccompopts -D_REENTRANT"
|
||||
case "$host" in
|
||||
*-*-solaris*)
|
||||
pthread_link="-lpthread -lposix4";;
|
||||
*-*-freebsd*)
|
||||
pthread_link="-pthread"
|
||||
bytecccompopts="$bytecccompopts -D_THREAD_SAFE"
|
||||
nativecccompopts="$nativecccompopts -D_THREAD_SAFE";;
|
||||
*-*-openbsd*)
|
||||
pthread_link="-pthread"
|
||||
bytecccompopts="$bytecccompopts -pthread"
|
||||
asppflags="$asppflags -pthread"
|
||||
nativecccompopts="$nativecccompopts -pthread";;
|
||||
*)
|
||||
pthread_link="-lpthread";;
|
||||
esac
|
||||
echo "Options for linking with POSIX threads: $pthread_link"
|
||||
echo "PTHREAD_LINK=$pthread_link" >> Makefile
|
||||
elif test "$has_select" = "yes" \
|
||||
else
|
||||
echo "POSIX threads not found."
|
||||
fi
|
||||
|
||||
# Determine if the bytecode thread library is supported
|
||||
|
||||
if test "$has_select" = "yes" \
|
||||
&& test "$has_setitimer" = "yes" \
|
||||
&& test "$has_gettimeofday" = "yes" \
|
||||
&& test "$has_wait" = "yes"; then
|
||||
echo "Threads library supported (using bytecode-level scheduling)."
|
||||
echo "Bytecode threads library supported."
|
||||
otherlibraries="$otherlibraries threads"
|
||||
else
|
||||
echo "No threads library (missing system calls)"
|
||||
echo "Bytecode threads library not supported (missing system calls)"
|
||||
fi
|
||||
|
||||
# Determine the location of X include files and libraries
|
||||
|
|
|
@ -27,8 +27,8 @@ open Typedtree
|
|||
|
||||
let init_path () =
|
||||
let dirs =
|
||||
if !Clflags.thread_safe
|
||||
then "+threads" :: !Clflags.include_dirs
|
||||
if !Clflags.use_threads then "+threads" :: !Clflags.include_dirs
|
||||
else if !Clflags.use_vmthreads then "+vmthreads" :: !Clflags.include_dirs
|
||||
else !Clflags.include_dirs in
|
||||
let exp_dirs =
|
||||
List.map (expand_directory Config.standard_library) dirs in
|
||||
|
|
|
@ -101,7 +101,8 @@ module Options = Main_args.Make_options (struct
|
|||
let _pp s = preprocessor := Some s
|
||||
let _principal = set principal
|
||||
let _rectypes = set recursive_types
|
||||
let _thread = set thread_safe
|
||||
let _thread = set use_threads
|
||||
let _vmthread = set use_vmthreads
|
||||
let _unsafe = set fast
|
||||
let _use_prims s = use_prims := s
|
||||
let _use_runtime s = use_runtime := s
|
||||
|
|
|
@ -43,6 +43,7 @@ module Make_options (F :
|
|||
val _principal : unit -> unit
|
||||
val _rectypes : unit -> unit
|
||||
val _thread : unit -> unit
|
||||
val _vmthread : unit -> unit
|
||||
val _unsafe : unit -> unit
|
||||
val _use_prims : string -> unit
|
||||
val _use_runtime : string -> unit
|
||||
|
@ -108,7 +109,7 @@ struct
|
|||
"-principal", Arg.Unit F._principal,
|
||||
" Check principality of type inference";
|
||||
"-rectypes", Arg.Unit F._rectypes, " Allow arbitrary recursive types";
|
||||
"-thread", Arg.Unit F._thread, " Use thread-safe standard library";
|
||||
"-thread", Arg.Unit F._thread, " Generate code that supports the system threads library";
|
||||
"-unsafe", Arg.Unit F._unsafe,
|
||||
" No bounds checking on array and string access";
|
||||
"-use-runtime", Arg.String F._use_runtime,
|
||||
|
@ -119,6 +120,7 @@ struct
|
|||
" Print compiler version and location of standard library and exit";
|
||||
"-version", Arg.Unit F._version, " Print compiler version and exit";
|
||||
"-verbose", Arg.Unit F._verbose, " Print calls to external commands";
|
||||
"-vmthread", Arg.Unit F._vmthread, " Generate code that supports the threads library with VM-level scheduling";
|
||||
"-w", Arg.String F._w,
|
||||
"<flags> Enable or disable warnings according to <flags>:\n\
|
||||
\032 A/a enable/disable all warnings\n\
|
||||
|
|
|
@ -43,6 +43,7 @@ module Make_options (F :
|
|||
val _principal : unit -> unit
|
||||
val _rectypes : unit -> unit
|
||||
val _thread : unit -> unit
|
||||
val _vmthread : unit -> unit
|
||||
val _unsafe : unit -> unit
|
||||
val _use_prims : string -> unit
|
||||
val _use_runtime : string -> unit
|
||||
|
|
|
@ -26,7 +26,7 @@ open Typedtree
|
|||
|
||||
let init_path () =
|
||||
let dirs =
|
||||
if !Clflags.thread_safe
|
||||
if !Clflags.use_threads
|
||||
then "+threads" :: !Clflags.include_dirs
|
||||
else !Clflags.include_dirs in
|
||||
let exp_dirs =
|
||||
|
|
|
@ -129,7 +129,7 @@ let main () =
|
|||
"-rectypes", Arg.Set recursive_types,
|
||||
" Allow arbitrary recursive types";
|
||||
"-S", Arg.Set keep_asm_file, " Keep intermediate assembly file";
|
||||
"-thread", Arg.Set thread_safe, " Use thread-safe standard library";
|
||||
"-thread", Arg.Set use_threads, " Generate code that supports the system threads library";
|
||||
"-unsafe", Arg.Set fast,
|
||||
" No bounds checking on array and string access";
|
||||
"-v", Arg.Unit print_version_and_library,
|
||||
|
|
|
@ -25,12 +25,8 @@ open Typedtree
|
|||
then the directories specified with the -I option (in command-line order),
|
||||
then the standard library directory. *)
|
||||
let init_path () =
|
||||
let dirs =
|
||||
if !Clflags.thread_safe then
|
||||
Filename.concat Config.standard_library "threads" :: !Clflags.include_dirs
|
||||
else
|
||||
!Clflags.include_dirs in
|
||||
load_path := "" :: List.rev (Config.standard_library :: dirs);
|
||||
load_path :=
|
||||
"" :: List.rev (Config.standard_library :: !Clflags.include_dirs);
|
||||
Env.reset_cache()
|
||||
|
||||
(** Return the initial environment in which compilation proceeds. *)
|
||||
|
|
|
@ -48,15 +48,15 @@ UNIXLIB=../unix
|
|||
|
||||
UNIXLIB_OBJS=unix.cmo $(UNIXLIB)/unixLabels.cmo
|
||||
|
||||
all: libthreads.a threads.cma stdlib.cma unix.cma
|
||||
all: libvmthreads.a threads.cma stdlib.cma unix.cma
|
||||
|
||||
allopt:
|
||||
|
||||
libthreads.a: $(C_OBJS)
|
||||
$(MKLIB) -o threads $(C_OBJS)
|
||||
libvmthreads.a: $(C_OBJS)
|
||||
$(MKLIB) -o threads -oc vmthreads $(C_OBJS)
|
||||
|
||||
threads.cma: $(CAML_OBJS)
|
||||
$(MKLIB) -ocamlc '$(CAMLC)' -o threads $(CAML_OBJS)
|
||||
$(MKLIB) -ocamlc '$(CAMLC)' -o threads -oc vmthreads $(CAML_OBJS)
|
||||
|
||||
stdlib.cma: $(LIB_OBJS)
|
||||
$(CAMLC) -a -o stdlib.cma $(LIB_OBJS)
|
||||
|
@ -95,16 +95,16 @@ partialclean:
|
|||
rm -f *.cm*
|
||||
|
||||
clean: partialclean
|
||||
rm -f libthreads.a dllthreads.so *.o
|
||||
rm -f libvmthreads.a dllvmthreads.so *.o
|
||||
rm -f pervasives.mli marshal.mli unix.mli
|
||||
|
||||
install:
|
||||
if test -f dllthreads.so; then cp dllthreads.so $(STUBLIBDIR)/dllthreads.so; fi
|
||||
cp libthreads.a $(LIBDIR)/libthreads.a
|
||||
cd $(LIBDIR); $(RANLIB) libthreads.a
|
||||
if test -d $(LIBDIR)/threads; then : ; else mkdir $(LIBDIR)/threads; fi
|
||||
cp thread.cmi mutex.cmi condition.cmi event.cmi threadUnix.cmi threads.cma stdlib.cma unix.cma $(LIBDIR)/threads
|
||||
cp thread.mli mutex.mli condition.mli event.mli threadUnix.mli $(LIBDIR)
|
||||
if test -f dllvmthreads.so; then cp dllvmthreads.so $(STUBLIBDIR)/.; fi
|
||||
mkdir -p $(LIBDIR)/vmthreads
|
||||
cp libvmthreads.a $(LIBDIR)/vmthreads/libvmthreads.a
|
||||
cd $(LIBDIR)/vmthreads; $(RANLIB) libvmthreads.a
|
||||
cp thread.cmi mutex.cmi condition.cmi event.cmi threadUnix.cmi threads.cma stdlib.cma unix.cma $(LIBDIR)/vmthreads
|
||||
cp thread.mli mutex.mli condition.mli event.mli threadUnix.mli $(LIBDIR)/vmthreads
|
||||
|
||||
installopt:
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ module Options = Main_args.Make_options (struct
|
|||
let _principal = option "-principal"
|
||||
let _rectypes = option "-rectypes"
|
||||
let _thread () = ismultithreaded := "-thread"; option "-thread" ()
|
||||
let _vmthread () = ismultithreaded := "-vmthread"; option "-vmthread" ()
|
||||
let _unsafe = option "-unsafe"
|
||||
let _use_prims s = option_with_arg "-use-prims" s
|
||||
let _use_runtime s = option_with_arg "-use-runtime" s
|
||||
|
|
|
@ -34,7 +34,8 @@ and classic = ref false (* -nolabels *)
|
|||
and nopervasives = ref false (* -nopervasives *)
|
||||
and preprocessor = ref(None : string option) (* -pp *)
|
||||
let save_types = ref false (* -stypes *)
|
||||
and thread_safe = ref false (* -thread *)
|
||||
and use_threads = ref false (* -thread *)
|
||||
and use_vmthreads = ref false (* -vmthread *)
|
||||
and noassert = ref false (* -noassert *)
|
||||
and verbose = ref false (* -verbose *)
|
||||
and use_prims = ref "" (* -use-prims ... *)
|
||||
|
|
Loading…
Reference in New Issue