mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Get rid of type-punning pointer casts
This commit is contained in:
parent
9e58c3c519
commit
7b1ece9b94
4 changed files with 18 additions and 17 deletions
24
ractor.c
24
ractor.c
|
@ -2706,7 +2706,7 @@ obj_refer_only_shareables_p(VALUE obj)
|
||||||
static int
|
static int
|
||||||
obj_traverse_replace_i(VALUE obj, struct obj_traverse_replace_data *data)
|
obj_traverse_replace_i(VALUE obj, struct obj_traverse_replace_data *data)
|
||||||
{
|
{
|
||||||
VALUE replacement;
|
st_data_t replacement;
|
||||||
|
|
||||||
if (RB_SPECIAL_CONST_P(obj)) {
|
if (RB_SPECIAL_CONST_P(obj)) {
|
||||||
data->replacement = obj;
|
data->replacement = obj;
|
||||||
|
@ -2719,14 +2719,14 @@ obj_traverse_replace_i(VALUE obj, struct obj_traverse_replace_data *data)
|
||||||
case traverse_stop: return 1; // stop search
|
case traverse_stop: return 1; // stop search
|
||||||
}
|
}
|
||||||
|
|
||||||
replacement = data->replacement;
|
replacement = (st_data_t)data->replacement;
|
||||||
|
|
||||||
if (UNLIKELY(st_lookup(obj_traverse_replace_rec(data), (st_data_t)obj, (st_data_t *)&replacement))) {
|
if (UNLIKELY(st_lookup(obj_traverse_replace_rec(data), (st_data_t)obj, &replacement))) {
|
||||||
data->replacement = replacement;
|
data->replacement = (VALUE)replacement;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
st_insert(obj_traverse_replace_rec(data), (st_data_t)obj, (st_data_t)replacement);
|
st_insert(obj_traverse_replace_rec(data), (st_data_t)obj, replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data->move) {
|
if (!data->move) {
|
||||||
|
@ -2872,7 +2872,7 @@ obj_traverse_replace_i(VALUE obj, struct obj_traverse_replace_data *data)
|
||||||
rb_bug("unreachable");
|
rb_bug("unreachable");
|
||||||
}
|
}
|
||||||
|
|
||||||
data->replacement = replacement;
|
data->replacement = (VALUE)replacement;
|
||||||
|
|
||||||
if (data->leave_func(obj, data) == traverse_stop) {
|
if (data->leave_func(obj, data) == traverse_stop) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -3052,9 +3052,9 @@ ractor_local_storage_mark(rb_ractor_t *r)
|
||||||
|
|
||||||
for (int i=0; i<freed_ractor_local_keys.cnt; i++) {
|
for (int i=0; i<freed_ractor_local_keys.cnt; i++) {
|
||||||
rb_ractor_local_key_t key = freed_ractor_local_keys.keys[i];
|
rb_ractor_local_key_t key = freed_ractor_local_keys.keys[i];
|
||||||
st_data_t val;
|
st_data_t val, k = (st_data_t)key;
|
||||||
if (st_delete(r->local_storage, (st_data_t *)&key, &val) &&
|
if (st_delete(r->local_storage, &k, &val) &&
|
||||||
key->type->free) {
|
(key = (rb_ractor_local_key_t)k)->type->free) {
|
||||||
(*key->type->free)((void *)val);
|
(*key->type->free)((void *)val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3179,9 +3179,9 @@ ractor_local_set(rb_ractor_local_key_t key, void *ptr)
|
||||||
VALUE
|
VALUE
|
||||||
rb_ractor_local_storage_value(rb_ractor_local_key_t key)
|
rb_ractor_local_storage_value(rb_ractor_local_key_t key)
|
||||||
{
|
{
|
||||||
VALUE val;
|
void *val;
|
||||||
if (ractor_local_ref(key, (void **)&val)) {
|
if (ractor_local_ref(key, &val)) {
|
||||||
return val;
|
return (VALUE)val;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
|
@ -1021,8 +1021,9 @@ rb_vm_lookup_overloaded_cme(const rb_callable_method_entry_t *cme)
|
||||||
static void
|
static void
|
||||||
delete_overloaded_cme(const rb_callable_method_entry_t *cme)
|
delete_overloaded_cme(const rb_callable_method_entry_t *cme)
|
||||||
{
|
{
|
||||||
|
st_data_t cme_data = (st_data_t)cme;
|
||||||
ASSERT_vm_locking();
|
ASSERT_vm_locking();
|
||||||
st_delete(overloaded_cme_table(), (st_data_t *)&cme, NULL);
|
st_delete(overloaded_cme_table(), &cme_data, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const rb_callable_method_entry_t *
|
static const rb_callable_method_entry_t *
|
||||||
|
|
|
@ -855,7 +855,7 @@ socklist_lookup(SOCKET sock, int *flagp)
|
||||||
|
|
||||||
thread_exclusive(socklist) {
|
thread_exclusive(socklist) {
|
||||||
if (!socklist) continue;
|
if (!socklist) continue;
|
||||||
ret = st_lookup(socklist, (st_data_t)sock, (st_data_t *)&data);
|
ret = st_lookup(socklist, (st_data_t)sock, &data);
|
||||||
if (ret && flagp)
|
if (ret && flagp)
|
||||||
*flagp = (int)data;
|
*flagp = (int)data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3212,9 +3212,9 @@ jit_thread_s_current(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo *ci,
|
||||||
static method_codegen_t
|
static method_codegen_t
|
||||||
lookup_cfunc_codegen(const rb_method_definition_t *def)
|
lookup_cfunc_codegen(const rb_method_definition_t *def)
|
||||||
{
|
{
|
||||||
method_codegen_t gen_fn;
|
st_data_t gen_fn;
|
||||||
if (st_lookup(yjit_method_codegen_table, def->method_serial, (st_data_t *)&gen_fn)) {
|
if (st_lookup(yjit_method_codegen_table, def->method_serial, &gen_fn)) {
|
||||||
return gen_fn;
|
return (method_codegen_t)gen_fn;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue