I should have initially posted this to the Pharo-dev list, as well. From: Pharo-users [mailto:[hidden email]] On Behalf Of Shaping All: > Brain Treats got stuck during launch on my LG. > Which android version are you using ? The phone is old and this is likely the problem. Android version: 4.4.2 Kernel version: 3.4.0 > Is there a plan to move PharoJS to Wasm/WASI? > Dave and I talked about it a long time ago. This sounds like a good idea. Actually, Dave has a very ambition idea = turn PharoJS into Pharo* where * can be different targets. But, there's a lot to do before reaching this goal. So, don't expect it any time soon. Not to change the topic too much, but the following is related and I often think of it… Consider writing the pharo VM in Wasm or, better, with Pony (which can emit Wasm, as needed). Pony’s reference-capability-based (ref-cap) concurrency-model guarantees provably that no data-races or deadlocks can happen if the code compiles; this solves a very large class of extremely ugly concurrency problems that no one ever wants to face. Pony gives high-performance concurrency (5 to 15 ns actor-thread switching time, depending on platform), and solves the most difficult class of synchronization problems at compile time. It runs as fast as C. It runs faster than C, as concurrency scales. You can’t scale a highly concurrent app efficiently in C, and really shouldn’t try if you wish to remain happy and mentally healthy. Pony is still pre-1.0, but the group is very active and competent. I think we should consider using it to build the VM. Have a look. Some videos for your amusement and information: https://www.youtube.com/watch?v=ODBd9S1jV2s https://www.youtube.com/watch?v=u1JfYa413fY https://www.youtube.com/watch?v=fNdnr1MUXp8 There are many others. I mentioned the Pony concurrency architecture around the holidays, but there was no interest from the list—not a good time perhaps. The tentative plan is to do what Google does with Flutter: have the JIT in support of the usual dynamicity a Smalltalker needs for rapid development; and have AOT, fully optimized compiling for production or speed-related reality checks, presumably needed less often during development. There are other possibilities. Anyone interested? I have some ideas for simplifying use of the six ref caps in the context of Pharo/Smalltalk. If this path is chosen, one must commit to strict state-machine-based algorithm development, without exception. This should have happened anyway by now, broadly in the programming space, but didn’t. I’m working on a programming graphical tool and associated grammar (in VW) that make state-machine development easy and attractive. This , besides efficient use of machine resources, is the other reason for pushing in this direction. A Pony program is built from a net of asynchronously communicating actors. You change the state of your program with asynchronous messaging between actors. There is no blocking--no mutexes or semaphores—and therefore no wasted CPU cycles or mushrooming program complexity, as you try to use mutexes in a fine-grained way (a very bad idea). And as mentioned, there are never deadlocks or data-races. All cores on all CPUs stay busy, always, until the program goes idle or exits. The Pony group is also working on extending the model to the network level, so that all machine nodes in the network stay busy. In the round, as a start, think of Pony as Erlang/OTP, but much faster, with no legacy bugs, and provably no-deadlocking on compile. The asynchronous actor model is the programming pattern that Kay had in mind when he said “object-oriented.” It’s the one I want to implement in Pharo. The green threads are light, but don’t efficiently use the cores, and a net of VMs with their respective images still communicate too slowly. I your time permits, please study Pony for a bit, before rejecting the idea as too big a change in direction or too complicated. Using Pony looks like the ideal VM simplification strategy, if our aim is efficient use of networks of machines, each with at least one CPU (often more), each, in turn, with many cores (whose numbers are still increasing). This pattern in hardware probably won’t be changing much, now that speeds are topping out. Winning the performance game is therefore about efficiently using many cores at once, without burdening the programmer. I don’t see a better way to do this now than with Pony. Thoughts and suggestions are welcome. Shaping > -----Original Message----- > From: Pharo-users [[hidden email]] On > Behalf Of N. Bouraqadi > Sent: Tuesday, 28 January, 2020 12:18 > To: Any question about pharo is welcome <[hidden email]> > Subject: [Pharo-users] Latest PharoJS Success Story > > The latest PharoJS-powered smartphone app is now live. > Development has been made using Pharo. > Then, javascript code is generated using PharoJS. > Last, the app is built to target both iOS and Android thanks to Apache > Cordova. > > Learn more and Download at > https://nootrix.com/projects/brain-treats-app/ > > Noury > > |
Hi Shaping, I have to admit that that language looks quite interesting, but it is not appropriate for writing an actual VM. One thing is having the actor object model for writing an application that scales where it can be a very desirable property, but another thing is writing a virtual machine where you have time constraints for the just in time compiler in a single CPU to reduce initialization time. In fact, most of the methods are actually interpreted and they are only compiled after being executed several times for reducing this startup time. In this problem domain, the actor model and the thread safeness guaranteed by it does not help you at all, and deadlocks can always be produced. I did have deadlocks problems with synchronous messages in Erlang which forced me to go into using asynchronous messages, but if you do not model your domain state machine you could also end with a deadlock by using asynchronous messages, or even worse, an inconsistent state such as an incomplete credit card transaction in a highly distributed system! You even need to model network and power failures in your state machine. So the programming language may help you a lot with you concurrent, distributed and fault tolerant system programming, but they are not a silver bullet that guarantees that your system is actually going to be correct. Going back to the task of developing a VM, you also need to be able to perform dangerous memory accessing operations for at least the following three tasks: 1. Implementing the garbage collector. 2. Direct access to object slots for implementing the bytecode interpreter. 3. Copying compiled machine code into executable memory and performing position dependent relocations. The machine code generation and installation can be separated in two stage (the current VM just generates the code directly into the executable memory), and in fact having these two separated stages for compilation and installation is a requirement for operating systems that enforce W^X page level permissions, specially if you want a concurrent VM. You need to install the executable code in an atomic way, so you need to suspend the threads while changing the executable permission into the writable permission. You may get away of this restriction if you are allowed to map the same physical memory into different virtual addresses ranges with different permissions (one writeable, and one executable). For these reasons, you need an unsafe language such as C/C++ for at least these tasks, or a language that allows you to turn off the type and memory safeness net. I heard that Rust has an unsafe pointer that you could also for these purposes. The Pharo team is going with the existing virtual machine for quite a while. You cannot just replace something that is not well documented by something new, specially when you do not have that many resources for making a new vm. You first need to document completely the existing one, the semantics of the bytecodes, how they are implemented, and also the same with the primitives. As for myself, I am putting my bets on another language that I am developing (Sysmel: https://github.com/ronsaldo/sysmel ), and in full ahead-of-time compilation, but my problem domain is video game programming, low-level operating system, driver development and embedded programming where I actually want to have control of the machine. Since I have written my compiler in Pharo, I can just reuse the Opal Compiler for doing AST to AST translation and just compile Pharo (with some limitations, for example no thisContext) into my runtime environment. If I want a more dynamic environment, I can also serialize a Pharo CompiledMethod, send it through a socket and then interpret it on the Sysmel side: https://github.com/ronsaldo/sysmel/blob/master/module-sources/Sysmel.Core/Smalltalk-Bootstrap/InterpretedMethod.sysmel by just reusing the existing language semantics. Currently although I am just supporting Linux, and Windows support is coming in a couple of weeks after getting a proper module system working for reducing compilation times. For the backend I am using LLVM, wasm is not yet supported because I am generating some IR that are not supported by the wasm backend (vtable layouts, and some intrinsics that I am using for non-local returns), but they should not be that complicated to fix. Best regards, Ronie El lun., 6 abr. 2020 a las 6:05, Shaping (<[hidden email]>) escribió:
|
Free forum by Nabble | Edit this page |