X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fcom%2Fbrian_web%2Fgcclass%2FGCClass.java;fp=src%2Fcom%2Fbrian_web%2Fgcclass%2FGCClass.java;h=0000000000000000000000000000000000000000;hb=32dcb3fc4f75dbbce1626045ef25d0c041822b11;hp=86b427148c326658e189f8929049a98f722b8646;hpb=6c5c8ed617e9e8f793cfbe9f0117440bfcb9a0a3;p=org.ibex.gcclass.git diff --git a/src/com/brian_web/gcclass/GCClass.java b/src/com/brian_web/gcclass/GCClass.java deleted file mode 100644 index 86b4271..0000000 --- a/src/com/brian_web/gcclass/GCClass.java +++ /dev/null @@ -1,520 +0,0 @@ -// Copyright (C) 2004 Brian Alliet - -// Based on NanoGoat by Adam Megacz - -// Copyright (C) 2004 Adam Megacz all rights reserved. -// -// You may modify, copy, and redistribute this code under the terms of -// the GNU Library Public License version 2.1, with the exception of -// the portion of clause 6a after the semicolon (aka the "obnoxious -// relink clause") - -package com.brian_web.gcclass; - -import java.util.*; -import java.io.*; - -import org.apache.bcel.Constants; -import org.apache.bcel.util.*; -import org.apache.bcel.generic.*; -import org.apache.bcel.classfile.*; - -public class GCClass { - private static final String[] PRE_REF = { - "java.lang.Thread.run", - "java.security.PrivilegedAction.run" - }; - - // NOTE: This doesn't mean these classes are ignored alltogether - // failures to resolve them are just ignored - private static final String[] IGNORED_METHODS = { - "java.net.SocketImpl.setOption(ILjava/lang/Object;)V", - "java.net.SocketImpl.getOption(I)Ljava/lang/Object;", - "java.awt.geom.*", - "apple.awt.*", - "java.security.*" - }; - - private static final String[] IGNORED_FIELDS = { - "java.io.ObjectInputStream.SUBCLASS_IMPLEMENTATION_PERMISSION" - }; - - private static final String[] NO_OUTPUT = { "java", "javax", "sun", "com.sun", "apple", "com.apple" }; - - - public static void main(String[] args) throws Exception { - if(args.length < 3) { - System.err.println("Usage GCClass classpath outdir entrypoint1 ... [ entrypoint n]"); - System.exit(1); - } - GCClass gc = new GCClass(args[0]); - for(int i=2;i"))) - instansiated.put(new ObjectType(cs),Boolean.TRUE); - - JavaClass c = repoGet(cs); - Method[] methods = c.getMethods(); - for(int i=0;i",Type.VOID,Type.NO_ARGS); - if(findMethod(c,clinit) != null) referenceMethod(clinit); - } - - Method[] methods = c.getMethods(); - JavaClass[] supers = c.getSuperClasses(); - JavaClass[] interfaces = c.getInterfaces(); - - // If a subclass can be instansiated all its superclasses also can - if(instansiated.get(t) != null) { - for(int i=0;i")) return; - - Method m = findMethod(c,mr); - if(m == null) { - JavaClass supers[] = c.getSuperClasses(); - for(int i=0;i",Type.VOID, new Type[]{Type.STRING},Constants.INVOKESPECIAL)); - } else { - il.append(fac.createInvoke("java.lang.UnsatisfiedLinkError","",Type.VOID,Type.NO_ARGS,Constants.INVOKESPECIAL)); - } - il.append(InstructionConstants.ATHROW); - mg.setMaxStack(); - mg.setMaxLocals(); - cg.addMethod(mg.getMethod()); - } - } else { - MethodGen mg = new MethodGen(m,cg.getClassName(),oldCP); - mg.setConstantPool(cp); - if(mg.getInstructionList() != null) mg.getInstructionList().replaceConstantPool(oldCP, cp); - - Attribute[] attrs = m.getAttributes(); - for(int j=0;j