private static void initSystemProperties() { VMRuntime runtime = VMRuntime.getRuntime(); Properties p = new Properties(); String projectName = "RoboVM"; p.put("java.boot.class.path", runtime.bootClassPath()); p.put("java.class.path", runtime.classPath()); p.put("java.vm.specification.version", "0.9"); p.put("java.vm.vendor", projectName); p.put("java.vm.version", runtime.vmVersion()); parsePropertyAssignments(p, runtime.properties());
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
public static MemoryBlock allocate(int byteCount) { VMRuntime runtime = VMRuntime.getRuntime(); byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, byteCount); long address = runtime.addressOf(array); return new NonMovableHeapBlock(array, address, byteCount); }
@Override public void run() { while (isRunning()) { Object object = waitForObject(); if (object == null) { // We have been interrupted, need to see if this daemon has been stopped. continue; } boolean finalized = waitForFinalization(object); if (!finalized && !VMRuntime.getRuntime().isDebuggerActive()) { finalizerTimedOut(object); break; } } }
@HiddenApi @Implementation(minSdk = O, maxSdk = O_MR1) protected static void applyStyle(long themeToken, int defStyleAttr, int defStyleRes, long xmlParserToken, int[] inAttrs, int length, long outValuesAddress, long outIndicesAddress) { ShadowVMRuntime shadowVMRuntime = Shadow.extract(VMRuntime.getRuntime()); int[] outValues = (int[])shadowVMRuntime.getObjectForAddress(outValuesAddress); int[] outIndices = (int[])shadowVMRuntime.getObjectForAddress(outIndicesAddress); applyStyle(themeToken, defStyleAttr, defStyleRes, xmlParserToken, inAttrs, outValues, outIndices); }
long newsize = 4 * 1024 * 1024; bibleHelper.showErrorLog(" the New Size-->" + newsize); VMRuntime heap = VMRuntime.getRuntime(); bibleHelper.showErrorLog("cur Alocate -->"+ heap.getTargetHeapUtilization()); long oldSize = heap.setMinimumHeapSize(newsize); bibleHelper.showErrorLog("After New Size -->"+ heap.getTargetHeapUtilization());
@Override public void run() { while (isRunning()) { Object object = waitForObject(); if (object == null) { // We have been interrupted, need to see if this daemon has been stopped. continue; } boolean finalized = waitForFinalization(object); if (!finalized && !VMRuntime.getRuntime().isDebuggerActive()) { finalizerTimedOut(object); break; } } }
@HiddenApi @Implementation(minSdk = O, maxSdk = O_MR1) protected static void applyStyle(long themeToken, int defStyleAttr, int defStyleRes, long xmlParserToken, int[] inAttrs, int length, long outValuesAddress, long outIndicesAddress) { ShadowVMRuntime shadowVMRuntime = Shadow.extract(VMRuntime.getRuntime()); int[] outValues = (int[])shadowVMRuntime.getObjectForAddress(outValuesAddress); int[] outIndices = (int[])shadowVMRuntime.getObjectForAddress(outIndicesAddress); applyStyle(themeToken, defStyleAttr, defStyleRes, xmlParserToken, inAttrs, outValues, outIndices); }
private static void initSystemProperties() { VMRuntime runtime = VMRuntime.getRuntime(); Properties p = new Properties(); String projectName = "RoboVM"; p.put("java.boot.class.path", runtime.bootClassPath()); p.put("java.class.path", runtime.classPath()); p.put("java.vm.specification.version", "0.9"); p.put("java.vm.vendor", projectName); p.put("java.vm.version", runtime.vmVersion()); parsePropertyAssignments(p, runtime.properties());
public static MemoryBlock allocate(int byteCount) { VMRuntime runtime = VMRuntime.getRuntime(); byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, byteCount); long address = runtime.addressOf(array); return new NonMovableHeapBlock(array, address, byteCount); }
@Override public void run() { while (isRunning()) { Object object = waitForObject(); if (object == null) { // We have been interrupted, need to see if this daemon has been stopped. continue; } boolean finalized = waitForFinalization(object); if (!finalized && !VMRuntime.getRuntime().isDebuggerActive()) { finalizerTimedOut(object); break; } } }
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
@Implementation(minSdk = P) protected static void nativeApplyStyle(long ptr, long theme_ptr, @AttrRes int def_style_attr, @StyleRes int def_style_resid, long xml_parser_ptr, @NonNull int[] java_attrs, long out_values_ptr, long out_indices_ptr) { CppAssetManager2 assetmanager = AssetManagerFromLong(ptr); Theme theme = Registries.NATIVE_THEME9_REGISTRY.getNativeObject(theme_ptr); CHECK(theme.GetAssetManager() == assetmanager); // (void) assetmanager; ResXMLParser xml_parser = xml_parser_ptr == 0 ? null : NATIVE_RES_XML_PARSERS.getNativeObject(xml_parser_ptr); // int[] out_values = reinterpret_cast<int*>(out_values_ptr); // int[] out_indices = reinterpret_cast<int*>(out_indices_ptr); ShadowVMRuntime shadowVMRuntime = Shadow.extract(VMRuntime.getRuntime()); int[] out_values = (int[])shadowVMRuntime.getObjectForAddress(out_values_ptr); int[] out_indices = (int[])shadowVMRuntime.getObjectForAddress(out_indices_ptr); int attrs_len = java_attrs.length; int[] attrs = java_attrs; // reinterpret_cast<int*>(env.GetPrimitiveArrayCritical(java_attrs, null)); // if (attrs == null) { // return; // } ApplyStyle(theme, xml_parser, (int) (def_style_attr), (int) (def_style_resid), attrs, attrs_len, out_values, out_indices); // env.ReleasePrimitiveArrayCritical(java_attrs, attrs, JNI_ABORT); }
private static void initSystemProperties() { VMRuntime runtime = VMRuntime.getRuntime(); Properties p = new Properties(); String projectName = "RoboVM"; p.put("java.boot.class.path", runtime.bootClassPath()); p.put("java.class.path", runtime.classPath()); p.put("java.vm.specification.version", "0.9"); p.put("java.vm.vendor", projectName); p.put("java.vm.version", runtime.vmVersion()); parsePropertyAssignments(p, runtime.properties());
public static MemoryBlock allocate(int byteCount) { VMRuntime runtime = VMRuntime.getRuntime(); byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, byteCount); long address = runtime.addressOf(array); return new NonMovableHeapBlock(array, address, byteCount); }
@Override public void run() { while (isRunning()) { Object object = waitForObject(); if (object == null) { // We have been interrupted, need to see if this daemon has been stopped. continue; } boolean finalized = waitForFinalization(object); if (!finalized && !VMRuntime.getRuntime().isDebuggerActive()) { finalizerTimedOut(object); break; } } }
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
@HiddenApi @Implementation(minSdk = O, maxSdk = O_MR1) protected static void applyStyle(long themeToken, int defStyleAttr, int defStyleRes, long xmlParserToken, int[] inAttrs, int length, long outValuesAddress, long outIndicesAddress) { ShadowVMRuntime shadowVMRuntime = Shadow.extract(VMRuntime.getRuntime()); int[] outValues = (int[])shadowVMRuntime.getObjectForAddress(outValuesAddress); int[] outIndices = (int[])shadowVMRuntime.getObjectForAddress(outIndicesAddress); applyStyle(themeToken, defStyleAttr, defStyleRes, xmlParserToken, inAttrs, outValues, outIndices); }
private static void initSystemProperties() { VMRuntime runtime = VMRuntime.getRuntime(); Properties p = new Properties(); String projectName = "RoboVM"; p.put("java.boot.class.path", runtime.bootClassPath()); p.put("java.class.path", runtime.classPath()); p.put("java.vm.specification.version", "0.9"); p.put("java.vm.vendor", projectName); p.put("java.vm.version", runtime.vmVersion()); parsePropertyAssignments(p, runtime.properties());
public static MemoryBlock allocate(int byteCount) { VMRuntime runtime = VMRuntime.getRuntime(); byte[] array = (byte[]) runtime.newNonMovableArray(byte.class, byteCount); long address = runtime.addressOf(array); return new NonMovableHeapBlock(array, address, byteCount); }