Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asys #8817

Closed
Closed

asys #8817

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
bec9818
libuv stubs, most fs functions
Aurel300 Jul 18, 2019
d68cb64
stat
Aurel300 Jul 18, 2019
b5ab085
fix linking
Aurel300 Jul 18, 2019
7929a23
initial eval code (FileSystem.exists)
Aurel300 Jul 18, 2019
0d81028
first async function, callbacks into Haxe
Aurel300 Jul 19, 2019
05aae0e
improve error handling, more fs work
Aurel300 Jul 22, 2019
eb2d506
report positions in errors
Aurel300 Jul 23, 2019
9af1f9e
less segfaulting, fs watchers, some cleanup and docs
Aurel300 Jul 24, 2019
b4d94d5
more cleanup and docs
Aurel300 Jul 24, 2019
61741df
move uv constants out, simplify stat
Aurel300 Jul 24, 2019
03018ce
close handles properly
Aurel300 Jul 25, 2019
f779f6f
tcp work
Aurel300 Jul 26, 2019
c0f2eb2
TCP, DNS, timers
Aurel300 Aug 6, 2019
3786432
socket options, fix connect
Aurel300 Aug 6, 2019
8ab1bc8
return DNS and scandir results in correct order
Aurel300 Aug 7, 2019
141c67f
unref timers
Aurel300 Aug 7, 2019
cb66ce2
async file operations
Aurel300 Aug 8, 2019
d1f08dc
TCP get(sock|peer)name
Aurel300 Aug 9, 2019
150d11c
read/write -> readBuffer/writeBuffer
Aurel300 Aug 12, 2019
7b379ec
udp stubs
Aurel300 Aug 12, 2019
b211f6b
UDP
Aurel300 Aug 13, 2019
3fded3b
allow run with any mode
Aurel300 Aug 15, 2019
3a0bbea
process stubs
Aurel300 Aug 15, 2019
4e1d1fd
process stdlib
Aurel300 Aug 15, 2019
ede92a0
ref, unref, less code that just casts handles
Aurel300 Aug 16, 2019
4dc047c
pipes
Aurel300 Aug 19, 2019
b7591e7
process close
Aurel300 Aug 19, 2019
2c26275
better pipes and streams
Aurel300 Aug 20, 2019
25e842b
get IPC name
Aurel300 Aug 20, 2019
66beabc
ref/unref UDP sockets
Aurel300 Aug 20, 2019
211e6ee
pass handles via pipes
Aurel300 Aug 21, 2019
4782ace
move to asys package
Aurel300 Sep 9, 2019
0d8bf4a
minor fixes
Aurel300 Sep 16, 2019
6a24d1b
fix dune
Aurel300 Sep 16, 2019
16306c1
macros for allocating/freeing requests
Aurel300 Sep 16, 2019
4da20b8
Merge branch 'development' into feature/eval-libuv
Simn Sep 18, 2019
842dc16
[ci] setup Windows
Simn Sep 19, 2019
61b33de
Merge branch 'development' into feature/eval-libuv
Simn Sep 19, 2019
9f9e810
bring back Sys inclusion hack
Simn Sep 19, 2019
db0d9a0
womp womp
Simn Sep 19, 2019
831123c
fix Std.hx
Simn Sep 19, 2019
6678277
[ci] setup Linux and OS X
Simn Sep 19, 2019
6809c38
[std] add missing get_message
Simn Sep 19, 2019
de2b204
add asys Haxe APIs, asys test suite
Aurel300 Sep 19, 2019
0051e49
minor stubs changes
Aurel300 Sep 19, 2019
6b8a04a
Merge branch 'feature/eval-libuv' of github.com:Aurel300/haxe into fe…
Aurel300 Sep 19, 2019
d33b27c
some test setup fixes
Aurel300 Sep 19, 2019
a229959
fix xmldoc
Aurel300 Sep 19, 2019
a392e9e
skip some tests on Windows
Aurel300 Sep 19, 2019
c4ee323
(revert later) skip docgen
Aurel300 Sep 19, 2019
df401d8
[ci] enable win32 macro tests again
Simn Sep 19, 2019
ef3cdc7
(revert later) ughh
Aurel300 Sep 19, 2019
51b5ecf
don't leave access.txt in read-only so we can clean up
Simn Sep 20, 2019
94755ee
Merge branch 'development' into feature/eval-libuv
Simn Sep 20, 2019
c1e5290
start on dealing with flag values
Simn Sep 20, 2019
3cdbcdf
disable test that's probably invalid on Windows
Simn Sep 20, 2019
ba637ea
adjust tests to windows limitations
Simn Sep 20, 2019
7408547
[ci] install libuv manually on Linux
Aurel300 Sep 20, 2019
d065543
maybe fix Linux ci
Aurel300 Sep 20, 2019
bd97e56
sudo make ci work
Aurel300 Sep 20, 2019
27db9e6
disable watcher test on Linux
Aurel300 Sep 20, 2019
2d54ddc
error code docstrings
Aurel300 Sep 20, 2019
7a8ab7d
(eval) add lchown and copyfile
Aurel300 Sep 20, 2019
4d0270f
no callback on process_kill
Aurel300 Sep 20, 2019
3e5919d
use 32-bit ints for IPv4
Aurel300 Sep 20, 2019
5dbfef6
[libuv] prepare libuv integration
Simn Sep 20, 2019
56ad076
[ci] bring back docgen
Simn Sep 20, 2019
c047d43
...
Simn Sep 20, 2019
4f6d9a5
avoid dll problem
Simn Sep 20, 2019
d3ede31
no target is asys yet
Simn Sep 20, 2019
7b39cf4
cleanup
Simn Sep 20, 2019
3a3ce68
fix pointer warnings
Simn Sep 21, 2019
18f98b5
check for libuv >= 1.31
Simn Sep 21, 2019
1a17c34
close file in FileSystem.writeFile
Simn Sep 21, 2019
1dfb708
add asys define, forbid asys package on all targets for now
Aurel300 Sep 20, 2019
5b1acbc
eval is asys here
Simn Sep 22, 2019
3fa47f5
merge asys.Timer into haxe.Timer
Simn Sep 22, 2019
ba4aae7
run Uv.init/close just once in the asys tests
Simn Sep 22, 2019
0fdd3e8
hijack haxe.EntryPoint to deal with UV initialization
Simn Sep 22, 2019
f03ff69
fix FileWatcherEvent and adjust test
Simn Sep 22, 2019
7cfbb83
use distinct directory per-test
Simn Sep 22, 2019
c67ed00
fix tests
Simn Sep 22, 2019
552e238
don't unlink
Simn Sep 22, 2019
896eba7
remove more random cleanup code
Simn Sep 22, 2019
bd0c345
simplify alloc_data
Aurel300 Sep 23, 2019
2e2f16c
Merge branch 'development' into feature/libuv-prepare
Simn Sep 23, 2019
1a10736
Merge branch 'feature/libuv-prepare' into feature/eval-libuv
Simn Sep 23, 2019
9e53d3c
port server tests to asys
Simn Sep 23, 2019
e8989ae
disable wonky watcher test for now
Simn Sep 23, 2019
f52b2d7
fix haxeserver branch
Simn Sep 23, 2019
5ea451c
check something
Simn Sep 23, 2019
715f8ef
disable unused include
Simn Sep 24, 2019
99a6663
move UV.init to asys.uv.Uv.__init__
Simn Sep 24, 2019
49a40f0
remove imports
Simn Sep 24, 2019
fa74d66
add mutex and TLS externs
Simn Sep 24, 2019
7cd7425
don't allocate so much
Simn Sep 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions libs/uv/uv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,24 @@ external pipe_accept_pending : t_loop -> t_pipe -> pipe_accepted uv_result = "w_
external pipe_getsockname : t_pipe -> string uv_result = "w_pipe_getsockname"
external pipe_getpeername : t_pipe -> string uv_result = "w_pipe_getpeername"

(* ------------- MUTEXES ---------------------------------------------- *)

type t_mutex

external mutex_init : unit -> t_mutex uv_result = "w_mutex_init"
external mutex_lock : t_mutex -> unit = "w_mutex_lock"
external mutex_trylock : t_mutex -> unit uv_result = "w_mutex_trylock"
external mutex_unlock : t_mutex -> unit = "w_mutex_unlock"

(* ------------- TLS ---------------------------------------------- *)

type t_key

external key_create : unit -> t_key uv_result = "w_key_create"
external key_delete : t_key -> unit = "w_key_delete"
external key_get : t_key -> 'a = "w_key_get"
external key_set : t_key -> 'a -> unit = "w_key_set"

(* ------------- HAXE ---------------------------------------------- *)

external get_file_open_flags : unit -> (string * int) array = "hx_get_file_open_flags"
Expand Down
60 changes: 60 additions & 0 deletions libs/uv/uv_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
#define Handle_val(v) UV_UNWRAP(v, uv_handle_t)
#define Loop_val(v) UV_UNWRAP(v, uv_loop_t)
#define Pipe_val(v) UV_UNWRAP(v, uv_pipe_t)
#define Mutex_val(v) UV_UNWRAP(v, uv_mutex_t)
#define Key_val(v) UV_UNWRAP(v, uv_key_t)
#define Process_val(v) UV_UNWRAP(v, uv_process_t)
#define Shutdown_val(v) UV_UNWRAP(v, uv_shutdown_t)
#define Stream_val(v) UV_UNWRAP(v, uv_stream_t)
Expand Down Expand Up @@ -1230,6 +1232,64 @@ CAMLprim value w_pipe_write_handle(value handle, value data, value send_handle,
UV_SUCCESS_UNIT;
}

// ------------- MUTEXES -----------------------------------------------
Aurel300 marked this conversation as resolved.
Show resolved Hide resolved

CAMLprim value w_mutex_init(value unit) {
CAMLparam1(unit);
UV_ALLOC_CHECK(handle, uv_mutex_t);
UV_ERROR_CHECK_C(uv_mutex_init(Mutex_val(handle)), free(Mutex_val(handle)));
if ((UV_HANDLE_DATA(Mutex_val(handle)) = alloc_data()) == NULL)
Aurel300 marked this conversation as resolved.
Show resolved Hide resolved
UV_ERROR(0);
UV_SUCCESS(handle);
}

CAMLprim value w_mutex_lock(value handle) {
CAMLparam1(handle);
uv_mutex_lock(Mutex_val(handle));
UV_SUCCESS_UNIT;
}

CAMLprim value w_mutex_trylock(value handle) {
CAMLparam1(handle);
UV_ERROR_CHECK(uv_mutex_trylock(Mutex_val(handle)));
UV_SUCCESS_UNIT;
}

CAMLprim value w_mutex_unlock(value handle) {
CAMLparam1(handle);
uv_mutex_unlock(Mutex_val(handle));
UV_SUCCESS_UNIT;
}

// ------------- TLS -----------------------------------------------

CAMLprim value w_key_create(value unit) {
CAMLparam1(unit);
UV_ALLOC_CHECK(handle, uv_key_t);
UV_ERROR_CHECK_C(uv_key_create(Key_val(handle)), free(Key_val(handle)));
if ((UV_HANDLE_DATA(Key_val(handle)) = alloc_data()) == NULL)
UV_ERROR(0);
UV_SUCCESS(handle);
}

CAMLprim value w_key_delete(value handle) {
CAMLparam1(handle);
uv_key_delete(Key_val(handle));
UV_SUCCESS_UNIT;
}

CAMLprim value w_key_get(value handle) {
CAMLparam1(handle);
void* r = uv_key_get(Key_val(handle));
UV_SUCCESS(r);
}

CAMLprim value w_key_set(value handle, value v) {
CAMLparam1(handle);
uv_key_set(Key_val(handle), &v);
UV_SUCCESS_UNIT;
}

// ------------- GLUE -----------------------------------------------

static value build_fields(int num_fields, const char* names[], int values[]) {
Expand Down