Comments (5)
I guess this part, 4 min later, is maybe more relevant: https://www.youtube.com/watch?v=nXaxk27zwlk&=&t=44m2s
"the compiler needs to know that because the compiler, my compiler, has an assembler built into it. it's going to take a look at that string of inline assembly, and say, i know how assembly works. i can do that. it's going to assemble it, and build a representation for it, and then it's going to notice that it doesn't do anything. or in my case, that it's empty. that doesn't do what I need... so in my opinion, this is a correct usage of volatile, and a correct usage of inline assembly."
from subtle.
I'm pretty sure the black_box here is based on the implementation from libcore:
https://github.com/rust-lang/rust/blob/342c5f33d097b2dc07a2dbc0ca45a37379d2ff60/src/libcore/hint.rs#L109
So feel free to also comment on the related tracking issue: rust-lang/rust#50297
from subtle.
It looks to me that right now it doesn't really matter. but it might matter more in the future? I don't know enough about llvm to answer that.
https://godbolt.org/z/D3j7rf
from subtle.
I was reading the gcc asm docs, it says this: (https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Volatile) on the first line
GCC’s optimizers sometimes discard asm statements if they determine there is no need for the output variables. Also, the optimizers may move code out of loops if they believe that the code will always return the same result (i.e. none of its input values change between calls). Using the volatile qualifier disables these optimizations. asm statements that have no output operands, including asm goto statements, are implicitly volatile.
So maybe the statement is implicitly volatile because it has no output operands?
from subtle.
closing, thank you!
from subtle.
Related Issues (20)
- derive macros to extend constant-time comparisons to user-defined aggregate structs
- Use predication intrinsics (i.e. CMOV) for `ConditionallySelectable` HOT 2
- Remove TravisCI and add github worker
- Tiny bug in test HOT 1
- Clarify assembly review
- Exposing constant-time `is_zero`? HOT 3
- Outdated code in https://doc.dalek.rs/src/ ? HOT 1
- Choice: invariant not upheld in release mode HOT 1
- Prusti for verified Rust crypto HOT 2
- Nightly building issue HOT 2
- Conversions between CtOption and Option HOT 1
- Implement ok_or() for CtOption<T> HOT 11
- Subtle2.3.0 cannot be compiled on my machine HOT 5
- Implement `ConditionallySelectable` for `[T; N]`? HOT 2
- Ensuring `no_std` for subtle HOT 4
- Incorrect explanation of Unsafe usages HOT 2
- Alternative license HOT 1
- Combine multiple `CtOption`al results HOT 1
- Support ConditionallySelectable for types that are not Copy HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subtle.