зеркало из https://github.com/github/ruby.git
Increase default YJIT call threshold to 10. Add exec mem size arg. (#52)
This commit is contained in:
Родитель
764740c661
Коммит
b415ceb92e
13
README.md
13
README.md
|
@ -82,11 +82,12 @@ The machine code generated for a given method can be printed by adding `puts YJI
|
|||
|
||||
YJIT supports all command-line options supported by upstream CRuby, but also adds a few YJIT-specific options:
|
||||
|
||||
- `--disable-yjit`: turn off YJIT (enabled by default)
|
||||
- `--yjit-stats`: produce statistics after the execution of a program (must compile with `cppflags=-DRUBY_DEBUG` to use this)
|
||||
- `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 2)
|
||||
- `--yjit-version-limit=N`: maximum number of versions to generate per basic block (default 4)
|
||||
- `--yjit-greedy-versioning`: greedy versioning mode (disabled by default, may increase code size)
|
||||
- `--disable-yjit`: turn off YJIT (enabled by default)
|
||||
- `--yjit-stats`: produce statistics after the execution of a program (must compile with `cppflags=-DRUBY_DEBUG` to use this)
|
||||
- `--yjit-exec-mem-size=N`: size of the executable memory block to allocate (default 256 MiB)
|
||||
- `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 2)
|
||||
- `--yjit-version-limit=N`: maximum number of versions to generate per basic block (default 4)
|
||||
- `--yjit-greedy-versioning`: greedy versioning mode (disabled by default, may increase code size)
|
||||
|
||||
### Benchmarking
|
||||
|
||||
|
@ -142,7 +143,7 @@ The core of CRuby's interpreter logic is found in:
|
|||
- `vm_insnshelper.c`: logic used by Ruby's bytecode instructions
|
||||
- `vm_exec.c`: Ruby interpreter loop
|
||||
|
||||
### Coding & Debugging Protips
|
||||
### Coding & Debugging Protips
|
||||
|
||||
There are 3 test suites:
|
||||
- `make btest` (see `/bootstraptest`)
|
||||
|
|
5
ruby.c
5
ruby.c
|
@ -1036,7 +1036,10 @@ setup_yjit_options(const char *s, struct rb_yjit_options *yjit_opt)
|
|||
if (*s != '-') return;
|
||||
const size_t l = strlen(++s);
|
||||
|
||||
if (opt_match_arg(s, l, "call-threshold")) {
|
||||
if (opt_match_arg(s, l, "exec-mem-size")) {
|
||||
yjit_opt->exec_mem_size = atoi(s + 1);
|
||||
}
|
||||
else if (opt_match_arg(s, l, "call-threshold")) {
|
||||
yjit_opt->call_threshold = atoi(s + 1);
|
||||
}
|
||||
else if (opt_match_arg(s, l, "version-limit")) {
|
||||
|
|
3
yjit.h
3
yjit.h
|
@ -33,6 +33,9 @@ struct rb_yjit_options {
|
|||
// Enable compilation with YJIT
|
||||
bool yjit_enabled;
|
||||
|
||||
// Size of the executable memory block to allocate in MiB
|
||||
unsigned exec_mem_size;
|
||||
|
||||
// Number of method calls after which to start generating code
|
||||
// Threshold==1 means compile on first execution
|
||||
unsigned call_threshold;
|
||||
|
|
|
@ -2792,7 +2792,7 @@ void
|
|||
yjit_init_codegen(void)
|
||||
{
|
||||
// Initialize the code blocks
|
||||
uint32_t mem_size = 128 * 1024 * 1024;
|
||||
uint32_t mem_size = rb_yjit_opts.exec_mem_size * 1024 * 1024;
|
||||
uint8_t *mem_block = alloc_exec_mem(mem_size);
|
||||
|
||||
cb = █
|
||||
|
|
|
@ -1048,9 +1048,12 @@ rb_yjit_init(struct rb_yjit_options *options)
|
|||
rb_yjit_opts = *options;
|
||||
rb_yjit_opts.yjit_enabled = true;
|
||||
|
||||
// Normalize command-line options
|
||||
// Normalize command-line options to default values
|
||||
if (rb_yjit_opts.exec_mem_size < 1) {
|
||||
rb_yjit_opts.exec_mem_size = 256;
|
||||
}
|
||||
if (rb_yjit_opts.call_threshold < 1) {
|
||||
rb_yjit_opts.call_threshold = 2;
|
||||
rb_yjit_opts.call_threshold = 10;
|
||||
}
|
||||
if (rb_yjit_opts.version_limit < 1) {
|
||||
rb_yjit_opts.version_limit = 4;
|
||||
|
|
Загрузка…
Ссылка в новой задаче