Package EDU.purdue.cs.bloat.context
Class PersistentBloatContext
- java.lang.Object
-
- EDU.purdue.cs.bloat.context.BloatContext
-
- EDU.purdue.cs.bloat.context.PersistentBloatContext
-
- All Implemented Interfaces:
EditorContext,EDU.purdue.cs.bloat.inline.InlineContext
- Direct Known Subclasses:
CachingBloatContext
public class PersistentBloatContext extends BloatContext
Maintains all BLOAT data structures as if they were meant to reside in a persistent store. As a result, it keeps every piece of BLOAT data around because it might be needed in the future. No fancing cache maintainence is performed. Because we are going for maximum information we take the closure of classes when working with the class hierarchy.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.MapclassEditorsprotected java.util.MapclassInfosstatic booleanDB_COMMITprotected java.util.MapfieldEditorsprotected java.util.MapfieldInfosprotected ClassHierarchyhierarchyprotected java.util.MapmethodEditorsprotected java.util.MapmethodInfos-
Fields inherited from class EDU.purdue.cs.bloat.context.BloatContext
callGraph, DEBUG, ignoreClasses, ignoreFields, ignoreMethods, ignorePackages, ignoreSystem, inlineStats, loader, roots
-
-
Constructor Summary
Constructors Modifier Constructor Description PersistentBloatContext(ClassInfoLoader loader)Constructor.protectedPersistentBloatContext(ClassInfoLoader loader, boolean closure)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddClasses(java.util.Collection classes)Adds a bunch of (names of) classes to the hierarchy.protected static voidcomm(java.lang.String s)voidcommit()Commits all changes made to classes, methods, and fields.voidcommit(ClassInfo info)Classes that are ignored are not committed.voidcommit(FieldInfo info)Commits the changes made to a field.voidcommit(MethodInfo info)Commits the changes made to a method.voidcommitDirty()Commits all classes, methods, and fields, that have been modified.ClassEditoreditClass(Type classType)Returns a ClassEditor used to edit a class described by a given Type.ClassEditoreditClass(ClassInfo info)Returns a ClassEditor used to edit a class described by a given ClassInfo.ClassEditoreditClass(java.lang.String className)Returns a ClassEditor used to edit a class of a given name.FieldEditoreditField(MemberRef field)Returns a FieldEditor for editing a field.FieldEditoreditField(FieldInfo info)Returns a FieldEditor for editing a FieldInfo.MethodEditoreditMethod(MemberRef method)Returns a MethodEditor for editing a method.MethodEditoreditMethod(MethodInfo info)Returns a MethodEditor for editing a method.ClassHierarchygetHierarchy()Returns the ClassHierarchy of all classes and interfaces known to BLOAT.ClassInfoloadClass(java.lang.String className)Loads a class into BLOATClassEditornewClass(int modifiers, java.lang.String className, Type superType, Type[] interfaces)Returns aClassEditorfor editing a new class with the given name.ClassInfonewClassInfo(int modifiers, int classIndex, int superClassIndex, int[] interfaceIndexes, java.util.List constants)Creates a newClassInfovoidrelease(ClassEditor ce)voidrelease(ClassInfo info)Signals that we are done editing a class.voidrelease(FieldInfo info)Signals that we are done editing a field.voidrelease(MethodInfo info)Signals that we are done editing a method.-
Methods inherited from class EDU.purdue.cs.bloat.context.BloatContext
addIgnoreClass, addIgnoreField, addIgnoreMethod, addIgnorePackage, db, getCallGraph, getInlineStats, ignoreClass, ignoreField, ignoreMethod, isSystem, main, setIgnoreSystem, setRootMethods
-
-
-
-
Field Detail
-
hierarchy
protected final ClassHierarchy hierarchy
-
classInfos
protected java.util.Map classInfos
-
methodInfos
protected java.util.Map methodInfos
-
fieldInfos
protected java.util.Map fieldInfos
-
classEditors
protected java.util.Map classEditors
-
methodEditors
protected java.util.Map methodEditors
-
fieldEditors
protected java.util.Map fieldEditors
-
DB_COMMIT
public static boolean DB_COMMIT
-
-
Constructor Detail
-
PersistentBloatContext
public PersistentBloatContext(ClassInfoLoader loader)
Constructor. Each BloatContext stems from a ClassInfoLoader. Using the loader it can create an Editor and such. Initially, no classes are loaded.
-
PersistentBloatContext
protected PersistentBloatContext(ClassInfoLoader loader, boolean closure)
Constructor. It is the responsibility of the subclasses to add classes to the hierarchy by calling addClasses.- Parameters:
loader- Used to load classesclosure- Do we look for the maximum number of classes?
-
-
Method Detail
-
comm
protected static void comm(java.lang.String s)
-
addClasses
protected void addClasses(java.util.Collection classes)
Adds a bunch of (names of) classes to the hierarchy.
-
loadClass
public ClassInfo loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
Description copied from interface:EditorContextLoads a class into BLOAT- Throws:
java.lang.ClassNotFoundException
-
newClassInfo
public ClassInfo newClassInfo(int modifiers, int classIndex, int superClassIndex, int[] interfaceIndexes, java.util.List constants)
Description copied from interface:EditorContextCreates a newClassInfo- Parameters:
modifiers- The modifiers describing the newly-created classclassIndex- The index of the name of the newly-created class in its constant poolsuperClassIndex- The index of the name of the newly-created class's superclass in its constant poolinterfaceIndexes- The indexes of the names of the interfaces that the newly-created class implementsconstants- The constant pool for the newly created class (a list ofConstants).
-
getHierarchy
public ClassHierarchy getHierarchy()
Description copied from interface:EditorContextReturns the ClassHierarchy of all classes and interfaces known to BLOAT.
-
newClass
public ClassEditor newClass(int modifiers, java.lang.String className, Type superType, Type[] interfaces)
Description copied from interface:EditorContextReturns aClassEditorfor editing a new class with the given name. It will override any class with the given name that is already being edited.
-
editClass
public ClassEditor editClass(java.lang.String className) throws java.lang.ClassNotFoundException, ClassFormatException
Description copied from interface:EditorContextReturns a ClassEditor used to edit a class of a given name.- Throws:
java.lang.ClassNotFoundExceptionClassFormatException
-
editClass
public ClassEditor editClass(Type classType) throws java.lang.ClassNotFoundException, ClassFormatException
Description copied from interface:EditorContextReturns a ClassEditor used to edit a class described by a given Type.- Throws:
java.lang.ClassNotFoundExceptionClassFormatException
-
editClass
public ClassEditor editClass(ClassInfo info)
Description copied from interface:EditorContextReturns a ClassEditor used to edit a class described by a given ClassInfo.
-
editMethod
public MethodEditor editMethod(MemberRef method) throws java.lang.NoSuchMethodException
Description copied from interface:EditorContextReturns a MethodEditor for editing a method.- Throws:
java.lang.NoSuchMethodException
-
editMethod
public MethodEditor editMethod(MethodInfo info)
Description copied from interface:EditorContextReturns a MethodEditor for editing a method.
-
editField
public FieldEditor editField(MemberRef field) throws java.lang.NoSuchFieldException
Description copied from interface:EditorContextReturns a FieldEditor for editing a field.- Throws:
java.lang.NoSuchFieldException
-
editField
public FieldEditor editField(FieldInfo info)
Description copied from interface:EditorContextReturns a FieldEditor for editing a FieldInfo.
-
release
public void release(ClassInfo info)
Description copied from interface:EditorContextSignals that we are done editing a class. The object used to model it may be reclaimed.
-
release
public void release(ClassEditor ce)
-
release
public void release(MethodInfo info)
Description copied from interface:EditorContextSignals that we are done editing a method. The object used to model it may be reclaimed.
-
release
public void release(FieldInfo info)
Description copied from interface:EditorContextSignals that we are done editing a field. The object used to model it may be reclaimed.
-
commit
public void commit(ClassInfo info)
Classes that are ignored are not committed.- See Also:
BloatContext.ignoreClass(Type)
-
commit
public void commit(MethodInfo info)
Description copied from interface:EditorContextCommits the changes made to a method.
-
commit
public void commit(FieldInfo info)
Description copied from interface:EditorContextCommits the changes made to a field.
-
commit
public void commit()
Description copied from interface:EditorContextCommits all changes made to classes, methods, and fields.
-
commitDirty
public void commitDirty()
Description copied from class:BloatContextCommits all classes, methods, and fields, that have been modified.- Specified by:
commitDirtyin classBloatContext
-
-