mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_core.h (iseq_unique_id): prefer uintptr_t instead of unsigned long
It produced a warning about type cast in LLP64 (i.e., windows).
This commit is contained in:
parent
e27d2013db
commit
60c53ff6ee
3 changed files with 10 additions and 10 deletions
2
iseq.c
2
iseq.c
|
@ -427,7 +427,7 @@ rb_iseq_memsize(const rb_iseq_t *iseq)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long fresh_iseq_unique_id = 0; /* -- Remove In 3.0 -- */
|
static uintptr_t fresh_iseq_unique_id = 0; /* -- Remove In 3.0 -- */
|
||||||
|
|
||||||
struct rb_iseq_constant_body *
|
struct rb_iseq_constant_body *
|
||||||
rb_iseq_constant_body_alloc(void)
|
rb_iseq_constant_body_alloc(void)
|
||||||
|
|
16
vm_args.c
16
vm_args.c
|
@ -597,38 +597,38 @@ static VALUE rb_warn_check(const rb_execution_context_t * const ec, const rb_ise
|
||||||
{
|
{
|
||||||
if (!iseq) return 0;
|
if (!iseq) return 0;
|
||||||
|
|
||||||
const void *const callee = (void *)(iseq->body->iseq_unique_id * 2);
|
const st_data_t callee = (st_data_t)(iseq->body->iseq_unique_id * 2);
|
||||||
|
|
||||||
const rb_control_frame_t * const cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp);
|
const rb_control_frame_t * const cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp);
|
||||||
|
|
||||||
if (!cfp) return 0;
|
if (!cfp) return 0;
|
||||||
|
|
||||||
const void *const caller = cfp->pc;
|
const st_data_t caller = (st_data_t)cfp->pc;
|
||||||
|
|
||||||
if (!caller_to_callees) {
|
if (!caller_to_callees) {
|
||||||
caller_to_callees = st_init_numtable();
|
caller_to_callees = st_init_numtable();
|
||||||
}
|
}
|
||||||
|
|
||||||
st_data_t val;
|
st_data_t val;
|
||||||
if (st_lookup(caller_to_callees, (st_data_t) caller, &val)) {
|
if (st_lookup(caller_to_callees, caller, &val)) {
|
||||||
st_table *callees;
|
st_table *callees;
|
||||||
|
|
||||||
if (val & 1) {
|
if (val & 1) {
|
||||||
val &= ~(st_data_t)1;
|
val &= ~(st_data_t)1;
|
||||||
if (val == (st_data_t) callee) return 1; /* already warned */
|
if (val == callee) return 1; /* already warned */
|
||||||
|
|
||||||
callees = st_init_numtable();
|
callees = st_init_numtable();
|
||||||
st_insert(callees, val, 1);
|
st_insert(callees, val, 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
callees = (st_table *) val;
|
callees = (st_table *) val;
|
||||||
if (st_is_member(callees, (st_data_t) callee)) return 1; /* already warned */
|
if (st_is_member(callees, callee)) return 1; /* already warned */
|
||||||
}
|
}
|
||||||
st_insert(callees, (st_data_t) callee, 1);
|
st_insert(callees, callee, 1);
|
||||||
st_insert(caller_to_callees, (st_data_t) caller, (st_data_t) callees);
|
st_insert(caller_to_callees, caller, (st_data_t) callees);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
st_insert(caller_to_callees, (st_data_t) caller, ((st_data_t) callee) | 1);
|
st_insert(caller_to_callees, caller, callee | 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; /* not warned yet for the pair of caller and callee */
|
return 0; /* not warned yet for the pair of caller and callee */
|
||||||
|
|
|
@ -448,7 +448,7 @@ struct rb_iseq_constant_body {
|
||||||
struct rb_mjit_unit *jit_unit;
|
struct rb_mjit_unit *jit_unit;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned long iseq_unique_id; /* -- Remove In 3.0 -- */
|
uintptr_t iseq_unique_id; /* -- Remove In 3.0 -- */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* T_IMEMO/iseq */
|
/* T_IMEMO/iseq */
|
||||||
|
|
Loading…
Reference in a new issue