[polyml] not printed exception when executed file

2016-06-15 Thread Kostirya
Hello. Why when executed file, exception is not printed? Is it OK? > cat foo.sml exception Ex fun main () = ( print "Start\n"; raise Ex; print "The End\n" ) > ( cat foo.sml ; echo 'val _ = main ()' ) | poly Poly/ML 5.6 Release Start Exception- Ex raised > polyc foo.sml && ./a.out Start > Best,

Re: [polyml] Socket.connectNB

2016-06-21 Thread Kostirya
If you use connectNB to connect to a service > that is not yet running you will get a ECONNREFUSED error. The only > question is where. If the underlying "connect" system call returns the > error immediately then connectNB will raise an exception. Whether it does > or not depends on the

[polyml] NetHostDB.fromString

2016-05-19 Thread Kostirya
Hello. NetHostDB.fromString have error: > poly Poly/ML 5.6 Release > NetHostDB.toString (valOf(NetHostDB.fromString "127.0.0.1")); val it = "0.0.0.127": string > NetHostDB.toString (valOf(NetHostDB.fromString "10.0.0.34")); val it = "0.0.0.10": string > NetHostDB.toString

[polyml] Some questions about Foreign

2016-05-24 Thread Kostirya
Hello. I have some questions about Foreign. 1. How to convert OS.IO.iodesc (from socket) into cUint (uintptr_t)? 2. C function is need 'const struct timespec *timeout' argument. Where struct timespec is: struct timespec { time_t tv_sec; long tv_nsec; }; Do I understand correctly

Re: [polyml] NetHostDB.fromString

2016-05-24 Thread Kostirya
gt; > > On 19/05/2016 10:17, Kostirya wrote: > >> Hello. >> >> NetHostDB.fromString have error: >> >> poly >>> >> Poly/ML 5.6 Release >> >>> NetHostDB.toString (valOf(NetHostDB.fromString "127.0.0.1")); >>>

Re: [polyml] Some questions about Foreign

2016-05-25 Thread Kostirya
Thank you! 2016-05-24 23:27 GMT+03:00 Phil Clayton <phil.clay...@lineone.net>: > Hi Kostirya, > > On 24/05/2016 09:07, Kostirya wrote: > >> Hello. >> >> I have some questions about Foreign. >> >> 1. How to convert OS.IO.iodesc (from socket) into

[polyml] Foreign and cShort

2016-05-25 Thread Kostirya
is it error? > cat foo.c short foo (short x) { return x+1; } > clang -shared -o foo.so foo.c > cat foo.sml open Foreign; val mylib = loadLibrary "foo.so" fun foo x = buildCall1 ((getSymbol mylib "foo"), cShort, cShort) x val r = foo ~5 val _ = print ( (Int.toString r) ^ "\n" ) > env

[polyml] Post-RTS and nonblocking socket functions

2017-02-02 Thread Kostirya
Hello. I found that the behavior of non-blocking socket functions has changed after upgrading PolyML to Post-RTS version. For example connectNB. If system call connect return -1 and errno is 36 (Operation now in progress), that SML exception occur in Socket.connectNB. Everything worked fine

Re: [polyml] 5.7 Release

2017-02-21 Thread Kostirya
I sometimes get Segmentation fault on pure SML code (without FFI). Feels it's after main function finished. > gdb -c a.out.core a.out GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to

[polyml] Benchmarks: Poly/ML 5.6.1 vs 5.6.0

2017-02-13 Thread Kostirya
Many thanks! Poly/ML 5.6.1 FFI is faster than in 5.6.0! So my server (redis-sharding) fasted on 30-80% on Poly/ML 5.6.1. I am also thinking to add kevent and epoll calls into libpolyml :-) But I also noticed that Int32 is very slower in 5.6.1. Int32 is slower than LargeInt. But I don't

[polyml] Poly/ML 5.6.1 Testing and exception_trace

2017-02-10 Thread Kostirya
Hello. Maybe exception_trace do not work in "Poly/ML 5.6.1 Testing". > poly Poly/ML 5.6.1 Testing > exception Ex; val () = PolyML.exception_trace (fn () => ( raise Ex; () )); exception Ex Exception- Ex raised > > poly Poly/ML 5.6 Release > exception Ex; val () = PolyML.exception_trace (fn () =>

[polyml] curl for Poly/ML and MLton

2016-09-30 Thread Kostirya
Hello Let me introduce you the libcurl for Standard ML and http client with asynchronous support (via sml-ev) https://github.com/kni/sml-curl I hope someone will find it helpful. Nick. P.S. Output of asynchronous example: > ./t-ev-poly libcurl/7.46.0 OpenSSL/1.0.1p zlib/1.2.8 Request:

[polyml] New kqueue and epoll library for MLton and Poly/ML.

2016-09-22 Thread Kostirya
Hello. Let me introduce you the kqueue (*BSD) and epoll (Linux) library for Standard ML (MLton and Poly/ML). https://github.com/kni/sml-ev I hope someone will find it helpful. Nick. ___ polyml mailing list polyml@inf.ed.ac.uk

[polyml] Interpretation of the profiler output data.

2016-08-18 Thread Kostirya
Hello. There is profiler output for ProfileTime profileMode: 10 GARBAGE COLLECTION (total) 11 servers_stream(5)c_cb(1) 12 ForeignMemory.addFree(2) 12 VectorSliceOperations().subslice(3) 13 ForeignMemory.memoise(2)(1) 14 main_handle(1) 15

[polyml] ConditionVar

2016-10-24 Thread Kostirya
Hello. Tell me, please, how to use the Thread and ConditionVar. The following code unpredictably hangs up... open Thread open Thread Mutex ConditionVar val cv = conditionVar() and m = mutex(); fun foo() = ( print "OK\n"; signal cv ); fork(foo, [EnableBroadcastInterrupt true, InterruptState

[polyml] Get errno

2016-11-11 Thread Kostirya
Hello. Could you please advise a good way to obtain the errno value. I use the following way but I don't like it: > cat errno.c #include int get_errno (void) { return errno; } > cat errno.sml open Foreign val errnolib = loadLibrary "errno.so" val get_errno = buildCall0 ((getSymbol errnolib

[polyml] Thank you very much

2016-11-18 Thread Kostirya
Hello. Thank you very much to everyone who helped me. I finally completed the Standard ML version of my server (with event-driven architecture). I made sure in practice that high-performance asynchronous servers can be done using PolyML and MLton. The performance of PolyML also surprised me

Re: [polyml] Get errno

2016-12-06 Thread Kostirya
Hello, David. I saw your PolyML last commits on github. I'm impressed! You've considered all my remarks! Many thanks! P.S. Foreign.Error.getLastError will be very useful for https://github.com/kni/sml-iconv :-) 2016-11-15 18:35 GMT+02:00 David Matthews : > I'm

[polyml] Build error: Exception- InternalError: Too many passes raised while compiling

2017-12-14 Thread Kostirya
Hello. Poly/ML broken on FreeBSD i386 (clang version 3.8.0). ./polyimport polytemp.txt -I . < ./exportPoly.sml Use: basis/build.sml ... Use: basis/FinalPolyML.sml Exception- InternalError: Too many passes raised while compiling The error appeared due to commit

[polyml] Pattern matching compilation is very slow

2018-06-26 Thread Kostirya
Hello. I found that Poly/ML very very slowly compiles (30 seconds) functions with very large count of pattern matching items (1400 items). I need to replace the pattern matching with many if-then-else. But the pattern matching works a faster for mlton and smlnj. Therefore, I want to use the

[polyml] PolyML and paths for load files.

2018-07-05 Thread Kostirya
Hello. Let's take into account Env to load files in use function? > diff -u FinalPolyML.sml_orig FinalPolyML.sml --- FinalPolyML.sml_orig2018-07-05 11:17:32.489398000 +0300 +++ FinalPolyML.sml 2018-07-05 11:20:20.012445000 +0300 @@ -674,6 +674,7 @@ end val suffixes = ref

Re: [polyml] 32bits addresses in 64-bit mode and other updates to master

2019-01-22 Thread Kostirya
Hello. I got one error with compact32bit on 64bit: (gdb) bt #0 0x821f5400 in ?? () #1 0xff9ab2b0 in ?? () #2 0xff9ab2b2 in ?? () #3 0x000d021fff10 in ?? () #4 0x000d821f9e1c in ?? () #5 0x000d821f9f00 in ?? () #6 0x000d021fff38 in ?? () #7

[polyml] Strange system calls when one use Socket.select or OS.IO.poll

2018-12-13 Thread Kostirya
Hello. My application use select or poll before accept socket. I trace system calls and found that too many select or poll calls occur. When I use select: select(1024,{ },{ },{ },{ 0.01 })= 0 (0x0) select(1024,{ 3 },{ },{ },{ 0.00 }) = 0 (0x0)

Re: [polyml] Strange system calls when one use Socket.select or OS.IO.poll

2018-12-13 Thread Kostirya
short while. It doesn't use a blocking call or a long time-out because > with multi-threading there's the possibility that another thread might > interrupt it, perhaps as the result of a console interrupt. > > Actually, looking at the code I think it could be improved. I'll have a > lo

Re: [polyml] Segmentation fault on get_stream

2018-12-26 Thread Kostirya
am will be closed. > > Achieving non-persistence is easy as a result of some recent changes. > Garbaging-collecting streams is more difficult. Does anyone actually > rely on streams being garbage-collected? Would doing away with that and > requiring streams to be closed explicitly

Re: [polyml] Strange system calls when one use Socket.select or OS.IO.poll

2018-12-14 Thread Kostirya
hread.interrupt. That will raise Thread.Thread.interrupt in the > "select" calls. To be safe you should probably set the main thread to > use InterruptSynch. > > David > > On 13/12/2018 15:40, Kostirya wrote: > > Thanks. > > > > So will y

[polyml] Segmentation fault on get_stream

2018-12-24 Thread Kostirya
Hello. I got sometimes Segmentation fault. The GDB backtrace of core file is bellow. It is multi thread server. I call Socket.bind and Socket.listen in main thread and then I create worker threads. If server have one worker thread then error is not occur. OS is CentOS, Poly/ML 5.7.2 Testing (Git

Re: [polyml] Segmentation fault on get_stream

2018-12-25 Thread Kostirya
) print b $2 = {contents = {signedInt = 140590188957664, unsignedInt = 140590188957664, objectPtr = 0x7fddb4458fe0, codePtr = 0x7fddb4458fe0 "n\026", stackAddr = 0x7fddb4458fe0}} (gdb) пн, 24 дек. 2018 г. в 18:20, Kostirya : > > Hello. > I got sometimes Segmentation fault.

[polyml] Handle Interrupt exception

2018-12-14 Thread Kostirya
Hello. Do Interrupt exception is special exception? I got warning "Pattern 2 is redundant" for this code: doit () handle Interrupt => NONE | exc => raise exc Why? If one use other exception, then it is all right. Warning is missing. doit () handle Option => NONE | exc => raise exc Nick.

Re: [polyml] Handle Interrupt exception

2018-12-14 Thread Kostirya
t; David > > On 14/12/2018 12:26, Kostirya wrote: > > Hello. > > > > Do Interrupt exception is special exception? > > I got warning "Pattern 2 is redundant" for this code: > > > > doit () handle Interrupt => NONE | exc => raise exc &g

[polyml] ASSERTION FAILURE: 0 at src/x86/ffi64.c:302 when --enable-debug

2019-01-11 Thread Kostirya
Hello. I got FFI error when configure and built poly with --enable-debug *only*: ASSERTION FAILURE: 0 at src/x86/ffi64.c:302 The error happens on Linux and FreeBSD. I use PolyML from git at "Thu Jan 3 14:35:50" date (Linux) and "Fri Jun 22 13:49:32 2018" (FreeBSD): ./configure --with-gmp

[polyml] Memory leak when FFI callback and ref value.

2019-03-14 Thread Kostirya
Hello. I found memory leak when FFI callback and ref value. I checked Poly/ML 5.8 and 5.7. Simple code for reproduce the memory leak is attached. To prevent the memory leak I clean ref value (see comment in example). But It must do the garbage collector, is it? At least MLton have not this

Re: [polyml] 32bits addresses in 64-bit mode and other updates to master

2019-01-24 Thread Kostirya
ble would be helpful. > > Regards, > David > > On 22/01/2019 09:32, Kostirya wrote: > > Hello. > > I got one error with compact32bit on 64bit: > > > > (gdb) bt > > #0 0x821f5400 in ?? () > > #1 0xff9ab2b0 in ?? () > > #2 0x0

[polyml] Non-blocking socket functions called without MSG_DONTWAIT flag

2019-06-19 Thread Kostirya
Hello. I have question. Why Non-blocking socket functions called without MSG_DONTWAIT flag? Nick. ___ polyml mailing list polyml@inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Re: [polyml] Non-blocking socket functions called without MSG_DONTWAIT flag

2019-06-20 Thread Kostirya
ot returning to the > caller until the operation has completed. The reason for this is that > it allows a thread to be interrupted or killed from within the run-time > system. > > David > > On 19/06/2019 11:52, Kostirya wrote: > > Hello. > > I have question. > &g

[polyml] Berkeley DB binding for Standard ML

2019-05-03 Thread Kostirya
Hello. Let me introduce you the Berkeley DB binding for Standard ML (MLton and Poly/ML): https://github.com/kni/sml-bdb Nick. -- Also there are: https://github.com/kni/sml-net-server - Standard ML server engine https://github.com/kni/sml-net-server-ev - asynchronous Standard ML server

[polyml] Poly/ML version 5.8 for 32-bit Windows.

2019-09-02 Thread Kostirya
Hello. Is Poly/ML version 5.8 worked on 32-bit Windows? ___ polyml mailing list polyml@inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Re: [polyml] Char.toString ""

2020-05-21 Thread Kostirya
.toString #"\""; > val c = "\\\"": string > > val c = String.str #"\""; > val c = "\"": string > > > > David > > On 21/05/2020 12:18, Kostirya wrote: > > Hello. > > > >

[polyml] Char.toString ""

2020-05-21 Thread Kostirya
Hello. Is it bug? Poly/ML 5.8 Release > val c = Char.toString #"\""; val c = "\\\"": string > explode c; val it = [#"\\", #"\""]: char list ___ polyml mailing list polyml@inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Re: [polyml] Non-blocking sockets

2020-09-07 Thread Kostirya
Hello. I use epoll (kevent) and Socket.sendVecNB: https://github.com/kni/sml-net-server-ev/blob/3c9dc041e2d46b7ea73f6652435268dd282fc96f/server-stream.sml#L69 val n = valOf (Socket.sendVecNB (#sock stream, data)) handle exc as OS.SysErr (s, SOME e) => let

Re: [polyml] Updates in git master including major change to FFI

2020-10-20 Thread Kostirya
Hello. I cannot build last git version on FreeBSD 32bit: libtool: link: c++ -fPIC -DPIC -shared -nostdlib /usr/lib/crti.o /usr/lib/crtbeginS.o .libs/arb.o .libs/bitmap.o .libs/check_objects.o .libs/diagnostics.o .libs/errors.o .libs/exporter.o .libs/gc.o .libs/gc_check_weak_ref.o

Re: [polyml] Updates in git master including major change to FFI

2020-10-21 Thread Kostirya
rtPoly.sml Unable to create the initial thread - insufficient memory вт, 20 окт. 2020 г. в 20:29, David Matthews : > > On 20/10/2020 13:33, Kostirya wrote: > > Hello. > > I cannot build last git version on FreeBSD 32bit: > > > > libtool: link: c++ -fPIC -DPIC -shared -nostdl

Re: [polyml] Updates in git master including major change to FFI

2020-10-21 Thread Kostirya
ср, 21 окт. 2020 г. в 15:23, David Matthews : > > On 21/10/2020 07:20, Kostirya wrote: > > But now the 3G memory is not enough to build the git version of polyml: > > > > cp ./imports/polymli386.txt polytemp.txt > > ./polyimport polytemp.txt -I . < ./export

Re: [polyml] 5.8.2 Release

2021-05-09 Thread Kostirya
Thank you very much! FFI is very fast now. callback is sometimes even faster than MLton. ср, 5 мая 2021 г. в 15:58, David Matthews : > > The current master has now been released as 5.8.2. There is a > fixes-5.8.2 branch for any bug fixes that are needed. > > The release notes at

[polyml] PolyML and windows

2021-04-09 Thread Kostirya
Hello. I have questions about PolyML and Windows. Can PolyML run in Windows 32-bit? I see than last version PolyML have binary distribution for 64-bit Windows only. Is it possible to compile PolyML for 32-bit Windows with help Clang? Can I make executable files from PolyML for Windows (with