зеркало из https://github.com/github/ruby.git
* vm_core.h: constify rb_iseq_constant_body::iseq_encoded and
rb_control_frame_t::pc. * compile.c (rb_iseq_translate_threaded_code): catch up this fix. * iseq.c: ditto. * vm_exec.c (vm_exec_core): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f965866f4f
Коммит
18f6978625
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
Thu Jul 23 17:30:43 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* vm_core.h: constify rb_iseq_constant_body::iseq_encoded and
|
||||||
|
rb_control_frame_t::pc.
|
||||||
|
|
||||||
|
* compile.c (rb_iseq_translate_threaded_code): catch up this fix.
|
||||||
|
|
||||||
|
* iseq.c: ditto.
|
||||||
|
|
||||||
|
* vm_exec.c (vm_exec_core): ditto.
|
||||||
|
|
||||||
Thu Jul 23 10:25:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Jul 23 10:25:46 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* include/ruby/ruby.h: add raw FL macros, which assume always the
|
* include/ruby/ruby.h: add raw FL macros, which assume always the
|
||||||
|
|
|
@ -578,11 +578,12 @@ rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
|
||||||
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
|
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
|
||||||
const void * const *table = rb_vm_get_insns_address_table();
|
const void * const *table = rb_vm_get_insns_address_table();
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
VALUE *encoded = (VALUE *)iseq->body->iseq_encoded;
|
||||||
|
|
||||||
for (i = 0; i < iseq->body->iseq_size; /* */ ) {
|
for (i = 0; i < iseq->body->iseq_size; /* */ ) {
|
||||||
int insn = (int)iseq->body->iseq_encoded[i];
|
int insn = (int)iseq->body->iseq_encoded[i];
|
||||||
int len = insn_len(insn);
|
int len = insn_len(insn);
|
||||||
iseq->body->iseq_encoded[i] = (VALUE)table[insn];
|
encoded[i] = (VALUE)table[insn];
|
||||||
i += len;
|
i += len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
20
iseq.c
20
iseq.c
|
@ -72,10 +72,10 @@ rb_iseq_free(const rb_iseq_t *iseq)
|
||||||
if (iseq) {
|
if (iseq) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ruby_xfree(iseq->body->iseq_encoded);
|
ruby_xfree((void *)iseq->body->iseq_encoded);
|
||||||
ruby_xfree(iseq->body->line_info_table);
|
ruby_xfree((void *)iseq->body->line_info_table);
|
||||||
ruby_xfree(iseq->body->local_table);
|
ruby_xfree((void *)iseq->body->local_table);
|
||||||
ruby_xfree(iseq->body->is_entries);
|
ruby_xfree((void *)iseq->body->is_entries);
|
||||||
|
|
||||||
if (iseq->body->callinfo_entries) {
|
if (iseq->body->callinfo_entries) {
|
||||||
for (i=0; i<iseq->body->callinfo_size; i++) {
|
for (i=0; i<iseq->body->callinfo_size; i++) {
|
||||||
|
@ -85,11 +85,12 @@ rb_iseq_free(const rb_iseq_t *iseq)
|
||||||
}
|
}
|
||||||
ruby_xfree(iseq->body->callinfo_entries);
|
ruby_xfree(iseq->body->callinfo_entries);
|
||||||
}
|
}
|
||||||
ruby_xfree(iseq->body->catch_table);
|
ruby_xfree((void *)iseq->body->catch_table);
|
||||||
ruby_xfree(iseq->body->param.opt_table);
|
ruby_xfree((void *)iseq->body->param.opt_table);
|
||||||
|
|
||||||
if (iseq->body->param.keyword != NULL) {
|
if (iseq->body->param.keyword != NULL) {
|
||||||
ruby_xfree(iseq->body->param.keyword->default_values);
|
ruby_xfree((void *)iseq->body->param.keyword->default_values);
|
||||||
ruby_xfree(iseq->body->param.keyword);
|
ruby_xfree((void *)iseq->body->param.keyword);
|
||||||
}
|
}
|
||||||
compile_data_free(iseq->compile_data);
|
compile_data_free(iseq->compile_data);
|
||||||
ruby_xfree(iseq->variable_body->iseq);
|
ruby_xfree(iseq->variable_body->iseq);
|
||||||
|
@ -2118,7 +2119,8 @@ rb_iseqw_line_trace_each(VALUE iseqw, int (*func)(int line, rb_event_flag_t *eve
|
||||||
/* printf("line: %d\n", line); */
|
/* printf("line: %d\n", line); */
|
||||||
cont = (*func)(line, &events, data);
|
cont = (*func)(line, &events, data);
|
||||||
if (current_events != events) {
|
if (current_events != events) {
|
||||||
iseq_original[pos+1] = iseq->body->iseq_encoded[pos+1] =
|
VALUE *encoded = (VALUE *)iseq->body->iseq_encoded;
|
||||||
|
iseq_original[pos+1] = encoded[pos+1] =
|
||||||
(VALUE)(current_events | (events & RUBY_EVENT_SPECIFIED_LINE));
|
(VALUE)(current_events | (events & RUBY_EVENT_SPECIFIED_LINE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,7 +255,7 @@ struct rb_iseq_constant_body {
|
||||||
int local_size;
|
int local_size;
|
||||||
|
|
||||||
unsigned int iseq_size;
|
unsigned int iseq_size;
|
||||||
VALUE *iseq_encoded; /* encoded iseq (insn addr and operands) */
|
const VALUE *iseq_encoded; /* encoded iseq (insn addr and operands) */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parameter information
|
* parameter information
|
||||||
|
@ -536,7 +536,7 @@ typedef struct rb_vm_struct {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct rb_control_frame_struct {
|
typedef struct rb_control_frame_struct {
|
||||||
VALUE *pc; /* cfp[0] */
|
const VALUE *pc; /* cfp[0] */
|
||||||
VALUE *sp; /* cfp[1] */
|
VALUE *sp; /* cfp[1] */
|
||||||
const rb_iseq_t *iseq; /* cfp[2] */
|
const rb_iseq_t *iseq; /* cfp[2] */
|
||||||
VALUE flag; /* cfp[3] */
|
VALUE flag; /* cfp[3] */
|
||||||
|
|
|
@ -60,12 +60,12 @@ vm_exec_core(rb_thread_t *th, VALUE initial)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__i386__)
|
#if defined(__GNUC__) && defined(__i386__)
|
||||||
DECL_SC_REG(VALUE *, pc, "di");
|
DECL_SC_REG(const VALUE *, pc, "di");
|
||||||
DECL_SC_REG(rb_control_frame_t *, cfp, "si");
|
DECL_SC_REG(rb_control_frame_t *, cfp, "si");
|
||||||
#define USE_MACHINE_REGS 1
|
#define USE_MACHINE_REGS 1
|
||||||
|
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
DECL_SC_REG(VALUE *, pc, "14");
|
DECL_SC_REG(const VALUE *, pc, "14");
|
||||||
# if defined(__native_client__)
|
# if defined(__native_client__)
|
||||||
DECL_SC_REG(rb_control_frame_t *, cfp, "13");
|
DECL_SC_REG(rb_control_frame_t *, cfp, "13");
|
||||||
# else
|
# else
|
||||||
|
@ -74,13 +74,13 @@ vm_exec_core(rb_thread_t *th, VALUE initial)
|
||||||
#define USE_MACHINE_REGS 1
|
#define USE_MACHINE_REGS 1
|
||||||
|
|
||||||
#elif defined(__GNUC__) && defined(__powerpc64__)
|
#elif defined(__GNUC__) && defined(__powerpc64__)
|
||||||
DECL_SC_REG(VALUE *, pc, "14");
|
DECL_SC_REG(const VALUE *, pc, "14");
|
||||||
DECL_SC_REG(rb_control_frame_t *, cfp, "15");
|
DECL_SC_REG(rb_control_frame_t *, cfp, "15");
|
||||||
#define USE_MACHINE_REGS 1
|
#define USE_MACHINE_REGS 1
|
||||||
|
|
||||||
#else
|
#else
|
||||||
register rb_control_frame_t *reg_cfp;
|
register rb_control_frame_t *reg_cfp;
|
||||||
VALUE *reg_pc;
|
const VALUE *reg_pc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_MACHINE_REGS
|
#if USE_MACHINE_REGS
|
||||||
|
|
Загрузка…
Ссылка в новой задаче