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

caml_string_equal should be marked as @@noalloc #7874

Closed
vicuna opened this issue Nov 20, 2018 · 4 comments
Closed

caml_string_equal should be marked as @@noalloc #7874

vicuna opened this issue Nov 20, 2018 · 4 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Nov 20, 2018

Original bug ID: 7874
Reporter: @ppedrot
Assigned to: @nojb
Status: resolved (set by @nojb on 2018-11-21T19:44:13Z)
Resolution: fixed
Priority: normal
Severity: tweak
Version: 4.07.1
Category: runtime system and C interface
Monitored by: @nojb

Bug description

Currently, String.equal is defined as a C stub without any annotation. It should be marked as noalloc, as it does not mess with the GC.

@vicuna
Copy link
Author

vicuna commented Nov 20, 2018

Comment author: @gasche

If you believe that it would be safe to use noalloc there, would you like to submit a Pull Request to do it?

@vicuna
Copy link
Author

vicuna commented Nov 20, 2018

Comment author: @gasche

(I suppose caml_string_compare could also be marked as such. I wonder why caml_string_equal is not using memcmp like caml_string_compare, is a loop faster?)

@vicuna
Copy link
Author

vicuna commented Nov 21, 2018

Comment author: @ppedrot

This is already done for caml_string_compare I believe, this function is treated as a primitive in the compiler and its interpretation reads

Primitive.simple ~name:"caml_string_compare" ~arity:2 ~alloc:false

@vicuna
Copy link
Author

vicuna commented Nov 21, 2018

Comment author: @nojb

Fixed in #2159.

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

No branches or pull requests

2 participants