|
| 1 | +# MJIT |
| 2 | + |
| 3 | +This document has some tips that might be useful when you work on MJIT. |
| 4 | + |
| 5 | +## Supported platforms |
| 6 | + |
| 7 | +The following platforms are either tested on CI or assumed to work. |
| 8 | + |
| 9 | +* OS: Linux, macOS |
| 10 | +* Arch: x86\_64, aarch64, arm64, i686, i386 |
| 11 | + |
| 12 | +### Not supported |
| 13 | + |
| 14 | +The MJIT support for the following platforms is no longer maintained. |
| 15 | + |
| 16 | +* OS: Windows (mswin, MinGW), Solaris |
| 17 | +* Arch: SPARC |
| 18 | + |
| 19 | +### Architectures |
| 20 | + |
| 21 | +## Bindgen |
| 22 | + |
| 23 | +If you see an "MJIT bindgen" GitHub Actions failure, please commit the `git diff` shown on the failed job. |
| 24 | + |
| 25 | +Refer to the following instructions for doing the same thing locally. |
| 26 | +Similar to `make yjit-bindgen`, `make mjit-bindgen` requires libclang. |
| 27 | +See also: [mjit-bindgen.yml](../.github/workflows/mjit-bindgen.yml) |
| 28 | + |
| 29 | +macOS seems to have libclang by default, but I'm not sure how to deal with 32bit architectures. |
| 30 | +For now, you may generate c\_64.rb with a 64bit binary, and then manually modify c\_32.rb accordingly. |
| 31 | + |
| 32 | +### x86\_64-linux |
| 33 | + |
| 34 | +```sh |
| 35 | +sudo apt install \ |
| 36 | + build-essential \ |
| 37 | + libssl-dev libyaml-dev libreadline6-dev \ |
| 38 | + zlib1g-dev libncurses5-dev libffi-dev \ |
| 39 | + libclang1 |
| 40 | +./autogen.sh |
| 41 | +./configure --enable-yjit=dev_nodebug --disable-install-doc |
| 42 | +make -j |
| 43 | +make mjit-bindgen |
| 44 | +``` |
| 45 | + |
| 46 | +### i686-linux |
| 47 | + |
| 48 | +```sh |
| 49 | +sudo dpkg --add-architecture i386 |
| 50 | +sudo apt install \ |
| 51 | + crossbuild-essential:i386 \ |
| 52 | + libssl-dev:i386 libyaml-dev:i386 libreadline6-dev:i386 \ |
| 53 | + zlib1g-dev:i386 libncurses5-dev:i386 libffi-dev:i386 \ |
| 54 | + libclang1:i386 |
| 55 | +./autogen.sh |
| 56 | +./configure --disable-install-doc |
| 57 | +make -j |
| 58 | +make mjit-bindgen |
| 59 | +``` |
| 60 | + |
| 61 | +Note that you cannot run x86\_64 bindgen with an i686 binary, and vice versa. |
| 62 | +Also, when you install libclang1:i386, libclang1 will be uninstalled. |
| 63 | +You can have only either of these at a time. |
| 64 | + |
| 65 | +## Local development |
| 66 | + |
| 67 | +### Always run make install |
| 68 | + |
| 69 | +Always run `make install` before running MJIT. It could easily cause a SEGV if you don't. |
| 70 | +MJIT looks for the installed header for security reasons. |
| 71 | + |
| 72 | +### --mjit-debug vs --mjit-debug=-ggdb3 |
| 73 | + |
| 74 | +`--mjit-debug=[flags]` allows you to specify arbitrary flags while keeping other compiler flags like `-O3`, |
| 75 | +which is useful for profiling benchmarks. |
| 76 | + |
| 77 | +`--mjit-debug` alone, on the other hand, disables `-O3` and adds debug flags. |
| 78 | +If you're debugging MJIT, what you need to use is not `--mjit-debug=-ggdb3` but `--mjit-debug`. |
0 commit comments