Skip to content

Commit

Permalink
Fix expr JITed ordbaseat and getcpbyname returning 4294967295 instead…
Browse files Browse the repository at this point in the history
… of -1

I missed ordbaseat in the expr JIT in commit 3a62bdf
The same issue existed with getcpbyname: it returns an MVMGrapheme32 which is a
32 bit signed integer. However we treated it as a 64 bit integer without proper
sign extension, which turned a -1 into 4294967295.
Fix by sign extend the result to a full 64 bit signed integer.
  • Loading branch information
niner committed Apr 11, 2021
1 parent a29a9cc commit dba4b52
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/jit/core_templates.expr
Expand Up @@ -589,10 +589,11 @@
(carg $2 ptr)) ptr_sz))

(template: getcpbyname
(call (^func &MVM_unicode_lookup_by_name)
(arglist
(carg (tc) ptr)
(carg $1 ptr)) int_sz))
(scast
(call (^func &MVM_unicode_lookup_by_name)
(arglist
(carg (tc) ptr)
(carg $1 ptr)) int_sz) int_sz 4))

(template: unipropcode
(call (^func &MVM_unicode_name_to_property_code)
Expand Down Expand Up @@ -2341,11 +2342,12 @@
(carg $3 int)) int_sz))

(template: ordbaseat
(call (^func &MVM_string_ord_basechar_at)
(arglist
(carg (tc) ptr)
(carg $1 ptr)
(carg $2 int)) int_sz))
(scast
(call (^func &MVM_string_ord_basechar_at)
(arglist
(carg (tc) ptr)
(carg $1 ptr)
(carg $2 int)) int_sz) int_sz 4))

(template: isrwcont
(if
Expand Down

0 comments on commit dba4b52

Please sign in to comment.