better multimodules support for Rust backend

This commit is contained in:
vms 2019-08-14 18:10:37 +03:00
parent dd26c69a7e
commit 04ca05d719
2 changed files with 21 additions and 1 deletions

View File

@ -4,7 +4,7 @@ SYSROOT = /opt/wasi-sdk/share/wasi-sysroot
TARGET_TRIPLE = wasm32-unknown-wasi
CFLAGS = -nostartfiles -fvisibility=hidden
LDFLAGS = -Wl,--no-entry,--demangle,--allow-undefined
EXPORT_FUNCS = --export=allocate,--export=deallocate,--export=invoke,--export=load,--export=store
EXPORT_FUNCS = --export=allocate,--export=deallocate,--export=invoke,--export=load,--export=store,--export=redis_allocate,--export=redis_deallocate,--export=redis_invoke,--export=redis_load,--export=redis_store
WRAPPER_SRC = wrapper.c
LUA =/code/deps/lua/src
REDIS_SERVER = adlist.c quicklist.c debug.c dict.c server.c sds.c zmalloc.c lzf_c.c lzf_d.c pqsort.c zipmap.c sha1.c ziplist.c release.c networking.c util.c object.c db.c t_string.c t_list.c t_set.c t_zset.c t_hash.c multi.c sort.c intset.c crc16.c endianconv.c slowlog.c scripting.c rand.c crc64.c bitops.c notify.c hyperloglog.c latency.c sparkline.c geo.c evict.c expire.c geohash.c geohash_helper.c defrag.c siphash.c rax.c t_stream.c listpack.c lolwut.c lolwut5.c ../deps/lua/src/*.c

View File

@ -21,18 +21,34 @@ void* allocate(size_t size) {
return zmalloc(size + 1);
}
void* redis_allocate(size_t size) {
return allocate(size);
}
void deallocate(void *ptr, int size) {
zfree(ptr);
}
void redis_deallocate(void *ptr, int size) {
deallocate(ptr, size);
}
void store(char *ptr, unsigned char byte) {
*ptr = byte;
}
void redis_store(char *ptr, unsigned char byte) {
store(ptr, byte);
}
unsigned char load(const unsigned char *ptr) {
return *ptr;
}
unsigned char redis_load(const unsigned char *ptr) {
return load(ptr);
}
// Cleans client output buffers to - client is blocked and
// doesn't receive requests until output buffer isn't empty.
void clean_client_buffer(client *c) {
@ -129,3 +145,7 @@ const char *invoke(char *request, int request_size) {
return response;
}
const char *redis_invoke(char *request, int request_size) {
return invoke(request, request_size);
}