summaryrefslogtreecommitdiffstats
path: root/libart/src/main/java/dalvik
diff options
context:
space:
mode:
Diffstat (limited to 'libart/src/main/java/dalvik')
-rw-r--r--libart/src/main/java/dalvik/system/TransactionAbortError.java62
-rw-r--r--libart/src/main/java/dalvik/system/VMRuntime.java42
-rw-r--r--libart/src/main/java/dalvik/system/VMStack.java7
3 files changed, 106 insertions, 5 deletions
diff --git a/libart/src/main/java/dalvik/system/TransactionAbortError.java b/libart/src/main/java/dalvik/system/TransactionAbortError.java
new file mode 100644
index 0000000..cfe4ca2
--- /dev/null
+++ b/libart/src/main/java/dalvik/system/TransactionAbortError.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2015 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 dalvik.system;
+
+/**
+ * An exception only used by the compiler to abort a transaction.
+ *
+ * @hide
+ */
+final class TransactionAbortError extends InternalError {
+ /**
+ * Constructs a new {@code TransactionAbortError} with its stack trace filled in.
+ */
+ private TransactionAbortError() {
+ }
+
+ /**
+ * Constructs a new {@code TransactionAbortError} with its stack trace and detail
+ * message filled in.
+ *
+ * @param detailMessage the detail message for the exception.
+ */
+ private TransactionAbortError(String detailMessage) {
+ super(detailMessage);
+ }
+
+ /**
+ * Constructs a new {@code TransactionAbortError} with detail message and cause
+ * filled in.
+ *
+ * @param message the detail message for the exception.
+ * @param cause the detail cause for the exception.
+ */
+ private TransactionAbortError(String message, Throwable cause) {
+ super(message);
+ initCause(cause);
+ }
+
+ /**
+ * Constructs a new {@code TransactionAbortError} with its detail cause filled in.
+ *
+ * @param cause the detail cause for the exception.
+ */
+ private TransactionAbortError(Throwable cause) {
+ this(cause == null ? null : cause.toString(), cause);
+ }
+
+}
diff --git a/libart/src/main/java/dalvik/system/VMRuntime.java b/libart/src/main/java/dalvik/system/VMRuntime.java
index 43fa00e..aa3f154 100644
--- a/libart/src/main/java/dalvik/system/VMRuntime.java
+++ b/libart/src/main/java/dalvik/system/VMRuntime.java
@@ -16,6 +16,7 @@
package dalvik.system;
+import java.lang.ref.FinalizerReference;
import java.util.HashMap;
import java.util.Map;
@@ -33,6 +34,10 @@ public final class VMRuntime {
*/
private static final VMRuntime THE_ONE = new VMRuntime();
+ // Note: Instruction set names are used to construct the names of some
+ // system properties. To be sure that the properties stay valid the
+ // instruction set name should not exceed 7 characters. See installd
+ // and the package manager for the actual propeties.
private static final Map<String, String> ABI_TO_INSTRUCTION_SET_MAP
= new HashMap<String, String>();
static {
@@ -272,6 +277,12 @@ public final class VMRuntime {
public native void clearGrowthLimit();
/**
+ * Make the current growth limit the new non growth limit capacity by releasing pages which
+ * are after the growth limit but before the non growth limit capacity.
+ */
+ public native void clampGrowthLimit();
+
+ /**
* Returns true if either a Java debugger or native debugger is active.
*/
public native boolean isDebuggerActive();
@@ -291,8 +302,37 @@ public final class VMRuntime {
*/
public native void registerNativeFree(int bytes);
- public native void trimHeap();
+ /**
+ * Wait for objects to be finalized.
+ *
+ * If finalization takes longer than timeout, then the function returns before all objects are
+ * finalized.
+ *
+ * @param timeout
+ * timeout in nanoseconds of the maximum time to wait until all pending finalizers
+ * are run. If timeout is 0, then there is no timeout. Note that the timeout does
+ * not stop the finalization process, it merely stops the wait.
+ *
+ * @see #Runtime.runFinalization()
+ * @see #wait(long,int)
+ */
+ public static void runFinalization(long timeout) {
+ try {
+ FinalizerReference.finalizeAllEnqueued(timeout);
+ } catch (InterruptedException e) {
+ // Interrupt the current thread without actually throwing the InterruptionException
+ // for the caller.
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ public native void requestConcurrentGC();
public native void concurrentGC();
+ public native void requestHeapTrim();
+ public native void trimHeap();
+ public native void startHeapTaskProcessor();
+ public native void stopHeapTaskProcessor();
+ public native void runHeapTasks();
/**
* Let the heap know of the new process state. This can change allocation and garbage collection
diff --git a/libart/src/main/java/dalvik/system/VMStack.java b/libart/src/main/java/dalvik/system/VMStack.java
index ee0a0db..b69ab60 100644
--- a/libart/src/main/java/dalvik/system/VMStack.java
+++ b/libart/src/main/java/dalvik/system/VMStack.java
@@ -48,11 +48,10 @@ public final class VMStack {
native public static Class<?> getStackClass2();
/**
- * Returns the first ClassLoader on the call stack that isn't either of
- * the passed-in ClassLoaders.
+ * Returns the first ClassLoader on the call stack that isn't the
+ * bootstrap class loader.
*/
- public native static ClassLoader getClosestUserClassLoader(ClassLoader bootstrap,
- ClassLoader system);
+ public native static ClassLoader getClosestUserClassLoader();
/**
* Retrieves the stack trace from the specified thread.