profile
viewpoint

Pull request review commentSnapchat/djinni

Experimental support for async interface via the future<> generic type

 std::vector<uint8_t> TestHelpers::id_binary(const std::vector<uint8_t> & v) {     return v; } +snapchat::djinni::Future<int32_t> TestHelpers::get_async_result() {+    auto* p = new snapchat::djinni::Promise<int32_t>();+    auto f = p->getFuture();++#if defined(__EMSCRIPTEN__)+    emscripten_async_call([] (void* context) {+        auto* p = reinterpret_cast<snapchat::djinni::Promise<int32_t>*>(context);+        p->setValue(42);+        delete p;+    }, p, 10/*ms*/);+#else+    std::thread t([p] () mutable {+        std::this_thread::sleep_for(std::chrono::milliseconds(10));+        p->setValue(42);+        delete p;+    });+    t.detach();+#endif+    return f;+}++snapchat::djinni::Future<std::string> TestHelpers::future_roundtrip(snapchat::djinni::Future<int32_t> f) {+    return f.then([] (snapchat::djinni::Future<int32_t> f) {+        return std::to_string(f.get());+    });+}++snapchat::djinni::Future<std::string> TestHelpers::check_async_interface(const std::shared_ptr<AsyncInterface> & i) {

there is a testFutureRoundtripWithException test that throws an exception in platform code which will indirectly setException

finalpatch

comment created time in 8 hours

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentSnapchat/djinni

Experimental support for async interface via the future<> generic type

+@extern "../../support-lib/future.yaml"++async_interface = interface +j +o +w {

all the other djinni test interfaces are snake_case

finalpatch

comment created time in 8 hours

push eventSnapchat/djinni

Li Feng

commit sha 06cc2b5d82090469f93cfc4281f83c28e9273c57

Make the C++ promise and future move only

view details

push time in 8 hours

push eventSnapchat/djinni

Li Feng

commit sha 86929cf35114c8246abb90ae9ab91223f94404d1

rerun codegen

view details

push time in 3 days

push eventSnapchat/djinni

Li Feng

commit sha 692477c06da3376050b23650651f5cce0ebadd6e

test fixes

view details

push time in 3 days

PR opened Snapchat/djinni

Experimenmtal support for async interface via the future<> generic type

This adds support for a future<> type to the djinni idl. The future<> djinni type is mapped to the Future type defined in the C++, Java and ObjC djinni support library (also added in this PR). In Javascript, future<> is mapped to the builtin Promise type (and therefore supports the JS await syntax).

The "Future" objects are fulfilled by calling the setValue() method on their associated Promise object (note this is not related to the above mentioned JS Promise type) in C++, Java and ObjC. The Promise/Future API closely resemble the std::experimental::promise/future types defined by the C++ concurrency TS.

+1722 -98

0 comment

59 changed files

pr created time in 3 days

push eventSnapchat/djinni

Li Feng

commit sha 66f6727266c047db47e636b6d710fe357bb5700d

exception path tests

view details

push time in 3 days

push eventSnapchat/djinni

Li Feng

commit sha 3eafeac73e1659c14ad11e6db1ed06c8268824df

more tests

view details

push time in 3 days

push eventSnapchat/djinni

Li Feng

commit sha e5c0a9e9d2eb093679c5cf51d8ce3f60766e65c4

refactor

view details

push time in 4 days

Pull request review commentfinalpatch/ob-glsl

Autocompile / melpa compatibility

+;;; ob-glsl.el --- description pending -*- lexical-binding: t; -*-++(defcustom ob-glsl-make-command "cmake -G \"Ninja\" . && ninja"+  "build command used when compiling ob-glsl"+  :type 'string+  :group 'ob-glsl)+ (require 'ob)++;; setup+(defun ob-glsl-compile ()+  (let ((default-directory (file-name-directory load-file-name)))+	(shell-command ob-glsl-make-command)+	(load-file+	 (concat default-directory+			 (car (directory-files default-directory nil "^ob-glsl-module\\.\\(so\\|dll\\|dylib\\)$"))))+	))+(when (not (featurep 'ob-glsl-module))+  (ob-glsl-compile))

I think in order to minimize the loading latency, we would only want to run the compilation when the dynamic module is not available (or better, check if it is out of date).

Shizcow

comment created time in 6 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentfinalpatch/ob-glsl

Autocompile / melpa compatibility

+;;; ob-glsl.el --- description pending -*- lexical-binding: t; -*-++(defcustom ob-glsl-make-command "cmake -G \"Ninja\" . && ninja"+  "build command used when compiling ob-glsl"+  :type 'string+  :group 'ob-glsl)+ (require 'ob)++;; setup+(defun ob-glsl-compile ()+  (let ((default-directory (file-name-directory load-file-name)))+	(shell-command ob-glsl-make-command)+	(load-file+	 (concat default-directory+			 (car (directory-files default-directory nil "^ob-glsl-module\\.\\(so\\|dll\\|dylib\\)$"))))+	))+(when (not (featurep 'ob-glsl-module))+  (ob-glsl-compile))

Question: does this mean this code will always attempt to compile if the module is not yet loaded, even when it's already compiled and available?

Shizcow

comment created time in 6 days

PullRequestReviewEvent

Pull request review commentfinalpatch/ob-glsl

Autocompile / melpa compatibility

+;;; ob-glsl.el --- description pending -*- lexical-binding: t; -*-++(defcustom ob-glsl-make-command "cmake -G \"Ninja\" . && ninja"+  "build command used when compiling ob-glsl"+  :type 'string+  :group 'ob-glsl)+ (require 'ob)++;; setup+(defun ob-glsl-compile ()+  (let ((default-directory (file-name-directory load-file-name)))+	(shell-command ob-glsl-make-command)+	(load-file+	 (concat default-directory+			 (car (directory-files default-directory nil "^ob-glsl-module\\.\\(so\\|dll\\)$"))))
			 (car (directory-files default-directory nil "^ob-glsl-module\\.\\(so\\|dll\\|dylib\\)$"))))
Shizcow

comment created time in 6 days

issue closedfinalpatch/ob-glsl

build failure "Main.cpp:92:14: error: expected type-specifier"

rob@oven:~/src/ob-glsl$ ninja
[1/2] Building CXX object CMakeFiles/ob-glsl-module.dir/Main.cpp.o
FAILED: CMakeFiles/ob-glsl-module.dir/Main.cpp.o 
/usr/bin/c++  -Dob_glsl_module_EXPORTS -I/usr/local/include -fPIC   -std=gnu++17 -MD -MT CMakeFiles/ob-glsl-module.dir/Main.cpp.o -MF CMakeFiles/ob-glsl-module.dir/Main.cpp.o.d -o CMakeFiles/ob-glsl-module.dir/Main.cpp.o -c Main.cpp
Main.cpp:92:14: error: expected type-specifier
     operator glbinding::GetProcAddress() const {return nullptr;}
              ^~~~~~~~~
ninja: build stopped: subcommand failed.
rob@oven:~/src/ob-glsl$ 

closed time in 6 days

biffhero

issue commentfinalpatch/ob-glsl

build failure "Main.cpp:92:14: error: expected type-specifier"

You are probably using glbindings version 2.x. The initialize function in glbinding was changed in version 3.x with an addition parameter. I tried to make the code compile cleanly with both version 2 and 3 but apparently it doesn't work very well. So I just removed the unsuccessful workaround and now it should compile, but there will be a warning with version 2.

biffhero

comment created time in 6 days

push eventfinalpatch/ob-glsl

Li Feng

commit sha 65148e0596a17e342646e8d1bac465e0ca7f31d0

init fix

view details

push time in 6 days

Pull request review commentfinalpatch/ob-glsl

Autocompile / melpa compatibility

+;;; ob-glsl.el --- description pending -*- lexical-binding: t; -*-++(defcustom ob-glsl-make-command "cmake -G \"Ninja\" . && ninja"+  "build command used when compiling ob-glsl"+  :type 'string+  :group 'ob-glsl)+ (require 'ob)++;; setup+(defun ob-glsl-compile ()+  (let ((default-directory (file-name-directory load-file-name)))+	(shell-command ob-glsl-make-command)+	(load-file+	 (concat default-directory+			 (car (directory-files default-directory nil "^ob-glsl-module\\.\\(so\\|dll\\)$"))))

I fixed the README file.

Shizcow

comment created time in 6 days

PullRequestReviewEvent

push eventfinalpatch/ob-glsl

Li Feng

commit sha 3635283f8697ebdc1984da699b737e4de0ebf32c

doc fix

view details

push time in 6 days

push eventSnapchat/djinni

Li Feng

commit sha 4de0bf4d045cbe67f92092b2b1df3e33b5fd5c6f

namespace fix

view details

push time in 7 days

push eventSnapchat/djinni

Li Feng

commit sha 79a1002d71b39aa83491dd4f74cec95859c9ee19

rename

view details

Li Feng

commit sha f996aff89ab8a056897f93774b15042200f240a5

yaml

view details

push time in 7 days

PullRequestReviewEvent

Pull request review commentfinalpatch/ob-glsl

Autocompile / melpa compatibility

+;;; ob-glsl.el --- description pending -*- lexical-binding: t; -*-++(defcustom ob-glsl-make-command "cmake -G \"Ninja\" . && ninja"+  "build command used when compiling ob-glsl"+  :type 'string+  :group 'ob-glsl)+ (require 'ob)++;; setup+(defun ob-glsl-compile ()+  (let ((default-directory (file-name-directory load-file-name)))+	(shell-command ob-glsl-make-command)+	(load-file+	 (concat default-directory+			 (car (directory-files default-directory nil "^ob-glsl-module\\.\\(so\\|dll\\)$"))))

on macos the file extension is "dylib"

Shizcow

comment created time in 8 days

PullRequestReviewEvent

pull request commentfinalpatch/ob-glsl

Autocompile / melpa compatibility

Thanks. I'll look into this when I have some free time.

Shizcow

comment created time in 8 days

issue closedSnapchat/djinni

Cannot build tests at HEAD (c481172185)

Hey folks! I'm very excited that you have taken over djinni as we use it extensively at Butterfly. I have an internal patch that isn't in the Dropbox project (after it was archived) and I'd like to share it with the community. I tried running the tests and they are not building for me currently. I'm also super excited you are using Bazel, we have adopted it as well. Is there anything missing from the README or WORKSPACE that would prevent me from running the tests / causing this error?

jgavris in ~/code/djinni on (HEAD detached at snap/master)
λ git remote -v
origin	git@github.com:ButterflyNetwork/djinni.git (fetch)
origin	git@github.com:ButterflyNetwork/djinni.git (push)
snap	https://github.com/Snapchat/djinni.git (fetch)
snap	https://github.com/Snapchat/djinni.git (push)
jgavris in ~/code/djinni on (HEAD detached at snap/master)
λ git show --stat
commit c48117218536e947d26beb30ddbcab4ac7136eb4 (HEAD, snap/master, record-initializers)
Author: finalpatch <fengli@gmail.com>
Date:   Wed Nov 10 12:19:59 2021 +1100

    Assert with an error message instead of silently return empty object (#26)

    Co-authored-by: Li Feng <li.feng@snapchat.com>

 support-lib/wasm/djinni_wasm.hpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
jgavris in ~/code/djinni on (HEAD detached at snap/master)
λ bazel test //test-suite:all
INFO: Analyzed 14 targets (0 packages loaded, 0 targets configured).
INFO: Found 12 targets and 2 test targets...
ERROR: /Users/jgavris/code/djinni/test-suite/BUILD:153:10: Compiling test-suite/generated-src/wasm/NativeConstantInterfaceWithEnum.cpp failed: (Aborted): wrapped_clang failed: error executing command external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG '-std=c++11' ... (remaining 72 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from test-suite/generated-src/wasm/NativeConstantInterfaceWithEnum.cpp:4:
In file included from test-suite/generated-src/wasm/NativeConstantInterfaceWithEnum.hpp:7:
support-lib/wasm/djinni_wasm.hpp:19:10: fatal error: 'emscripten.h' file not found
#include <emscripten.h>
         ^~~~~~~~~~~~~~
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
INFO: Elapsed time: 2.509s, Critical Path: 2.19s
INFO: 17 processes: 17 internal.
FAILED: Build did NOT complete successfully
//test-suite:djinni-java-tests                                  (cached) PASSED in 2.7s
//test-suite:djinni-objc-tests                                  (cached) PASSED in 14.9s

Executed 0 out of 2 tests: 2 tests pass.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
All tests passed but there were other errors during the build.
FAILED: Build did NOT complete successfully

closed time in 11 days

jgavris
more