summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <[email protected]>2021-05-26 15:25:50 -0400
committerAlan Wu <[email protected]>2021-10-20 18:19:35 -0400
commitb415ceb92e464011a9326c9cb5e15a84c39da330 ()
tree5b42a1b39408a81d60215929b4f6e138e3ab57b8
parent764740c6615292dc994707b964c135871149fb2b (diff)
Increase default YJIT call threshold to 10. Add exec mem size arg. (#52)
-rw-r--r--README.md13
-rw-r--r--ruby.c5
-rw-r--r--yjit.h3
-rw-r--r--yjit_codegen.c2
-rw-r--r--yjit_iface.c7
5 files changed, 20 insertions, 10 deletions
@@ -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)
### 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
There are 3 test suites:
- `make btest` (see `/bootstraptest`)
@@ -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")) {
yjit_opt->call_threshold = atoi(s + 1);
}
else if (opt_match_arg(s, l, "version-limit")) {
@@ -33,6 +33,9 @@ struct rb_yjit_options {
// Enable compilation with YJIT
bool yjit_enabled;
// 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;
uint8_t *mem_block = alloc_exec_mem(mem_size);
cb = &block;
@@ -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
if (rb_yjit_opts.call_threshold < 1) {
- rb_yjit_opts.call_threshold = 2;
}
if (rb_yjit_opts.version_limit < 1) {
rb_yjit_opts.version_limit = 4;