Fix concurrency issue in constant caching.

Because updating the constant cache for a piece of compiled code
is not atomic (multiple cache structures must be updated) it was
possible for the tests in isCached and isCachedFrom to see a non-
null value in the "constants" array before the invalidation
structures in the other arrays (constantGenerations,
constantInvalidators, constantTargetHashes) were set. This allowed
the first "value != null" check to pass, proceeding to access the
object in constantInvalidators even if it was still null.

By moving the update of the "constants" array after the update of
the invalidation structure arrays, we mostly guarantee they'll be
up-to-date before the value is non-null.

Note that this is not necessarily true given reordering and
volatility on the JVM. The RuntimeCache needs to be reexamined to
ensure happens-before on these particular non-atomic structure
updates.
Merge remote-tracking branch 'origin/master'
Propagate Ruby's cwd to Java via Dir.chdir

Ruby.setCurrentDirectory() is responsible for doing the work.
Ignore SecurityException for now. (Though a warning might be
appropriate.)

Fixes #971.
Maintain 1.8 compatibility in Dir.chdir spec
Revert "Maintain 1.8 compatibility in Dir.chdir spec"

This reverts commit e124632ac52f92d7dccd44e8c906673fc6993ab9.
Revert "Propagate Ruby's cwd to Java via Dir.chdir"

This reverts commit 42198651fe5ead7d14df97641588a9dbf4711e9e.

Need to fix Embedded tests.