On s390x, a long is 8 bytes. st_data_t is an unsigned long but
pm_constant_id_t is a 4 byte integer. We need to cast it to st_data_t
when passing it to ST functions.
This commit is contained in:
Peter Zhu 2024-01-26 14:51:25 -05:00 коммит произвёл Kevin Newton
Родитель 2a509787cb
Коммит 59bb78ebd0
2 изменённых файлов: 11 добавлений и 12 удалений

Просмотреть файл

@ -72,7 +72,6 @@ env:
# on s390x CPU architecture. # on s390x CPU architecture.
# https://github.com/madler/zlib/pull/410 # https://github.com/madler/zlib/pull/410
- DFLTCC=0 - DFLTCC=0
- TESTS="--exclude=ruby/test_compile_prism.rb --exclude=ruby/test_iseq.rb"
- &arm32-linux - &arm32-linux
name: arm32-linux name: arm32-linux
arch: arm64 arch: arm64
@ -135,7 +134,7 @@ before_script:
script: script:
- $SETARCH make -s test - $SETARCH make -s test
- ../tool/travis_wait.sh $SETARCH make -s test-all RUBYOPT="-w" TESTS="$TESTS" - ../tool/travis_wait.sh $SETARCH make -s test-all RUBYOPT="-w"
- $SETARCH make -s test-spec - $SETARCH make -s test-spec
# We want to be notified when something happens. # We want to be notified when something happens.

Просмотреть файл

@ -2816,7 +2816,7 @@ static int
pm_local_table_insert_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing) pm_local_table_insert_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
{ {
if (!existing) { if (!existing) {
pm_constant_id_t constant_id = *(pm_constant_id_t *)key; pm_constant_id_t constant_id = (pm_constant_id_t)*key;
struct pm_local_table_insert_ctx * ctx = (struct pm_local_table_insert_ctx *)arg; struct pm_local_table_insert_ctx * ctx = (struct pm_local_table_insert_ctx *)arg;
pm_scope_node_t *scope_node = ctx->scope_node; pm_scope_node_t *scope_node = ctx->scope_node;
@ -2826,7 +2826,7 @@ pm_local_table_insert_func(st_data_t *key, st_data_t *value, st_data_t arg, int
ID local = pm_constant_id_lookup(scope_node, constant_id); ID local = pm_constant_id_lookup(scope_node, constant_id);
local_table_for_iseq->ids[local_index] = local; local_table_for_iseq->ids[local_index] = local;
*value = local_index; *value = (st_data_t)local_index;
ctx->local_index++; ctx->local_index++;
} }
@ -2841,7 +2841,7 @@ pm_insert_local_index(pm_constant_id_t constant_id, int local_index, st_table *i
ID local = pm_constant_id_lookup(scope_node, constant_id); ID local = pm_constant_id_lookup(scope_node, constant_id);
local_table_for_iseq->ids[local_index] = local; local_table_for_iseq->ids[local_index] = local;
st_insert(index_lookup_table, constant_id, local_index); st_insert(index_lookup_table, (st_data_t)constant_id, local_index);
} }
/** /**
@ -6543,7 +6543,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
// def foo(a, (b, *c, d), e = 1, *, g, (h, *i, j), k:, l: 1, **m, &n) // def foo(a, (b, *c, d), e = 1, *, g, (h, *i, j), k:, l: 1, **m, &n)
// ^ // ^
local_table_for_iseq->ids[local_index] = PM_CONSTANT_MULT; local_table_for_iseq->ids[local_index] = PM_CONSTANT_MULT;
st_insert(index_lookup_table, PM_CONSTANT_MULT, local_index); st_insert(index_lookup_table, (st_data_t)PM_CONSTANT_MULT, local_index);
} }
local_index++; local_index++;
} }
@ -6726,7 +6726,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
} }
else { else {
local_table_for_iseq->ids[local_index] = PM_CONSTANT_POW; local_table_for_iseq->ids[local_index] = PM_CONSTANT_POW;
st_insert(index_lookup_table, PM_CONSTANT_POW, local_index); st_insert(index_lookup_table, (st_data_t)PM_CONSTANT_POW, local_index);
} }
local_index++; local_index++;
break; break;
@ -6737,17 +6737,17 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
body->param.rest_start = local_index; body->param.rest_start = local_index;
body->param.flags.has_rest = true; body->param.flags.has_rest = true;
local_table_for_iseq->ids[local_index] = PM_CONSTANT_MULT; local_table_for_iseq->ids[local_index] = PM_CONSTANT_MULT;
st_insert(index_lookup_table, PM_CONSTANT_MULT, local_index); st_insert(index_lookup_table, (st_data_t)PM_CONSTANT_MULT, local_index);
local_index++; local_index++;
body->param.block_start = local_index; body->param.block_start = local_index;
body->param.flags.has_block = true; body->param.flags.has_block = true;
local_table_for_iseq->ids[local_index] = PM_CONSTANT_AND; local_table_for_iseq->ids[local_index] = PM_CONSTANT_AND;
st_insert(index_lookup_table, PM_CONSTANT_AND, local_index); st_insert(index_lookup_table, (st_data_t)PM_CONSTANT_AND, local_index);
local_index++; local_index++;
local_table_for_iseq->ids[local_index] = PM_CONSTANT_DOT3; local_table_for_iseq->ids[local_index] = PM_CONSTANT_DOT3;
st_insert(index_lookup_table, PM_CONSTANT_DOT3, local_index); st_insert(index_lookup_table, (st_data_t)PM_CONSTANT_DOT3, local_index);
local_index++; local_index++;
break; break;
} }
@ -6767,7 +6767,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
if (name == 0) { if (name == 0) {
local_table_for_iseq->ids[local_index] = PM_CONSTANT_AND; local_table_for_iseq->ids[local_index] = PM_CONSTANT_AND;
st_insert(index_lookup_table, PM_CONSTANT_AND, local_index); st_insert(index_lookup_table, (st_data_t)PM_CONSTANT_AND, local_index);
} }
else { else {
if (PM_NODE_FLAG_P(parameters_node->block, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) { if (PM_NODE_FLAG_P(parameters_node->block, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
@ -6866,7 +6866,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
ctx.local_table_for_iseq = local_table_for_iseq; ctx.local_table_for_iseq = local_table_for_iseq;
ctx.local_index = local_index; ctx.local_index = local_index;
st_update(index_lookup_table, constant_id, pm_local_table_insert_func, (st_data_t)&ctx); st_update(index_lookup_table, (st_data_t)constant_id, pm_local_table_insert_func, (st_data_t)&ctx);
local_index = ctx.local_index; local_index = ctx.local_index;
} }