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

Mark memory.size VM intrinsics as not modifying state, and throw.trap/breakpoint as functions which do not return. #677

Merged
merged 1 commit into from
Aug 14, 2019

Conversation

nlewycky
Copy link
Contributor

No description provided.

@nlewycky nlewycky requested a review from losfair as a code owner August 14, 2019 04:43
@nlewycky
Copy link
Contributor Author

Other potentially interesting attributes from llvm's list of function attributes:
http://llvm.org/docs/LangRef.html#fnattrs

  • cold (calls to this are guaranteed rare, implied by noreturn)
  • nounwind (callee does not throw an exception)
  • readnone (callee decides what to do (return or throw exception) based on its arguments and not global state)
  • willreturn (callee eventually returns or throws, but never exits the program)
  • argmemonly (callee does not access global variables by name (it may access them if given a pointer to one as its argument))
  • inaccessiblememonly and inaccessiblemem_or_argmemonly (similar to readnone but used only for JIT environments, indicates that the memory it accesses is private to the callee and not otherwise visible to the code represented in LLVM IR in this LLVM Module)

Some of these may also be used as attributes on pointer-typed arguments, such as indicating that a given pointer is readonly (no stores through this pointer), readnone (pointer is only used for its value, the pointed-to memory is never used), nocapture (the pointer value itself does not matter, only the contents of the pointed-to memory, used for copy elimination), nonnull which indicates that the pointer is literally not null (but nothing else), dereferenceable(<n>) and dereferenceable_or_null(<n>) which indicate that the pointer points to memory which is safe to deference the first <n> bytes of, and returned which indicates that this argument is the value returned by the function.

…/breakpoint as functions which do not return.
@nlewycky nlewycky force-pushed the feature/add-readonly-vm-grow branch from ef3a7df to 2f3c9c3 Compare August 14, 2019 04:51
@syrusakbary
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Aug 14, 2019
677: Mark memory.size VM intrinsics as not modifying state, and throw.trap/breakpoint as functions which do not return. r=syrusakbary a=nlewycky



Co-authored-by: Nick Lewycky <nick@wasmer.io>
@bors bors bot merged commit 2f3c9c3 into master Aug 14, 2019
@bors bors bot deleted the feature/add-readonly-vm-grow branch August 14, 2019 20:45
@Hywan Hywan added 🎉 enhancement New feature! 📦 lib-compiler-llvm About wasmer-compiler-llvm labels Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature! 📦 lib-compiler-llvm About wasmer-compiler-llvm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants