Relation between bytecode instructions and processor operations
问题 Java specification guarantees primitive variable assignments are always atomic (expect for long and double types . On the contrary, Fetch-and-Add operation corresponding to the famous i++ increment operation, would be non-atomic because leading to a read-modify-write operation. Assuming this code: public void assign(int b) { int a = b; } The generated bytecode is: public void assign(int); Code: 0: iload_1 1: istore_2 2: return Thus, we see the assignment is composed of two steps (loading and