org.xwt.mips -> org.ibex.nestedvm
[nestedvm.git] / src / org / xwt / mips / ClassLoader.java
diff --git a/src/org/xwt/mips/ClassLoader.java b/src/org/xwt/mips/ClassLoader.java
deleted file mode 100644 (file)
index 510d309..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.xwt.mips;
-
-import java.io.*;
-
-// FEATURE: This is just a quick hack, it is really ugly and broken
-
-public class ClassLoader extends java.lang.ClassLoader {
-    public Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        Class c;
-        if(name.startsWith("mips.")) {
-            String path = name.substring(5).replace('.','/') + ".mips";
-            try {
-                ByteArrayOutputStream bos = new ByteArrayOutputStream();
-                new ClassFileCompiler(path,name,bos).go();
-                bos.close();
-                byte[] buf = bos.toByteArray();
-                c = defineClass(name,buf,0,buf.length);
-            } catch(IOException e) {
-                throw new ClassNotFoundException(name);
-            } catch(Compiler.Exn e) {
-                throw new ClassNotFoundException(e.getMessage());
-            }
-        } else {
-            c = findSystemClass(name);
-        }
-            
-        if(c == null) throw new ClassNotFoundException(name);
-        if(resolve) resolveClass(c);
-        return c;
-    }
-    
-    public Class classFromBinary(String path) throws ClassNotFoundException {
-        if(!path.endsWith(".mips")) throw new IllegalArgumentException("isn't a .mips");
-        return loadClass("mips." + path.substring(0,path.length()-5).replace('/','.'));
-    }
-    
-    public Runtime runtimeFromBinary(String path) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
-        return (Runtime) classFromBinary(path).newInstance();
-    }
-    
-    public static void main(String[] args) throws Exception {
-        System.exit(new ClassLoader().runtimeFromBinary(args[0]).run(args));
-    }
-}