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

Congrats #3

Open
dibyendumajumdar opened this issue Apr 14, 2023 · 5 comments
Open

Congrats #3

dibyendumajumdar opened this issue Apr 14, 2023 · 5 comments

Comments

@dibyendumajumdar
Copy link

Several years ago I tried to extract B3 from webkit but gave up on it as it seemed to have some dependencies on JS side of things.
Looks like you succeeded in pulling it out - which is a great achievement!

@playXE
Copy link
Owner

playXE commented Apr 14, 2023

Thanks! It does not have any dependencies on JS side actually, the only problem is that some parts of jit/ module under JSC do have JS dependencies but they are not "must have" things, you can get rid of them if you're not making a JS engine. And another thing is WTF library that is huge, I had to precisely remove usage of code that can be replaced with Rust or otherwise port code from WTF.

@playXE
Copy link
Owner

playXE commented Apr 14, 2023

Another problem was rewriting it to work with Rust. :) In original code they use poitners everywhere, I had to convert stuff to be stored in array instead and on client side have *Id structs like ValueId that do index into storage, it makes API a little bit uncomfortable compared to original tho

@dibyendumajumdar
Copy link
Author

I would have personally left it as C++ so you can easily merge upstream changes.

@playXE
Copy link
Owner

playXE commented Apr 15, 2023

Then making Rust bindings would be extremely hard, they have very non easy API for bindings to C, my main problem was also bindings to C, not only hard to extract from WebKit.

For example they have a few opcodes that accept C++ function, I had a problem on how to concert that to C function with data pointer and then also convert Rust closures to that.

UPD: I could try to make C bindings for it if you need one : )

@dibyendumajumdar
Copy link
Author

I gave up on trying to use low level Jit Apis , I now generate C code and use MIR to compile. For my purpose MIR is a good compromise as it's very small but still generates reasonable quality code.

I guess most important thing for your project is to have extensive tests and documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants