-
Notifications
You must be signed in to change notification settings - Fork 79
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
Refactor SLJIT's documentation #292
Draft
ningvin
wants to merge
11
commits into
zherczeg:master
Choose a base branch
from
ningvin:doc-refactor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7c1329c
Rename doc to docs
ningvin 77b4a20
Create basic website structure
ningvin 250a8e9
Update website
ningvin e2c5a3d
Cleanup
ningvin 7ddeab3
Progress
ningvin cdb7a48
Progress
ningvin f3a170f
Cleanup
ningvin c1dd305
Update main README
ningvin 58c9f4c
Fix error in quickstart example
ningvin dffaea5
Be consistent
ningvin d42bad3
Complete first program
ningvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<div align="center"> | ||
|
||
# SLJIT | ||
|
||
Platform-independent low-level JIT compiler | ||
|
||
https://zherczeg.github.io/sljit/ | ||
|
||
</div> | ||
|
||
--- | ||
|
||
## 👉 Purpose | ||
|
||
SLJIT is a low-level, platform-independent JIT compiler, which is very well suited for translating bytecode into machine code. | ||
|
||
## ✨ Features | ||
|
||
- Supports a variety of target architectures: | ||
- `x86` 32 / 64 | ||
- `ARM` 32 / 64 | ||
- `RISC-V` 32 / 64 | ||
- `s390x` 64 | ||
- `PowerPC` 32 / 64 | ||
- `LoongArch` 64 | ||
- `MIPS` 32 / 64 | ||
- Supports a large number of operations | ||
- Self-modifying code | ||
- Tail calls | ||
- Fast calls | ||
- Byte order reverse (endianness switching) | ||
- Unaligned memory accesses | ||
- SIMD | ||
- Atomic operations | ||
- Allows direct access to registers (both integer and floating point) | ||
- Supports stack space allocation for function local variables | ||
- Supports all-in-one compilation | ||
- Allows SLJIT's API to be completely hidden from external use | ||
- Allows serializing the compiler into a byte buffer | ||
- Useful for ahead-of-time (AOT) compilation | ||
- Code generation can be resumed after deserialization (partial AOT compilation) | ||
|
||
## 🚀 Quickstart | ||
|
||
Copy the `sljit_src` directory into your project's source directory and include [`sljitLir.h`](./sljit_src/sljitLir.h): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would not add code examples to readme. A comment could be added to a file which contains a basic example. |
||
|
||
```c | ||
#include "sljitLir.h" | ||
|
||
typedef sljit_sw (SLJIT_FUNC *passthrough_func_t)(sljit_sw arg); | ||
|
||
int main() | ||
{ | ||
void *code; | ||
passthrough_func_t func; | ||
|
||
/* Create the compiler */ | ||
struct sljit_compiler *c = sljit_create_compiler(NULL); | ||
|
||
/* Create the function prologue */ | ||
sljit_emit_enter(c, | ||
0, /* Options */ | ||
SLJIT_ARGS1(W, W), /* 1 return value and 1 parameter of type sljit_sw */ | ||
1, /* 1 scratch register used */ | ||
1, /* 1 saved register used */ | ||
0); /* 0 bytes allocated for function local variables */ | ||
|
||
/* The first (and in this case only) argument */ | ||
/* is passed in register S0 */ | ||
|
||
/* Create the function epilogue, directly */ | ||
/* returning the value in S0 */ | ||
sljit_emit_return(c, SLJIT_MOV, SLJIT_S0, 0); | ||
|
||
/* Generate excutable machine code */ | ||
code = sljit_generate_code(c, 0, NULL); | ||
|
||
/* Call the generated function */ | ||
func = (passthrough_func_t) code; | ||
return func(17); | ||
} | ||
``` | ||
|
||
Grab a C99 compatible C/C++ compiler, build and link against [`sljitLir.c`](./sljit_src/sljitLir.c). Done! | ||
|
||
## 📖 Documentation | ||
|
||
SLJIT's documentation can be found on [its website](https://zherczeg.github.io/sljit/), as well as in the [`docs` folder](./docs/). | ||
|
||
Also, take a look at [`sljitLir.h`](./sljit_src/sljitLir.h). | ||
|
||
## 📨 Contact | ||
|
||
Either open an [issue](https://github.com/zherczeg/sljit/issues) or write an email to [email protected]. | ||
|
||
## ⚖️ License | ||
|
||
SLJIT is licensed under the [Simplified BSD License](./LICENSE). | ||
|
||
## ❤️ Special Thanks | ||
|
||
- Alexander Nasonov | ||
- Carlo Marcelo Arenas Belón | ||
- Christian Persch | ||
- Daniel Richard G. | ||
- Giuseppe D'Angelo | ||
- H.J. Lu | ||
- James Cowgill | ||
- Jason Hood | ||
- Jiong Wang (*TileGX support*) | ||
- Marc Mutz | ||
- Martin Storsjö | ||
- Michael McConville | ||
- Mingtao Zhou (*LoongArch support*) | ||
- Walter Lee | ||
- Wen Xichang | ||
- YunQiang Su |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually don't prefer the colorful characters. Please remove them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I forgot to ask about them. I was already pretty sure that the clean look without emojis would be preferred :-D