Reputation: 1334
I'm trying to understand the Memory Model chapter from the Java Language Specification, but I'm already confused by the first two paragraphs:
A memory model describes, given a program and an execution trace of that program, whether the execution trace is a legal execution of the program. The Java programming language memory model works by examining each read in an execution trace and checking that the write observed by that read is valid according to certain rules.
The memory model describes possible behaviors of a program. An implementation is free to produce any code it likes, as long as all resulting executions of a program produce a result that can be predicted by the memory model.
Suppose I implement a Noop JVM that produces an empty execution for any program. When the memory model analyzes the executions by "examining each read in an execution trace," it should obviously conclude that the executions are all valid. If there are no reads, then trivially all reads are valid according to any rules, including those "certain rules" mentioned in the specification.
Does this mean that my Noop JVM is a perfectly valid implementation according to the Java Memory Model, or am I missing something?
Upvotes: 0
Views: 61