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

intrinsics for trivial functions #8648

Closed
graydon opened this issue Aug 20, 2013 · 3 comments
Closed

intrinsics for trivial functions #8648

graydon opened this issue Aug 20, 2013 · 3 comments
Labels
A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@graydon
Copy link
Contributor

graydon commented Aug 20, 2013

In particular:

  • incrementing a pointer (ptr::offset)
  • Casting a pointer (cast::transmute)
  • Possibly: running drop glue (cast::forget)

It's worth measuring to be sure but I believe the amount of code we generate to call the numerous monomorphic instances of these functions may be substantial. Moving the "intrinsic" recognition-point up just a touch might be worthwhile, though this is (as @pcwalton points out) a slippery slope that leads towards ever more ambitious "optimization in the frontend".

@brson
Copy link
Contributor

brson commented Aug 21, 2013

Let's please do this in a way that doesn't expose the intrinsicness of these functions, e.g. the docs shouldn't reveal that cast::transmute is actually a reexport of unstable::intrinsics::transmute. I guess this could be done by making cast::transmute a lang item that just decays into the transmute intrinsic during codegen. Then of course the actual "rust-intrinsic" intrinsic wouldn't need to exist, so maybe we'll end up with another class of intrinsics. We could also just make rustpkg not treat "rust-intrinsic" functions as special then declare the transmute intrinsic where cast::transmute is now. Would be nice to have standalone decls for that: extern "rust-intrinsic" fn transmute(...);.

@Thiez
Copy link
Contributor

Thiez commented Aug 21, 2013

Isn't the point of cast::forget to not run drop glue?

@thestinger
Copy link
Contributor

Closing in favour of #10008.

flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 21, 2022
…rednet

Fix `unsound_collection_transmute`

fixes rust-lang#7706

changelog: Better check size and alignment requirements in `unsound_collection_transmute`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

4 participants