Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with string & sse4 support #712

Closed
d10sfan opened this issue May 13, 2024 · 3 comments · Fixed by #714
Closed

Issues with string & sse4 support #712

d10sfan opened this issue May 13, 2024 · 3 comments · Fixed by #714

Comments

@d10sfan
Copy link

d10sfan commented May 13, 2024

I maintain/build the luxtorpeda project, and someone created an issue with a crash as soon as they launched. This is a godot UI with gdext rust library.

They had a stack trace (included below) that made me think there might be some problem with the compiled binary and their system (which is a phenom which I don't think has sse4.1 support?). Was wondering if there were any ideas here?

(gdb) bt
#0  0x00007ffff3036658 in core::core_arch::x86::sse41::_mm_testz_si128 (a=..., mask=...) at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/../../stdarch/crates/core_arch/src/x86/sse41.rs:1034
#1  0x00007ffff3021054 in godot_core::builtin::string::string_chars::validate_unicode_scalar_sequence (seq=...) at src/builtin/string/string_chars.rs:40
#2  0x00007ffff3037c4b in godot_core::builtin::string::gstring::GString::chars_checked (self=0x7fffffffd1b8) at src/builtin/string/gstring.rs:102
#3  0x00007ffff3037cdc in godot_core::builtin::string::gstring::{impl#2}::fmt (self=0x7fffffffd1b8, f=0x7fffffffd228) at src/builtin/string/gstring.rs:184
#4  0x00007ffff3038d9e in godot_core::builtin::string::string_name::{impl#2}::fmt (self=0x5a66138, f=0x7fffffffd228) at src/builtin/string/string_name.rs:173
#5  0x00007ffff3036135 in alloc::string::{impl#31}::to_string<godot_core::builtin::string::string_name::StringName> (self=0x5a66138)
    at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/string.rs:2553
#6  0x00007ffff2d2f0bf in godot_core::registry::callbacks::get_virtual<luxtorpeda::client::LuxClient> (_class_user_data=0x0, name=0x5a66138)
    at /home/dnimon/.cargo/git/checkouts/gdext-76630c89719e160c/5d72b64/godot-core/src/registry/callbacks.rs:107

From some discussions on discord, this appears to be related to #161

So possibly making this not rely on sse could improve compatibility.

@Bromeon
Copy link
Member

Bromeon commented May 14, 2024

The SSE4 implementation was introduced in #161 and already fixed once in #176.

@lassade Since you're the original author, do you know how we could address this?

I really need to consider whether it's worth maintaining an SSE implementation if we don't have the confidence it works correctly on all platforms (which would likely mean, more testing and manpower that we don't have among active contributors).

@lassade
Copy link
Contributor

lassade commented May 14, 2024

ops that mostly likely compatibility issue since that is a SSE4.1 instruction. sry about this.

But gstrings should be all valid utf32 chars, so validate_unicode_scalar_sequence may not be needed anymore.

I got a PR merged in gotdot it self here godotengine/godot#74760

@Bromeon
Copy link
Member

Bromeon commented May 14, 2024

@lassade This is great to know, thanks! Missed this for almost a year 😬

godotengine/godot#74760 has milestone 4.1, so for API level >= 4.1, we can make chars_unchecked() safe and rename it to chars(), while removing chars_checked() 👍 (both with deprecations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants