2007-07-20 15:20:41 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2007 IBM Corporation.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial API and implementation
|
|
|
|
*******************************************************************************/
|
|
|
|
package com.ibm.wala.ipa.callgraph;
|
|
|
|
|
|
|
|
import com.ibm.wala.classLoader.IMethod;
|
|
|
|
import com.ibm.wala.ssa.DefaultIRFactory;
|
|
|
|
import com.ibm.wala.ssa.IRFactory;
|
|
|
|
import com.ibm.wala.ssa.SSACache;
|
2008-01-24 22:05:28 +00:00
|
|
|
import com.ibm.wala.util.ref.ReferenceCleanser;
|
2007-07-20 15:20:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A place to hold onto caches of various analysis artifacts.
|
|
|
|
*
|
|
|
|
* Someday this should maybe go away?
|
|
|
|
*/
|
|
|
|
public class AnalysisCache {
|
2007-09-01 14:41:14 +00:00
|
|
|
private final IRFactory<IMethod> irFactory;
|
2007-07-20 15:20:41 +00:00
|
|
|
|
|
|
|
private final SSACache ssaCache;
|
|
|
|
|
2007-09-01 14:41:14 +00:00
|
|
|
public AnalysisCache(IRFactory<IMethod> irFactory) {
|
2007-07-20 15:20:41 +00:00
|
|
|
super();
|
|
|
|
this.irFactory = irFactory;
|
|
|
|
this.ssaCache = new SSACache(irFactory);
|
|
|
|
ReferenceCleanser.registerCache(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public AnalysisCache() {
|
|
|
|
this(new DefaultIRFactory());
|
|
|
|
}
|
|
|
|
|
|
|
|
public void invalidate(IMethod method, Context C) {
|
|
|
|
ssaCache.invalidate(method, C);
|
|
|
|
}
|
|
|
|
|
|
|
|
public SSACache getSSACache() {
|
|
|
|
return ssaCache;
|
|
|
|
}
|
|
|
|
|
2007-09-01 14:41:14 +00:00
|
|
|
public IRFactory<IMethod> getIRFactory() {
|
2007-07-20 15:20:41 +00:00
|
|
|
return irFactory;
|
|
|
|
}
|
|
|
|
}
|