1

I am learning about JMM and the optimizations made by the JVM are getting in the way of observing JMM functionality. How can I turn off JVM optimizations?

1 Answer 1

2

The "-Xint" option runs with the JIT compiler disabled. That is the closest you will get to "turning off optimization".

However, there is nothing in the documentation that says what effect this has on the JMM.

If you are trying to understand the JMM, then observing behavior (i.e. black box testing with -Xint) can never prove that a positive hypothesis is correct. Especially since the effect of -Xint on the JMM is not specified. All testing can do is to demonstrate behaviors that differ and therefore1 are not guaranteed by the JMM / JLS.

If you want to actually reason about the JMM, use logic. Read and understand the specification, and apply that knowledge in your reasoning.


1 - modulo bugs in the JVM, JIT compiler, hardware (!), etc.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.