Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
dc9ce32
test/ruby/test_optimization.rb: fix compile kwarg
Feb 14, 2018
7606806
compile.c: drop freezestring insn on String#-@
Feb 14, 2018
8df47f8
configure.ac: Use `pthread_create` to determine if pthread is available
mame Feb 15, 2018
50700c4
thread_pthread.c: Use `getpagesize()` when `pthread_attr_getguardsize…
mame Feb 15, 2018
b4b4b94
gc.c: force STACK_GROW_DIRECTION for emscripten
mame Feb 15, 2018
0efd8bb
test/io/console/test_io_console.rb (test_oflush): Avoid race condition
mame Feb 15, 2018
9a9a4e8
Benchmarks for Array#values_at
nobu Feb 15, 2018
41e9e19
Array#values_at optimization
nobu Feb 15, 2018
d6db2d9
Avoid using `@` in macro substitution that confuses FreeBSD make
knu Feb 15, 2018
80c850e
Iterate over the catch table, and mark iseq in the table
tenderlove Jan 12, 2018
881ea05
Disasm instruction sequences and mark things managed by the GC
tenderlove Jan 12, 2018
969ccfd
Only add objects to the compile time mark array
tenderlove Jan 12, 2018
aaaffa4
Only de-reference when we need to check the object type
tenderlove Jan 17, 2018
5fa1733
Private function should be static, no return in `void`
tenderlove Jan 18, 2018
d3f6c51
CDHASH needs to stay in the mark array until compilation finishes
tenderlove Jan 18, 2018
9bed499
Fix bug when marking iseq before instruction have been translated
tenderlove Jan 19, 2018
8aeb2b8
Directly mark `once` instruction values
tenderlove Feb 2, 2018
65c9fc9
stop using a mark array
tenderlove Feb 2, 2018
6649dc4
Set a compile time flag so iseq marking knows about markables
tenderlove Feb 5, 2018
d6ca1ce
Introduce TS_ISE operand
tenderlove Feb 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix bug when marking iseq before instruction have been translated
If an instruction sequence gets marked before instructions have been
translated, the we need to *not* translate back instructions in the mark
function.
  • Loading branch information
tenderlove committed Feb 15, 2018
commit 9bed499f10f3787f85e75b545148acb511f810d3
1 change: 1 addition & 0 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
encoded[i] = (VALUE)table[insn];
i += len;
}
FL_SET(iseq, ISEQ_TRANSLATED);
#endif
return COMPILE_OK;
}
Expand Down
28 changes: 21 additions & 7 deletions iseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,19 @@ rb_vm_insn_addr2insn2(const void *addr)
}
#endif

static int
rb_vm_insn_null_translator(const void *addr)
{
return (int)addr;
}

typedef void iseq_value_itr_t(void *ctx, VALUE obj);
typedef int rb_vm_insns_translator_t(const void *addr);

static int
iseq_extract_values(const VALUE *code, size_t pos, iseq_value_itr_t * func, void *data)
iseq_extract_values(const VALUE *code, size_t pos, iseq_value_itr_t * func, void *data, rb_vm_insns_translator_t * translator)
{
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
VALUE insn = rb_vm_insn_addr2insn2((void *)code[pos]);
#else
VALUE insn = code[pos];
#endif
VALUE insn = translator((void *)code[pos]);
int len = insn_len(insn);
int op_no;
const char *types = insn_op_types(insn);
Expand Down Expand Up @@ -172,12 +175,23 @@ rb_iseq_each_value(const rb_iseq_t *iseq, iseq_value_itr_t * func, void *data)
unsigned int size;
const VALUE *code;
size_t n;
rb_vm_insns_translator_t * translator;

size = iseq->body->iseq_size;
code = iseq->body->iseq_encoded;

#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
if (FL_TEST(iseq, ISEQ_TRANSLATED)) {
translator = rb_vm_insn_addr2insn2;
} else {
translator = rb_vm_insn_null_translator;
}
#else
translator = rb_vm_insn_null_translator;
#endif

for (n = 0; n < size;) {
n += iseq_extract_values(code, n, func, data);
n += iseq_extract_values(code, n, func, data, translator);
}
}

Expand Down
1 change: 1 addition & 0 deletions iseq.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)

#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
#define ISEQ_USE_COMPILE_DATA IMEMO_FL_USER2
#define ISEQ_TRANSLATED IMEMO_FL_USER3

struct iseq_compile_data {
/* GC is needed */
Expand Down