Does anyone know of any attempts to get pypy running in the browser?
I ask because pypy can target llvm, and there are currently two ways to run llvm in the browser: pnacl and emscripten.
No attempts AFAIK. But PyPy in the browser would be great. We could compile the PyPy C++ code into JavaScript using Emscripten, and implement a JIT into JS in PyPy (which gets translated into JS, but more importantly emits JS). That could be very fast actually, since hot code would end up being JITed into JS which is then JITed by the JS VM.
I raised this idea on hacker news, programming.reddit, etc. several times, hoping to interest a PyPy dev to collaborate on it. So far no luck but hopefully that can happen some day.
Considering that PNaCl bitcode is LLVM based is seems that the problem is just to get RPython produce correct bits, but it seems like LLVM doesn't allow to modify bitcode at run-time, so the PyPy JIT won't work.
Related
I am an artist and would like to have access to Monster Mash (https://github.com/google/monster-mash) even if I can't access the web version due to connectivity issues. As such I would like a desktp version, from what I have read on the github page I would just have to compile the code, but I have no idea how I would go about doing this on a windows machine as I am having trouble with downloading or setting up clang or gcc to begin with (Is gcc only for use on Linux). The Linux approach seems much simpler and is (to my eyes) better explained on the github page, so as a side question, I would like to know if I can compile the program in linux for use on windows? thank you so much for any help.
Currently I'm coding a python script to compile a C/C++ Linux kernel in the following way:
subprocess.check_call(["make", "-j5"])
subprocess.check_call(["make", "-j5", "modules_install"])
subprocess.check_call(["make", "-j5", "install"])
With these approach the commands are executed in the shell. So I was wondering if there is another way to compile the kernel using python build in libraries?
Ultimately, python isn't a C/C++ compiler, so you need to ship out the compiling to an external program (e.g. gcc). So, there is no way to do this entirely in python.
Note that here python doesn't spawn any shells (although make might). You could try to reproduce what make does entirely in python, (there is a version of make written in python FWIW), but honestly, it's not worth it. You need to spawn subprocesses anyway -- you might as well use the tools which are already in place and "tried and true".
I'm currently working in a pet programming language (for learning purposes), and have gone through a lot of research over the past year, and I think its time to finally start modelling the concepts of such a languague. First of all I want it to compile to some intermediate form, such as JVM or .NET bytecode, the goal being multiplatform/architecture compatibily. Second, I want it to be fast (I also have many other things in mind, but its not the purpose of this topic to discuss those).
The best options that came to my mind were:
Compile to JVM bytecode and use OpenJDK as runtime environment,
Compile to .NET bytecode and use Mono as runtime environment,
Compile to LLVM IR and use LLVM as runtime environment.
As you may have imagined, I've chosen LLVM. Why? because its blazing fast. I did a little benchmark using the C++ N-Body code, and achieved 7s in my machine with lli jitted IR, in contrast with 27s with clang native compiled code (I know clang first make IR then machine code).
So, here is my question: Is there any redistributable version of the LLVM basic toolset (I just need lli) that I can use? Or I must compile my own? If the latter, can you provide me with any hints on how to do it? If I really must do it, I'm thinking is cross-compiling them from my machine (Intel Mac), and generating some installers (say, an .msi for windows, .rpm and .deb for popular linux distros and .pkg for Macs). Remember, I only need a minimal subset of LLVM, such that this subset is capable of acting like a VM, by using "lli ". The real question here is how to use LLVM as a typical virtual machine.
First, I think all 3 options - LLVM IR + LLVM, Java Bytecode + OpenJDK, and .NET CIL + Mono - are excellent options, and I agree deciding between them is not easy.
If you go for LLVM and you just want to use lli, you can compile LLVM to your target platform and pack the resulting lli executable with your distribution, it should work.
Another way to write a JIT compiler via LLVM is to use an execution engine - see the handy examples in the Kaleidoscope tutorial. That means that you write your own program which will JIT-compile your own language, compile it to whatever platform you want while statically linking it with LLVM, and then distribute it.
In any case, since a JIT compiler requires copying an LLVM binary to the client side, make sure to attach a copyright notice with your distribution (you don't have to open-source your distribution, though).
I have been developing a C++ application to run on a 64 bit Ubuntu 12.04. I develop the code on my 32 bit 12.04 Ubuntu laptop, then upload it to a git repository, pull it on the server and build the pulled source natively.
Until recently things worked well and I had no problems but today g++ 4.6.3 crashed when I tried to compile on the 64 bit server and I got an output telling me to submit a crash report (g++ 4.6.3 is the same version I have on my development machine also). The identical code did not cause a crash on my dev machine.
I am not asking why it crashed, but I would like to know what the problem was if possible. Does g++ produce any file logs when it encounters problems?
As far as I can tell my code is doing nothing controversial, I am not creating templates, I simply use a couple of boost libraries, mysql++, openssl and some static libraries I have written myself.
I really need to run this application every day so I want to fix this as soon as I can. I can think of the following ways to deal with things
Try and find out what aspect of my code caused the compiler to crash and rewrite my code accordingly.
Rent another server.
Upgrade (or downgrade) g++ or create an additional g++ on the server and try that. I am reluctant to do this as I have read that you can ruin your system when upgrading g++ on Ubuntu.
I use Eclipse to build everything on my dev machine and simply build code on my server using the Eclipse generated makefile that I have made part of the git project - I could write my own makefile in case something in there is causing the crash on the 64 bit server.
I would really welcome advice on how to proceed. I am not an expert on how compilers work internally and this is the first time I have encountered this kind of error so I am not quite sure what to do next.
I would really welcome advice on how to proceed
One reason for a crash might be hardware problem (faulty disk, disk controller, memory, or something else). This is hard to detect.
Another reason might be a compiler bug, but very unlikely.
What you can do is :
check the hardware of the server (run all possible checks you can think of). Try to compile many times on a different machine
make sure your system is not running out of virtual memory
upgrade or change the compiler, and see if it happens
There are various article explaining that g++ can crash because of HW problems :
crash during compiling - Most likely there is nothing wrong with your installation, your compiler or kernel. It very likely has something to do with your hardware. There are two exceptions to this "rule". You could be running low on virtual memory, or you could be installing Red Hat 5.x, 6.x or 7.x
crash during optimization
Have you ever heard about a script able to make the g++ error messages more readable?
I am pretty sure I heard about it some times ago but I can't remember the name.
Thank you.
You might be thinking of STLFilt, which supports a variety of C++ compilers but is no longer being developed and doesn't guarantee to work with the latest versions of g++.
You're probably not talking about this, but there is colorgcc, which does make it more readable.
if you like Ruby there is GilCC! It is very easy to install and use. Unlike Perl based scripts GilCC has statistics such as # of warnings and error and compile time. You don't have to mess with .bash files and it is cross platform as long as you can run Ruby on your machine. Since it is Ruby you can make it do different things such as trigger test automation, unit test or program external hardware.
Here is the link to the download page: http://www.onlysolutionssoftware.com/gilcc/
I would like to add that GilCC works with any GCC version. A lot of projects out there are limited to specific versions of GCC and because GilCC does not touch GCC or its settings, you are safe.
If it's about the messages themselves (and not how to e.g. color them) I remember that in another, similar question (which I can't find at the moment) it was suggested to use LLVM/Clang instead of GCC as it has better error messages.