|
From: <ls...@us...> - 2008-12-21 13:21:52
|
Revision: 4802
http://jnode.svn.sourceforge.net/jnode/?rev=4802&view=rev
Author: lsantha
Date: 2008-12-21 13:21:42 +0000 (Sun, 21 Dec 2008)
Log Message:
-----------
Class.getVmClass() refactored to VmType.fromClass().
Modified Paths:
--------------
trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java
trunk/core/src/classpath/vm/java/lang/Class.java
trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java
trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java
trunk/core/src/core/org/jnode/vm/SoftByteCodes.java
trunk/core/src/core/org/jnode/vm/VmJavaClassLoader.java
trunk/core/src/core/org/jnode/vm/VmReflection.java
trunk/core/src/core/org/jnode/vm/VmSystem.java
trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java
trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java
trunk/core/src/core/org/jnode/vm/classmgr/VmAnnotatedElement.java
trunk/core/src/core/org/jnode/vm/classmgr/VmType.java
trunk/core/src/core/org/jnode/vm/memmgr/def/HeapStatisticsVisitor.java
trunk/core/src/openjdk/vm/java/io/NativeObjectStreamClass.java
trunk/core/src/openjdk/vm/java/lang/NativeThrowable.java
trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java
trunk/core/src/openjdk/vm/sun/reflect/NativeNativeConstructorAccessorImpl.java
trunk/core/src/openjdk/vm/sun/reflect/NativeNativeMethodAccessorImpl.java
trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java
trunk/core/src/test/org/jnode/test/ViewMethodTest.java
trunk/shell/src/shell/org/jnode/shell/command/ClassCommand.java
trunk/shell/src/shell/org/jnode/shell/command/CompileCommand.java
trunk/shell/src/shell/org/jnode/shell/command/DisassembleCommand.java
Modified: trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/classpath/vm/gnu/classpath/jdwp/NativeVMVirtualMachine.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -4,11 +4,8 @@
import java.util.ArrayList;
import java.nio.ByteBuffer;
import java.lang.reflect.Method;
-import java.io.DataOutputStream;
import gnu.classpath.jdwp.util.MethodResult;
import gnu.classpath.jdwp.event.EventRequest;
-import gnu.classpath.jdwp.exception.JdwpException;
-import gnu.classpath.jdwp.id.ReferenceTypeId;
import org.jnode.vm.Vm;
import org.jnode.vm.isolate.VmIsolate;
import org.jnode.vm.classmgr.VmIsolatedStatics;
@@ -167,10 +164,10 @@
}
public static void redefineClass(Class oldClass, byte[] classData){
- VmType old_type = oldClass.getVmClass();
+ VmType old_type = VmType.fromClass(oldClass);
VmType new_type = ClassDecoder.defineClass(oldClass.getName(),
ByteBuffer.wrap(classData), false,
- oldClass.getVmClass().getLoader(),
+ VmType.fromClass(oldClass).getLoader(),
oldClass.getProtectionDomain());
for(int i = 0; i < old_type.getNoDeclaredMethods(); i++){
VmMethod old_method = old_type.getDeclaredMethod(i);
Modified: trunk/core/src/classpath/vm/java/lang/Class.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/Class.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/classpath/vm/java/lang/Class.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -114,12 +114,6 @@
*/
private static final long serialVersionUID = 3206093459760846163L;
- /**
- * Permission used in {@link #getVmClass()}
- */
- private static final JNodePermission GETVMCLASS = new JNodePermission(
- "getVmClass");
-
private final VmType<T> vmClass;
private Constructor[] declaredConstructors;
@@ -1050,22 +1044,6 @@
}
/**
- * Gets the JNode VmType (internal) representation of this class. If there
- * is a security manager installed, this method first calls the security
- * manager's checkPermission method with a RuntimePermission("getVmClass")
- * permission to ensure it's ok to get the internal representation.
- *
- * @return the JNode internal representation of this class.
- */
- public final VmType<T> getVmClass() {
- final SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(GETVMCLASS);
- }
- return vmClass;
- }
-
- /**
* Gets a primitive class of a given type.
*
* @param type
Modified: trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -70,7 +70,7 @@
final VmType vmClass = AccessController.doPrivileged(
new PrivilegedAction<VmType>() {
public VmType run() {
- return type.getVmClass();
+ return VmType.fromClass(type);
}
});
Modified: trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java
===================================================================
--- trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/naming/DefaultNameSpace.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -54,10 +54,10 @@
throw new IllegalArgumentException("name == null");
}
synchronized (namespace) {
- if (namespace.containsKey(name.getVmClass())) {
+ if (namespace.containsKey(VmType.fromClass(name))) {
throw new NameAlreadyBoundException(name.getName());
}
- namespace.put(name.getVmClass(), service);
+ namespace.put(VmType.fromClass(name), service);
}
// notify listeners
@@ -74,7 +74,7 @@
public void unbind(Class<?> name) {
final Object service;
synchronized (namespace) {
- service = namespace.remove(name.getVmClass());
+ service = namespace.remove(VmType.fromClass((Class<?>) name));
}
// notify listeners
@@ -89,7 +89,7 @@
*/
@PrivilegedActionPragma
public <T> T lookup(Class<T> name) throws NameNotFoundException {
- final Object result = namespace.get(name.getVmClass());
+ final Object result = namespace.get(VmType.fromClass(name));
if (result == null) {
// if (!VmIsolate.isRoot()) {
// System.out.println("Looking for " + name.getVmClass().hashCode());
Modified: trunk/core/src/core/org/jnode/vm/SoftByteCodes.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/SoftByteCodes.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/SoftByteCodes.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -160,7 +160,7 @@
String cname = classRef.getClassName();
try {
Class<?> cls = curLoader.asClassLoader().loadClass(cname);
- VmType<?> vmClass = cls.getVmClass();
+ VmType<?> vmClass = VmType.fromClass(cls);
/*
* VmClass vmClass = curLoader.loadClass(cname, true); //VmClass
Modified: trunk/core/src/core/org/jnode/vm/VmJavaClassLoader.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmJavaClassLoader.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/VmJavaClassLoader.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -126,7 +126,7 @@
addLoadedClass(className, cls);
} else {
final Class<?> javaType = loader.loadClass(className);
- cls = javaType.getVmClass();
+ cls = VmType.fromClass((Class<?>) javaType);
}
if (resolve) {
cls.link();
Modified: trunk/core/src/core/org/jnode/vm/VmReflection.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmReflection.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/VmReflection.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -343,7 +343,7 @@
Unsafe.pushObject(o);
if (!method.isConstructor()) {
- method = o.getClass().getVmClass().getMethod(method.getName(), method.getSignature());
+ method = VmType.fromClass(o.getClass()).getMethod(method.getName(), method.getSignature());
}
} else {
method.getDeclaringClass().initialize();
Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystem.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -180,7 +180,7 @@
//todo this will be moved to java.lang.System during openjdk integration
sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess() {
public sun.reflect.ConstantPool getConstantPool(Class klass) {
- return new VmConstantPool(klass.getVmClass());
+ return new VmConstantPool(VmType.fromClass(klass));
}
public void setAnnotationType(Class klass, AnnotationType type) {
@@ -212,9 +212,15 @@
* @return the system output stream
*/
public static PrintStream getSystemOut() {
+ SystemOutputStream sout = null;
+ if (bootOut == null) {
+ // initialization trick to avoid circularity and setting bootOut twice
+ //todo review when migrating java.lang.System to OpenJDK
+ sout = new SystemOutputStream();
+ }
if (bootOut == null) {
- bootOut = new SystemOutputStream();
+ bootOut = sout;
bootOutStream = new PrintStream(bootOut, true);
IOContext ioContext = getIOContext();
ioContext.setGlobalOutStream(bootOutStream);
@@ -1066,7 +1072,7 @@
@PrivilegedActionPragma
public static void setStaticField(Class<?> clazz, String fieldName,
Object value) {
- final VmStaticField f = (VmStaticField) clazz.getVmClass().getField(
+ final VmStaticField f = (VmStaticField) VmType.fromClass((Class<?>) clazz).getField(
fieldName);
final Object staticsTable;
final Offset offset;
Modified: trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -299,7 +299,7 @@
if ((parent != null) && !parent.skipParentLoader(name)) {
try {
final Class<?> cls = parent.loadClass(name);
- return cls.getVmClass();
+ return VmType.fromClass((Class<?>) cls);
} catch (ClassNotFoundException ex) {
// Don't care, try it ourselves.
}
Modified: trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/classmgr/ClassDecoder.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -991,28 +991,28 @@
if (vtm.isPrimitive()) {
switch (vtm.getJvmType()) {
case JvmType.BOOLEAN:
- vtm = Boolean.class.getVmClass();
+ vtm = VmType.fromClass(Boolean.class);
break;
case JvmType.BYTE:
- vtm = Byte.class.getVmClass();
+ vtm = VmType.fromClass(Byte.class);
break;
case JvmType.SHORT:
- vtm = Short.class.getVmClass();
+ vtm = VmType.fromClass(Short.class);
break;
case JvmType.CHAR:
- vtm = Character.class.getVmClass();
+ vtm = VmType.fromClass(Character.class);
break;
case JvmType.INT:
- vtm = Integer.class.getVmClass();
+ vtm = VmType.fromClass(Integer.class);
break;
case JvmType.FLOAT:
- vtm = Float.class.getVmClass();
+ vtm = VmType.fromClass(Float.class);
break;
case JvmType.LONG:
- vtm = Long.class.getVmClass();
+ vtm = VmType.fromClass(Long.class);
break;
case JvmType.DOUBLE:
- vtm = Double.class.getVmClass();
+ vtm = VmType.fromClass(Double.class);
break;
}
@@ -1239,28 +1239,28 @@
if (vtm.isPrimitive()) {
switch (vtm.getJvmType()) {
case JvmType.BOOLEAN:
- vtm = Boolean.class.getVmClass();
+ vtm = VmType.fromClass(Boolean.class);
break;
case JvmType.BYTE:
- vtm = Byte.class.getVmClass();
+ vtm = VmType.fromClass(Byte.class);
break;
case JvmType.SHORT:
- vtm = Short.class.getVmClass();
+ vtm = VmType.fromClass(Short.class);
break;
case JvmType.CHAR:
- vtm = Character.class.getVmClass();
+ vtm = VmType.fromClass(Character.class);
break;
case JvmType.INT:
- vtm = Integer.class.getVmClass();
+ vtm = VmType.fromClass(Integer.class);
break;
case JvmType.FLOAT:
- vtm = Float.class.getVmClass();
+ vtm = VmType.fromClass(Float.class);
break;
case JvmType.LONG:
- vtm = Long.class.getVmClass();
+ vtm = VmType.fromClass(Long.class);
break;
case JvmType.DOUBLE:
- vtm = Double.class.getVmClass();
+ vtm = VmType.fromClass(Double.class);
break;
}
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmAnnotatedElement.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmAnnotatedElement.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmAnnotatedElement.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -62,7 +62,7 @@
public final <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
if (runtimeAnnotations.length > 0) {
final VmClassLoader loader = getLoader();
- final VmType<T> reqType = annotationClass.getVmClass();
+ final VmType<T> reqType = VmType.fromClass(annotationClass);
for (VmAnnotation ann : runtimeAnnotations) {
if (ann.annotationType(loader) == reqType) {
try {
@@ -133,7 +133,7 @@
Class<? extends Annotation> annotationClass) {
if (runtimeAnnotations.length > 0) {
final VmClassLoader loader = getLoader();
- final VmType<?> reqType = annotationClass.getVmClass();
+ final VmType<?> reqType = VmType.fromClass((Class<? extends Annotation>) annotationClass);
for (VmAnnotation ann : runtimeAnnotations) {
if (ann.annotationType(loader) == reqType) {
return true;
Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmType.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/classmgr/VmType.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/classmgr/VmType.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -50,7 +50,9 @@
import org.jnode.vm.compiler.CompiledIMT;
import org.jnode.vm.compiler.NativeCodeCompiler;
import org.jnode.vm.isolate.VmIsolateLocal;
+import org.jnode.security.JNodePermission;
import org.vmmagic.unboxed.Address;
+import org.vmmagic.unboxed.ObjectReference;
@SharedStatics
@Uninterruptible
@@ -223,6 +225,8 @@
private static VmNormalClass VoidClass;
+ private static VmNormalClass ClassClass;
+
private static VmArrayClass<boolean[]> BooleanArrayClass;
private static VmArrayClass<byte[]> ByteArrayClass;
@@ -344,12 +348,14 @@
public static VmType[] initializeForBootImage(VmSystemClassLoader clc)
throws ClassNotFoundException {
ObjectClass = (VmNormalClass) clc.loadClass("java.lang.Object", false);
+ ClassClass = (VmNormalClass) clc.loadClass("java.lang.Class", false);
CloneableClass = (VmInterfaceClass) clc.loadClass(
"java.lang.Cloneable", false);
SerializableClass = (VmInterfaceClass) clc.loadClass(
"java.io.Serializable", false);
ObjectClass.link();
+ ClassClass.link();
CloneableClass.link();
SerializableClass.link();
@@ -403,7 +409,7 @@
DoubleArrayClass.link();
ObjectArrayClass.link();
- return new VmType[]{ObjectClass, CloneableClass, SerializableClass,
+ return new VmType[]{ObjectClass, ClassClass, CloneableClass, SerializableClass,
BooleanClass, ByteClass, CharClass, ShortClass, IntClass,
FloatClass, LongClass, DoubleClass, VoidClass,
BooleanArrayClass, ByteArrayClass, CharArrayClass,
@@ -466,6 +472,8 @@
} else {
if (name.equals("java.lang.Object")) {
ObjectClass = (VmNormalClass) vmClass;
+ } else if (name.equals("java.lang.Class")) {
+ ClassClass = (VmNormalClass) vmClass;
} else if (name.equals("java.lang.Cloneable")) {
CloneableClass = (VmInterfaceClass) vmClass;
} else if (name.equals("java.io.Serializable")) {
@@ -2418,4 +2426,23 @@
public final int getIsolatedStaticsIndex() {
return isolatedStaticsIndex;
}
+
+ /**
+ * Permission used in {@link #fromClass(Class)}
+ */
+ private static final JNodePermission GETVMCLASS = new JNodePermission("getVmClass");
+ private static int FIELD_OFFSET = -1;
+ public static <V> VmType<V> fromClass(Class<V> clazz) {
+ if (FIELD_OFFSET == -1) {
+ FIELD_OFFSET = ((VmInstanceField) ClassClass.getDeclaredField("vmClass")).getOffset();
+ }
+
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(GETVMCLASS);
+ }
+
+ return (VmType<V>) ObjectReference.fromObject(clazz).toAddress().add(FIELD_OFFSET).
+ loadObjectReference().toObject();
+ }
}
Modified: trunk/core/src/core/org/jnode/vm/memmgr/def/HeapStatisticsVisitor.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/def/HeapStatisticsVisitor.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/core/org/jnode/vm/memmgr/def/HeapStatisticsVisitor.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -48,7 +48,7 @@
public final boolean visit(Object object) {
int size = 0;
if (!heapStatistics.contains(object.getClass().getName())) {
- final VmType<?> type = object.getClass().getVmClass();
+ final VmType<?> type = VmType.fromClass(object.getClass());
size = (type instanceof VmNormalClass ? ((VmNormalClass<?>) type)
.getObjectSize() : 0);
}
Modified: trunk/core/src/openjdk/vm/java/io/NativeObjectStreamClass.java
===================================================================
--- trunk/core/src/openjdk/vm/java/io/NativeObjectStreamClass.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/openjdk/vm/java/io/NativeObjectStreamClass.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -18,7 +18,7 @@
* @see java.io.ObjectStreamClass#hasStaticInitializer(java.lang.Class)
*/
private static boolean hasStaticInitializer(Class clazz) {
- VmType vmt = clazz.getVmClass();
+ VmType vmt = VmType.fromClass(clazz);
VmMethod met = vmt.getDeclaredMethod("<clinit>", "()V");
return met != null && met.isStatic();
}
Modified: trunk/core/src/openjdk/vm/java/lang/NativeThrowable.java
===================================================================
--- trunk/core/src/openjdk/vm/java/lang/NativeThrowable.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/openjdk/vm/java/lang/NativeThrowable.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -18,7 +18,9 @@
*/
@MagicPermission
class NativeThrowable {
- private static int BACKTRACE_OFFSET = ((VmInstanceField)Throwable.class.getVmClass().getField("backtrace")).getOffset();
+ private static int BACKTRACE_OFFSET = ((VmInstanceField) VmType.fromClass(Throwable.class).
+ getField("backtrace")).getOffset();
+
private static synchronized Throwable fillInStackTrace(Throwable instance){
ObjectReference.fromObject(instance).toAddress().add(BACKTRACE_OFFSET).
store(ObjectReference.fromObject(VmThread.getStackTrace(VmProcessor.current().getCurrentThread())));
Modified: trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java
===================================================================
--- trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/openjdk/vm/sun/misc/NativeUnsafe.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -11,7 +11,6 @@
import java.security.Policy;
import java.security.cert.Certificate;
import java.util.Map;
-import java.util.Hashtable;
import java.util.HashMap;
import org.vmmagic.unboxed.ObjectReference;
import org.vmmagic.unboxed.Address;
@@ -416,13 +415,13 @@
}
private static VmField getVmField(Field f) {
- VmType<?> vmClass = f.getDeclaringClass().getVmClass();
+ VmType<?> vmClass = VmType.fromClass((Class<?>) f.getDeclaringClass());
vmClass.link();
return vmClass.getField(f.getName());
}
public static void ensureClassInitialized(Unsafe instance, Class c) {
- c.getVmClass().initialize();
+ VmType.fromClass(c).initialize();
}
public static int arrayBaseOffset(Unsafe instance, Class arrayClass) {
Modified: trunk/core/src/openjdk/vm/sun/reflect/NativeNativeConstructorAccessorImpl.java
===================================================================
--- trunk/core/src/openjdk/vm/sun/reflect/NativeNativeConstructorAccessorImpl.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/openjdk/vm/sun/reflect/NativeNativeConstructorAccessorImpl.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -16,7 +16,7 @@
private static Object newInstance0(Constructor arg1, Object[] arg2) throws InstantiationException,
IllegalArgumentException,
InvocationTargetException{
- VmType vmt = arg1.getDeclaringClass().getVmClass();
+ VmType vmt = VmType.fromClass(arg1.getDeclaringClass());
VmMethod vmm = vmt.getDeclaredMethod(arg1.getSlot());
try {
return VmReflection.newInstance(vmm, arg2);
Modified: trunk/core/src/openjdk/vm/sun/reflect/NativeNativeMethodAccessorImpl.java
===================================================================
--- trunk/core/src/openjdk/vm/sun/reflect/NativeNativeMethodAccessorImpl.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/openjdk/vm/sun/reflect/NativeNativeMethodAccessorImpl.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -15,7 +15,7 @@
*/
private static Object invoke0(Method arg1, Object arg2, Object[] arg3) throws IllegalArgumentException,
InvocationTargetException {
- VmType vmt = arg1.getDeclaringClass().getVmClass();
+ VmType vmt = VmType.fromClass((Class<?>) arg1.getDeclaringClass());
VmMethod vmm = vmt.getDeclaredMethod(arg1.getSlot());
return VmReflection.invoke(vmm, arg2, arg3);
}
Modified: trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java
===================================================================
--- trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/openjdk/vm/sun/reflect/NativeReflection.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -4,6 +4,7 @@
package sun.reflect;
import org.jnode.vm.VmSystem;
+import org.jnode.vm.classmgr.VmType;
/**
* @see sun.reflect.Reflection
@@ -28,7 +29,7 @@
* @see Reflection#getClassAccessFlags(Class)
*/
static int getClassAccessFlags(Class c) {
- return c.getVmClass().getAccessFlags();
+ return VmType.fromClass(c).getAccessFlags();
}
}
Modified: trunk/core/src/test/org/jnode/test/ViewMethodTest.java
===================================================================
--- trunk/core/src/test/org/jnode/test/ViewMethodTest.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/core/src/test/org/jnode/test/ViewMethodTest.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -34,7 +34,7 @@
final String mname = (args.length > 1) ? args[1] : null;
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- final VmType cls = cl.loadClass(className).getVmClass();
+ final VmType cls = VmType.fromClass(cl.loadClass(className));
final int cnt = cls.getNoDeclaredMethods();
for (int i = 0; i < cnt; i++) {
Modified: trunk/shell/src/shell/org/jnode/shell/command/ClassCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/ClassCommand.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/shell/src/shell/org/jnode/shell/command/ClassCommand.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -67,7 +67,7 @@
final VmType<?> vmType = AccessController.doPrivileged(
new PrivilegedAction<VmType<?>>() {
public VmType<?> run() {
- return type.getVmClass();
+ return VmType.fromClass((Class<?>) type);
}
});
out.println("Name : " + type.getName());
Modified: trunk/shell/src/shell/org/jnode/shell/command/CompileCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/CompileCommand.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/shell/src/shell/org/jnode/shell/command/CompileCommand.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -82,7 +82,7 @@
final Class<?> cls;
try {
cls = cl.loadClass(className);
- final VmType<?> type = cls.getVmClass();
+ final VmType<?> type = VmType.fromClass((Class<?>) cls);
final long start = System.currentTimeMillis();
final int count = type.compileRuntime(level, test);
final long end = System.currentTimeMillis();
Modified: trunk/shell/src/shell/org/jnode/shell/command/DisassembleCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/DisassembleCommand.java 2008-12-21 12:27:12 UTC (rev 4801)
+++ trunk/shell/src/shell/org/jnode/shell/command/DisassembleCommand.java 2008-12-21 13:21:42 UTC (rev 4802)
@@ -80,7 +80,7 @@
// not reached
return;
}
- final VmType<?> type = cls.getVmClass();
+ final VmType<?> type = VmType.fromClass((Class<?>) cls);
if (test) {
if (maxTestLevel == -1) {
err.println("No test compilers are currently registered");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|