Open
Bug 757804
Opened 13 years ago
Updated 2 years ago
Investigate reimplementing some of ctypes in JavaScript
Categories
(Core :: js-ctypes, enhancement)
Core
js-ctypes
Tracking
()
NEW
People
(Reporter: Yoric, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
4.40 KB,
application/x-javascript
|
Details |
I have the impression that a sizeable chunk of CTypes.cpp could be ported to JavaScript. More precisely, I have the gut feeling that pretty much only the following cannot be ported to pure JS: - finalizations; - actual function calls through libffi; - constants and size of a few types. If we can indeed port a chunk of CTypes.cpp to JS, this bring the following gains: - finer error reporting, with the ability to refine it further; - better JIT-ability; - easier to extend and to attract contributors.
Reporter | ||
Comment 1•13 years ago
|
||
This looks like a good internship project, btw.
Reporter | ||
Comment 2•13 years ago
|
||
Attaching 20 minutes of work on the topic. I have the impression that we can do at least most of CType/CData in JavaScript. If there is any interest, I can try and continue work on the topic as a background task.
Attachment #626822 -
Flags: feedback?(jorendorff)
Attachment #626822 -
Flags: feedback?(dwitte)
Reporter | ||
Comment 3•13 years ago
|
||
I have opened a github project for this experiment: https://github.com/Yoric/js-js-ctypes .
Reporter | ||
Comment 4•13 years ago
|
||
I have made some progress on this experiment. This seems to confirm that most/all of CType/CData can be written in JS, with two C-based operations implementing & and *. I believe that both operations could be trivially JIT-ed. Now, the interesting part is that the code for conversion of data from/to C, with the exception of strings, is pure JavaScript, hence can be JIT-ed without any change to the JIT. Also, this code is, for the moment, more readable than CTypes.cpp, which is a gain. I will post further updates as they arrive.
Updated•12 years ago
|
Attachment #626822 -
Flags: feedback?(jorendorff)
Reporter | ||
Comment 5•12 years ago
|
||
Taras, given that I have some time waiting for reviews, do you want me to take a further look at this bug? Given the measurements on bug 873307, I suspect that this could help improve performance of js-ctypes calls.
Flags: needinfo?(taras.mozilla)
Comment 6•12 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #5) > Taras, given that I have some time waiting for reviews, do you want me to > take a further look at this bug? Given the measurements on bug 873307, I > suspect that this could help improve performance of js-ctypes calls. No. I think working on zero-copying strings/objects to workers is higher priority. I think you should help with that instead.
Flags: needinfo?(taras.mozilla)
Comment 7•11 years ago
|
||
Comment on attachment 626822 [details]
First draft of something
Clearing stale request, sorry -- I'm sure there are better qualified people to look at this if you're still interested in pursuing it :)
Attachment #626822 -
Flags: feedback?(dwitte)
Reporter | ||
Updated•11 years ago
|
Depends on: harmony:typedobjects
Comment 8•11 years ago
|
||
This looks very interesting! (In reply to David Rajchenbach Teller [:Yoric] (please use "needinfo?") from comment #3) > I have opened a github project for this experiment: > https://github.com/Yoric/js-js-ctypes . I understand the code, but I think I need more time to understand how the code in C++ library maps to the JS you wrote. Lets talk about this on IRC? I can do this for my project this semester :)
Flags: needinfo?(dteller)
Reporter | ||
Comment 9•11 years ago
|
||
Actually, all of this will be much easier once bug 578700 has landed, so we should wait for that.
Flags: needinfo?(dteller)
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•