Merge "Remove PIC option from oat files."
diff --git a/Android.bp b/Android.bp
index e220114..64df9ec 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,5 @@
 subdirs = [
-    "modules/simple",
+    "mmodules/simple",
 ]
 
 build = [
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index a728d61..c6b0855 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -16,21 +16,23 @@
 // Definitions for building the Java library and associated tests.
 //
 
-// libcore is divided into modules.
+// libcore has some sub-directories that follow a common structure:
+// e.g. dalvik, dom, harmony-tests, json, jsr166-tests, luni, libart, ojluni,
+// support, xml, xmlpull.
 //
-// The structure of each module is:
+// The structure of these is generally:
 //
 //   src/
 //       main/               # To be shipped on every device.
 //            java/          # Java source for library code.
-//            native/        # C++ source for library code.
+//            native/        # C/C++ source for library code.
 //            resources/     # Support files.
 //       test/               # Built only on demand, for testing.
 //            java/          # Java source for tests.
-//            native/        # C++ source for tests (rare).
+//            native/        # C/C++ source for tests (rare).
 //            resources/     # Support files.
 //
-// All subdirectories are optional
+// All subdirectories are optional.
 
 build = [
     "openjdk_java_files.bp",
@@ -70,6 +72,7 @@
         ":openjdk_java_files",
         ":non_openjdk_java_files",
         ":android_icu4j_src_files",
+        ":core_simple_mmodule_java_files",
         ":openjdk_lambda_stub_files",
     ],
 
@@ -522,3 +525,41 @@
     no_standard_libs: true,
     system_modules: "none",
 }
+
+//
+// Targets related to core mmodule APIs / dependencies.
+//
+
+// Generates stub source files for the {public SDK API + intra-core mmodule API}
+// of core-all.
+droiddoc {
+    name: "core-all-mmodule-stubs-docs",
+    srcs: [
+        ":openjdk_javadoc_files",
+        ":non_openjdk_javadoc_files",
+        ":android_icu4j_src_files_for_docs",
+        ":core_simple_mmodule_java_files",
+    ],
+
+    installable: false,
+    no_framework_libs: true,
+    metalava_enabled: true,
+    args: "-nodocs -stubsourceonly -showAnnotation libcore.mmodule.IntraCoreMModuleApi",
+}
+
+// A library containing the {public SDK API + intra-core mmodule API} stubs for
+// core-all.
+java_library {
+    name: "core-all.mmodule.stubs",
+    srcs: [
+      ":core-all-mmodule-stubs-docs",
+    ],
+    no_framework_libs: true,
+
+    no_standard_libs: true,
+    libs: ["core-all"],
+    system_modules: "core-all-system-modules",
+    openjdk9: {
+        javacflags: ["--patch-module=java.base=."],
+    },
+}
diff --git a/luni/src/main/java/libcore/mmodule/DemoLibartClass.java b/luni/src/main/java/libcore/mmodule/DemoLibartClass.java
new file mode 100644
index 0000000..0a73f8e
--- /dev/null
+++ b/luni/src/main/java/libcore/mmodule/DemoLibartClass.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.mmodule;
+
+import libcore.mmodule.IntraCoreMModuleApi;
+import libcore.mmodule.simple.DemoSimpleClass;
+
+/**
+ * A class that provides a dependency within core-libart for the core-simple mmodule to depend on,
+ * and depends on the core-simple mmodule thereby demonstrating a bi-directional dependency.
+ *
+ * @hide
+ */
+@IntraCoreMModuleApi
+public class DemoLibartClass {
+
+    private DemoLibartClass() {}
+
+    /**
+     * A method that depends on the simple mmodule to work.
+     *
+     * @hide
+     */
+    @IntraCoreMModuleApi // Exposed for tests
+    public static String intraCoreDependencyMethod() {
+        // Delegate to core-simple code to implement the method.
+        return DemoSimpleClass.simpleMethod();
+    }
+
+    /**
+     * A simple method that has no native or data file dependencies but is part of the intra-core
+     * mmodule API contract.
+     *
+     * @hide
+     */
+    @IntraCoreMModuleApi
+    public static String simpleMethod() {
+        return "Hello World";
+    }
+
+    /**
+     * A method that is public but not part of the intra-core mmodule API contract, i.e. it cannot
+     * be used from an mmodule.
+     *
+     * @hide
+     */
+    public static String hiddenMethod() {
+        return "Hello World";
+    }
+}
diff --git a/luni/src/main/java/libcore/mmodule/IntraCoreMModuleApi.java b/luni/src/main/java/libcore/mmodule/IntraCoreMModuleApi.java
new file mode 100644
index 0000000..1bcf005
--- /dev/null
+++ b/luni/src/main/java/libcore/mmodule/IntraCoreMModuleApi.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.mmodule;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates an API is part of a contract within the "core" set of libraries, some of which may
+ * be mmodules.
+ * <p>
+ * This annotation should only appear on API that is already marked <pre>@hide</pre>.
+ *
+ * @hide
+ */
+@Target({TYPE, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface IntraCoreMModuleApi {
+}
diff --git a/mmodules/simple/Android.bp b/mmodules/simple/Android.bp
new file mode 100644
index 0000000..e210ffd
--- /dev/null
+++ b/mmodules/simple/Android.bp
@@ -0,0 +1,113 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+filegroup {
+    name: "core_simple_mmodule_java_files",
+    srcs: ["src/main/java/**/*.java"]
+}
+
+java_defaults {
+    name: "core-simple-mmodule-defaults",
+    srcs: [":core_simple_mmodule_java_files"],
+    installable: true,
+    no_framework_libs: true,
+
+    // As a logical part of the set of core-* libs we cannot use
+    // no_standard_libs: false here because core-simple is one of the default
+    // standard libs and that leads to a cycle. core-simple can depend on
+    // core-oj and core-libart and there can be dependencies from core-libart
+    // or core-oj back onto core-simple. So, we deliberately compile against
+    // core-all to avoid cycles.
+    no_standard_libs: true,
+    libs: ["core-all"],
+    system_modules: "core-all-system-modules",
+    openjdk9: {
+        javacflags: ["--patch-module=java.base=."],
+    },
+
+    dxflags: ["--core-library"],
+}
+
+// A library containing the implementation of the core-simple mmodule.
+java_library {
+    name: "core-simple",
+    hostdex: true,
+    defaults: ["core-simple-mmodule-defaults"],
+}
+
+// A guaranteed unstripped version of core-simple.
+// The build system may or may not strip the core-simple jar
+// but this will not be stripped. See b/24535627.
+java_library {
+    name: "core-simple-testdex",
+    defaults: ["core-simple-mmodule-defaults"],
+    dex_preopt: {
+        enabled: false,
+    },
+}
+
+// Tests associated with the core-simple mmodule.
+java_test {
+    name: "core-simple-mmodule-test",
+    srcs: [ "src/test/java/**/*.java" ],
+    no_framework_libs: true,
+
+    no_standard_libs: true,
+    libs: [
+          // We depend on stubs not the impl code. We do not test mmodule
+          // internals, just the {public SDK API + intra-core mmodule API}.
+          "core-all.mmodule.stubs",
+          // Other deps needed for tests.
+          "junit",
+    ],
+    system_modules: "core-all-mmodule-stubs-system-modules",
+}
+
+// Generates stub source files for the {public SDK API + intra-core mmodule API}
+// of the core-simple mmodule.
+droiddoc {
+    name: "core-simple-mmodule-stubs-docs",
+    srcs: [":core_simple_mmodule_java_files"],
+    installable: false,
+    no_framework_libs: true,
+    metalava_enabled: true,
+    args: "-nodocs -stubsourceonly -showAnnotation libcore.mmodule.IntraCoreMModuleApi",
+}
+
+// A library containing the {public SDK API + intra-core mmodule API} stubs for
+// the core-simple mmodule.
+java_library {
+    name: "core-simple.mmodule.stubs",
+    srcs: [
+      ":core-simple-mmodule-stubs-docs",
+    ],
+
+    no_framework_libs: true,
+
+    no_standard_libs: true,
+    // We use core-all.mmodule.stubs here to prove that we have all the
+    // dependencies needed to compile the mmodule stubs within the stubs, i.e.
+    // there are no non-API references.
+    libs: ["core-all.mmodule.stubs"],
+    system_modules: "core-all-mmodule-stubs-system-modules",
+    openjdk9: {
+        javacflags: ["--patch-module=java.base=."],
+    },
+}
+
+java_system_modules {
+    name: "core-all-mmodule-stubs-system-modules",
+    libs: ["core-all.mmodule.stubs"],
+}
+
diff --git a/mmodules/simple/src/main/java/libcore/mmodule/simple/DemoSimpleClass.java b/mmodules/simple/src/main/java/libcore/mmodule/simple/DemoSimpleClass.java
new file mode 100644
index 0000000..413746909
--- /dev/null
+++ b/mmodules/simple/src/main/java/libcore/mmodule/simple/DemoSimpleClass.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.mmodule.simple;
+
+import libcore.mmodule.IntraCoreMModuleApi;
+import libcore.mmodule.DemoLibartClass;
+
+/**
+ * A class that nothing in libcore or the Android framework depends on to provide public SDK
+ * behavior. It is intended for use in a fake installable mmodule. Its presence can be tested for,
+ * the classloader identified and its behavior modified over time to simulate real mmodule code,
+ * without touching any "real" platform logic.
+ *
+ * @hide
+ */
+@IntraCoreMModuleApi
+public class DemoSimpleClass {
+
+    private DemoSimpleClass() {}
+
+    /**
+     * A simple method that has no native or data file dependencies but is part of the simple
+     * mmodule's API contract.
+     *
+     * @hide
+     */
+    @IntraCoreMModuleApi
+    public static String simpleMethod() {
+        return "Hello World";
+    }
+
+    /**
+     * A method that depends on another part of the core libraries to work.
+     *
+     * @hide
+     */
+    @IntraCoreMModuleApi // Exposed for tests
+    public static String intraCoreDependencyMethod() {
+        // Delegate to core-libart code to implement the method.
+        return DemoLibartClass.simpleMethod();
+    }
+
+    /**
+     * A method that is public but not part of the simple mmodule's API contract.
+     *
+     * @hide
+     */
+    public static String hiddenMethod() {
+        return "Hello World";
+    }
+}
diff --git a/modules/simple/src/test/java/libcore/test/simple/TestClassTest.java b/mmodules/simple/src/test/java/libcore/test/mmodule/libart/DemoLibartClassTest.java
similarity index 65%
copy from modules/simple/src/test/java/libcore/test/simple/TestClassTest.java
copy to mmodules/simple/src/test/java/libcore/test/mmodule/libart/DemoLibartClassTest.java
index acdea98..f383390 100644
--- a/modules/simple/src/test/java/libcore/test/simple/TestClassTest.java
+++ b/mmodules/simple/src/test/java/libcore/test/mmodule/libart/DemoLibartClassTest.java
@@ -14,32 +14,36 @@
  * limitations under the License.
  */
 
-package libcore.test.simple;
+package libcore.test.mmodule.libart;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
 
-
-import libcore.simple.TestClass;
+import libcore.mmodule.DemoLibartClass;
 
 import org.junit.Test;
 
 /**
- * A test for the presence and behavior of {@link TestClass}.
+ * A test for the presence and behavior of {@link DemoLibartClass}.
  */
-public class TestClassTest {
+public class DemoLibartClassTest {
 
     @Test
     public void classLoader() {
-        Class<?> clazz = TestClass.class;
+        Class<?> clazz = DemoLibartClass.class;
         ClassLoader bootClassLoader = ClassLoader.getSystemClassLoader().getParent();
 
-        // The TestClass must be loaded by the boot classloader.
+        // The DemoLibartClass must be loaded by the boot classloader.
         assertSame(bootClassLoader, clazz.getClassLoader());
     }
 
     @Test
     public void simpleMethod() {
-        assertEquals("Hello World", TestClass.simpleMethod());
+        assertEquals("Hello World", DemoLibartClass.simpleMethod());
+    }
+
+    @Test
+    public void intraCoreDependencyMethod() {
+        assertEquals("Hello World", DemoLibartClass.intraCoreDependencyMethod());
     }
 }
diff --git a/modules/simple/src/test/java/libcore/test/simple/TestClassTest.java b/mmodules/simple/src/test/java/libcore/test/mmodule/simple/DemoSimpleClassTest.java
similarity index 65%
rename from modules/simple/src/test/java/libcore/test/simple/TestClassTest.java
rename to mmodules/simple/src/test/java/libcore/test/mmodule/simple/DemoSimpleClassTest.java
index acdea98..523eed5 100644
--- a/modules/simple/src/test/java/libcore/test/simple/TestClassTest.java
+++ b/mmodules/simple/src/test/java/libcore/test/mmodule/simple/DemoSimpleClassTest.java
@@ -14,32 +14,36 @@
  * limitations under the License.
  */
 
-package libcore.test.simple;
+package libcore.test.mmodule.simple;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
 
-
-import libcore.simple.TestClass;
+import libcore.mmodule.simple.DemoSimpleClass;
 
 import org.junit.Test;
 
 /**
- * A test for the presence and behavior of {@link TestClass}.
+ * A test for the presence and behavior of {@link DemoSimpleClass}.
  */
-public class TestClassTest {
+public class DemoSimpleClassTest {
 
     @Test
     public void classLoader() {
-        Class<?> clazz = TestClass.class;
+        Class<?> clazz = DemoSimpleClass.class;
         ClassLoader bootClassLoader = ClassLoader.getSystemClassLoader().getParent();
 
-        // The TestClass must be loaded by the boot classloader.
+        // The DemoSimpleClass must be loaded by the boot classloader.
         assertSame(bootClassLoader, clazz.getClassLoader());
     }
 
     @Test
     public void simpleMethod() {
-        assertEquals("Hello World", TestClass.simpleMethod());
+        assertEquals("Hello World", DemoSimpleClass.simpleMethod());
+    }
+
+    @Test
+    public void intraCoreDependencyMethod() {
+        assertEquals("Hello World", DemoSimpleClass.intraCoreDependencyMethod());
     }
 }
diff --git a/modules/simple/Android.bp b/modules/simple/Android.bp
deleted file mode 100644
index f9e7a28..0000000
--- a/modules/simple/Android.bp
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (C) 2018 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-java_defaults {
-    name: "core-simple-defaults",
-    srcs: [ "src/main/java/**/*.java" ],
-    installable: true,
-    no_standard_libs: true,
-    no_framework_libs: true,
-    libs: [
-        "core-oj",
-        "core-libart",
-    ],
-    system_modules: "core-all-system-modules",
-    dxflags: ["--core-library"],
-}
-
-java_library {
-    name: "core-simple",
-    hostdex: true,
-    defaults: ["core-simple-defaults"],
-}
-
-// A guaranteed unstripped version of core-simple.
-// The build system may or may not strip the core-simple jar
-// but this will not be stripped. See b/24535627.
-java_library {
-    name: "core-simple-testdex",
-    defaults: ["core-simple-defaults"],
-    dex_preopt: {
-        enabled: false,
-    },
-}
-
-java_test {
-    name: "core-simple-test",
-    srcs: [ "src/test/java/**/*.java" ],
-    libs: [
-        "core-simple",
-	"junit",
-    ],
-    no_framework_libs: true,
-}
diff --git a/modules/simple/src/main/java/libcore/simple/TestClass.java b/modules/simple/src/main/java/libcore/simple/TestClass.java
deleted file mode 100644
index eebb569..0000000
--- a/modules/simple/src/main/java/libcore/simple/TestClass.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package libcore.simple;
-
-/**
- * A class that nothing in libcore or the Android framework depends on. It is intended for use in a
- * fake installable module. Its presence can be tested for, the classloader identified and its
- * behavior modified over time to simulate a real module, without touching any "real" platform
- * logic.
- */
-public class TestClass {
-
-    private TestClass() {}
-
-    /**
-     * A simple method that has no native or data file dependencies.
-     */
-    public static String simpleMethod() {
-        return "Hello World";
-    }
-}
diff --git a/non_openjdk_java_files.bp b/non_openjdk_java_files.bp
index 0b3af9d..523babb 100644
--- a/non_openjdk_java_files.bp
+++ b/non_openjdk_java_files.bp
@@ -156,6 +156,8 @@
         "luni/src/main/java/javax/xml/xpath/XPathFunctionException.java",
         "luni/src/main/java/javax/xml/xpath/XPathFunctionResolver.java",
         "luni/src/main/java/javax/xml/xpath/XPathVariableResolver.java",
+        "luni/src/main/java/libcore/mmodule/DemoLibartClass.java",
+        "luni/src/main/java/libcore/mmodule/IntraCoreMModuleApi.java",
         "json/src/main/java/org/json/JSON.java",
         "json/src/main/java/org/json/JSONArray.java",
         "json/src/main/java/org/json/JSONException.java",
diff --git a/ojluni/src/main/java/java/lang/invoke/MutableCallSite.java b/ojluni/src/main/java/java/lang/invoke/MutableCallSite.java
index bb01d4c..6ca8aa0 100644
--- a/ojluni/src/main/java/java/lang/invoke/MutableCallSite.java
+++ b/ojluni/src/main/java/java/lang/invoke/MutableCallSite.java
@@ -25,9 +25,6 @@
 
 package java.lang.invoke;
 
-// Android-changed: not used.
-// import java.util.concurrent.atomic.AtomicInteger;
-
 // Android-changed: removed references to MutableCallSite.syncAll().
 /**
  * A {@code MutableCallSite} is a {@link CallSite} whose target variable
@@ -161,123 +158,125 @@
         return makeDynamicInvoker();
     }
 
-    // Android-changed: not exposing incomplete implementation.
-    // /**
-    //  * Performs a synchronization operation on each call site in the given array,
-    //  * forcing all other threads to throw away any cached values previously
-    //  * loaded from the target of any of the call sites.
-    //  * <p>
-    //  * This operation does not reverse any calls that have already started
-    //  * on an old target value.
-    //  * (Java supports {@linkplain java.lang.Object#wait() forward time travel} only.)
-    //  * <p>
-    //  * The overall effect is to force all future readers of each call site's target
-    //  * to accept the most recently stored value.
-    //  * ("Most recently" is reckoned relative to the {@code syncAll} itself.)
-    //  * Conversely, the {@code syncAll} call may block until all readers have
-    //  * (somehow) decached all previous versions of each call site's target.
-    //  * <p>
-    //  * To avoid race conditions, calls to {@code setTarget} and {@code syncAll}
-    //  * should generally be performed under some sort of mutual exclusion.
-    //  * Note that reader threads may observe an updated target as early
-    //  * as the {@code setTarget} call that install the value
-    //  * (and before the {@code syncAll} that confirms the value).
-    //  * On the other hand, reader threads may observe previous versions of
-    //  * the target until the {@code syncAll} call returns
-    //  * (and after the {@code setTarget} that attempts to convey the updated version).
-    //  * <p>
-    //  * This operation is likely to be expensive and should be used sparingly.
-    //  * If possible, it should be buffered for batch processing on sets of call sites.
-    //  * <p>
-    //  * If {@code sites} contains a null element,
-    //  * a {@code NullPointerException} will be raised.
-    //  * In this case, some non-null elements in the array may be
-    //  * processed before the method returns abnormally.
-    //  * Which elements these are (if any) is implementation-dependent.
-    //  *
-    //  * <h3>Java Memory Model details</h3>
-    //  * In terms of the Java Memory Model, this operation performs a synchronization
-    //  * action which is comparable in effect to the writing of a volatile variable
-    //  * by the current thread, and an eventual volatile read by every other thread
-    //  * that may access one of the affected call sites.
-    //  * <p>
-    //  * The following effects are apparent, for each individual call site {@code S}:
-    //  * <ul>
-    //  * <li>A new volatile variable {@code V} is created, and written by the current thread.
-    //  *     As defined by the JMM, this write is a global synchronization event.
-    //  * <li>As is normal with thread-local ordering of write events,
-    //  *     every action already performed by the current thread is
-    //  *     taken to happen before the volatile write to {@code V}.
-    //  *     (In some implementations, this means that the current thread
-    //  *     performs a global release operation.)
-    //  * <li>Specifically, the write to the current target of {@code S} is
-    //  *     taken to happen before the volatile write to {@code V}.
-    //  * <li>The volatile write to {@code V} is placed
-    //  *     (in an implementation specific manner)
-    //  *     in the global synchronization order.
-    //  * <li>Consider an arbitrary thread {@code T} (other than the current thread).
-    //  *     If {@code T} executes a synchronization action {@code A}
-    //  *     after the volatile write to {@code V} (in the global synchronization order),
-    //  *     it is therefore required to see either the current target
-    //  *     of {@code S}, or a later write to that target,
-    //  *     if it executes a read on the target of {@code S}.
-    //  *     (This constraint is called "synchronization-order consistency".)
-    //  * <li>The JMM specifically allows optimizing compilers to elide
-    //  *     reads or writes of variables that are known to be useless.
-    //  *     Such elided reads and writes have no effect on the happens-before
-    //  *     relation.  Regardless of this fact, the volatile {@code V}
-    //  *     will not be elided, even though its written value is
-    //  *     indeterminate and its read value is not used.
-    //  * </ul>
-    //  * Because of the last point, the implementation behaves as if a
-    //  * volatile read of {@code V} were performed by {@code T}
-    //  * immediately after its action {@code A}.  In the local ordering
-    //  * of actions in {@code T}, this read happens before any future
-    //  * read of the target of {@code S}.  It is as if the
-    //  * implementation arbitrarily picked a read of {@code S}'s target
-    //  * by {@code T}, and forced a read of {@code V} to precede it,
-    //  * thereby ensuring communication of the new target value.
-    //  * <p>
-    //  * As long as the constraints of the Java Memory Model are obeyed,
-    //  * implementations may delay the completion of a {@code syncAll}
-    //  * operation while other threads ({@code T} above) continue to
-    //  * use previous values of {@code S}'s target.
-    //  * However, implementations are (as always) encouraged to avoid
-    //  * livelock, and to eventually require all threads to take account
-    //  * of the updated target.
-    //  *
-    //  * <p style="font-size:smaller;">
-    //  * <em>Discussion:</em>
-    //  * For performance reasons, {@code syncAll} is not a virtual method
-    //  * on a single call site, but rather applies to a set of call sites.
-    //  * Some implementations may incur a large fixed overhead cost
-    //  * for processing one or more synchronization operations,
-    //  * but a small incremental cost for each additional call site.
-    //  * In any case, this operation is likely to be costly, since
-    //  * other threads may have to be somehow interrupted
-    //  * in order to make them notice the updated target value.
-    //  * However, it may be observed that a single call to synchronize
-    //  * several sites has the same formal effect as many calls,
-    //  * each on just one of the sites.
-    //  *
-    //  * <p style="font-size:smaller;">
-    //  * <em>Implementation Note:</em>
-    //  * Simple implementations of {@code MutableCallSite} may use
-    //  * a volatile variable for the target of a mutable call site.
-    //  * In such an implementation, the {@code syncAll} method can be a no-op,
-    //  * and yet it will conform to the JMM behavior documented above.
-    //  *
-    //  * @param sites an array of call sites to be synchronized
-    //  * @throws NullPointerException if the {@code sites} array reference is null
-    //  *                              or the array contains a null
-    //  */
-    // public static void syncAll(MutableCallSite[] sites) {
-    //     if (sites.length == 0)  return;
-    //     STORE_BARRIER.lazySet(0);
-    //     for (int i = 0; i < sites.length; i++) {
-    //         sites[i].getClass();  // trigger NPE on first null
-    //     }
-    //     // FIXME: NYI
-    // }
-    // private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
+    // BEGIN Android-removed: syncAll() implementation is incomplete.
+    /**
+     * Performs a synchronization operation on each call site in the given array,
+     * forcing all other threads to throw away any cached values previously
+     * loaded from the target of any of the call sites.
+     * <p>
+     * This operation does not reverse any calls that have already started
+     * on an old target value.
+     * (Java supports {@linkplain java.lang.Object#wait() forward time travel} only.)
+     * <p>
+     * The overall effect is to force all future readers of each call site's target
+     * to accept the most recently stored value.
+     * ("Most recently" is reckoned relative to the {@code syncAll} itself.)
+     * Conversely, the {@code syncAll} call may block until all readers have
+     * (somehow) decached all previous versions of each call site's target.
+     * <p>
+     * To avoid race conditions, calls to {@code setTarget} and {@code syncAll}
+     * should generally be performed under some sort of mutual exclusion.
+     * Note that reader threads may observe an updated target as early
+     * as the {@code setTarget} call that install the value
+     * (and before the {@code syncAll} that confirms the value).
+     * On the other hand, reader threads may observe previous versions of
+     * the target until the {@code syncAll} call returns
+     * (and after the {@code setTarget} that attempts to convey the updated version).
+     * <p>
+     * This operation is likely to be expensive and should be used sparingly.
+     * If possible, it should be buffered for batch processing on sets of call sites.
+     * <p>
+     * If {@code sites} contains a null element,
+     * a {@code NullPointerException} will be raised.
+     * In this case, some non-null elements in the array may be
+     * processed before the method returns abnormally.
+     * Which elements these are (if any) is implementation-dependent.
+     *
+     * <h1>Java Memory Model details</h1>
+     * In terms of the Java Memory Model, this operation performs a synchronization
+     * action which is comparable in effect to the writing of a volatile variable
+     * by the current thread, and an eventual volatile read by every other thread
+     * that may access one of the affected call sites.
+     * <p>
+     * The following effects are apparent, for each individual call site {@code S}:
+     * <ul>
+     * <li>A new volatile variable {@code V} is created, and written by the current thread.
+     *     As defined by the JMM, this write is a global synchronization event.
+     * <li>As is normal with thread-local ordering of write events,
+     *     every action already performed by the current thread is
+     *     taken to happen before the volatile write to {@code V}.
+     *     (In some implementations, this means that the current thread
+     *     performs a global release operation.)
+     * <li>Specifically, the write to the current target of {@code S} is
+     *     taken to happen before the volatile write to {@code V}.
+     * <li>The volatile write to {@code V} is placed
+     *     (in an implementation specific manner)
+     *     in the global synchronization order.
+     * <li>Consider an arbitrary thread {@code T} (other than the current thread).
+     *     If {@code T} executes a synchronization action {@code A}
+     *     after the volatile write to {@code V} (in the global synchronization order),
+     *     it is therefore required to see either the current target
+     *     of {@code S}, or a later write to that target,
+     *     if it executes a read on the target of {@code S}.
+     *     (This constraint is called "synchronization-order consistency".)
+     * <li>The JMM specifically allows optimizing compilers to elide
+     *     reads or writes of variables that are known to be useless.
+     *     Such elided reads and writes have no effect on the happens-before
+     *     relation.  Regardless of this fact, the volatile {@code V}
+     *     will not be elided, even though its written value is
+     *     indeterminate and its read value is not used.
+     * </ul>
+     * Because of the last point, the implementation behaves as if a
+     * volatile read of {@code V} were performed by {@code T}
+     * immediately after its action {@code A}.  In the local ordering
+     * of actions in {@code T}, this read happens before any future
+     * read of the target of {@code S}.  It is as if the
+     * implementation arbitrarily picked a read of {@code S}'s target
+     * by {@code T}, and forced a read of {@code V} to precede it,
+     * thereby ensuring communication of the new target value.
+     * <p>
+     * As long as the constraints of the Java Memory Model are obeyed,
+     * implementations may delay the completion of a {@code syncAll}
+     * operation while other threads ({@code T} above) continue to
+     * use previous values of {@code S}'s target.
+     * However, implementations are (as always) encouraged to avoid
+     * livelock, and to eventually require all threads to take account
+     * of the updated target.
+     *
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
+     * For performance reasons, {@code syncAll} is not a virtual method
+     * on a single call site, but rather applies to a set of call sites.
+     * Some implementations may incur a large fixed overhead cost
+     * for processing one or more synchronization operations,
+     * but a small incremental cost for each additional call site.
+     * In any case, this operation is likely to be costly, since
+     * other threads may have to be somehow interrupted
+     * in order to make them notice the updated target value.
+     * However, it may be observed that a single call to synchronize
+     * several sites has the same formal effect as many calls,
+     * each on just one of the sites.
+     *
+     * <p style="font-size:smaller;">
+     * <em>Implementation Note:</em>
+     * Simple implementations of {@code MutableCallSite} may use
+     * a volatile variable for the target of a mutable call site.
+     * In such an implementation, the {@code syncAll} method can be a no-op,
+     * and yet it will conform to the JMM behavior documented above.
+     *
+     * @param sites an array of call sites to be synchronized
+     * @throws NullPointerException if the {@code sites} array reference is null
+     *                              or the array contains a null
+     *
+    public static void syncAll(MutableCallSite[] sites) {
+        if (sites.length == 0)  return;
+        STORE_BARRIER.lazySet(0);
+        for (int i = 0; i < sites.length; i++) {
+            sites[i].getClass();  // trigger NPE on first null
+        }
+        // FIXME: NYI
+    }
+    private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
+    */
+    // END Android-removed: syncAll() implementation is incomplete. 
 }
diff --git a/ojluni/src/main/java/java/lang/invoke/VolatileCallSite.java b/ojluni/src/main/java/java/lang/invoke/VolatileCallSite.java
index 6444335..47d2689 100644
--- a/ojluni/src/main/java/java/lang/invoke/VolatileCallSite.java
+++ b/ojluni/src/main/java/java/lang/invoke/VolatileCallSite.java
@@ -25,7 +25,7 @@
 
 package java.lang.invoke;
 
-// Android-changed: removed references to MutableCallSite.syncAll().
+// Android-changed: Removed references to MutableCallSite.syncAll().
 /**
  * A {@code VolatileCallSite} is a {@link CallSite} whose target acts like a volatile variable.
  * An {@code invokedynamic} instruction linked to a {@code VolatileCallSite} sees updates