code rearrangment to improve state of Android libcore tests

This mainly moves several sun.misc.Unsafe method implementations from
classpath-openjdk.cpp to builtin.cpp so that the Avian and Android
builds can use them.

It also replaces FinalizerReference.finalizeAllEnqueued with a no-op,
since the real implementations assumes too much about how the VM
handles (or delegates) finalization.
This commit is contained in:
Joel Dice
2013-04-23 13:47:15 -06:00
parent dfdd1f6e6c
commit 4e12847858
9 changed files with 283 additions and 188 deletions

View File

@ -366,54 +366,12 @@ public final class Class <T> implements Type, AnnotatedElement {
return fields.toArray(new Field[fields.size()]);
}
private int countMethods(boolean publicOnly) {
int count = 0;
if (vmClass.methodTable != null) {
for (int i = 0; i < vmClass.methodTable.length; ++i) {
if (((! publicOnly)
|| ((vmClass.methodTable[i].flags & Modifier.PUBLIC))
!= 0)
&& (! Method.getName(vmClass.methodTable[i]).startsWith("<")))
{
++ count;
}
}
}
return count;
}
public Method[] getDeclaredMethods() {
Method[] array = new Method[countMethods(false)];
if (vmClass.methodTable != null) {
Classes.link(vmClass);
int ai = 0;
for (int i = 0; i < vmClass.methodTable.length; ++i) {
if (! Method.getName(vmClass.methodTable[i]).startsWith("<")) {
array[ai++] = new Method(vmClass.methodTable[i]);
}
}
}
return array;
return Classes.getMethods(vmClass, false);
}
public Method[] getMethods() {
Method[] array = new Method[countMethods(true)];
if (vmClass.methodTable != null) {
Classes.link(vmClass);
int index = 0;
for (int i = 0; i < vmClass.methodTable.length; ++i) {
if (((vmClass.methodTable[i].flags & Modifier.PUBLIC) != 0)
&& (! Method.getName(vmClass.methodTable[i]).startsWith("<")))
{
array[index++] = new Method(vmClass.methodTable[i]);
}
}
}
return array;
return Classes.getMethods(vmClass, true);
}
public Class[] getInterfaces() {
@ -591,7 +549,7 @@ public final class Class <T> implements Type, AnnotatedElement {
}
public Annotation[] getAnnotations() {
Annotation[] array = new Annotation[countMethods(true)];
Annotation[] array = new Annotation[countAnnotations()];
int i = 0;
for (VMClass c = vmClass; c != null; c = c.super_) {
if (c.addendum != null && c.addendum.annotationTable != null) {