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

Comments

Projects
None yet
2 participants
@vicuna
Copy link

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Author

commented Nov 21, 2018

Comment author: @nojb

Fixed in #2159.

@vicuna vicuna closed this Nov 21, 2018

@vicuna vicuna added the stdlib label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.