special CancelException support during tabulation
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2058 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
7a91db9fe6
commit
93f189f42e
|
@ -0,0 +1,35 @@
|
|||
/*******************************************************************************
|
||||
* 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.dataflow.IFDS;
|
||||
|
||||
import com.ibm.wala.dataflow.IFDS.TabulationSolver.Result;
|
||||
import com.ibm.wala.eclipse.util.CancelException;
|
||||
|
||||
/**
|
||||
* A {@link CancelException} thrown during tabulation; holds a pointer to a partial {@link Result}.
|
||||
* Use with care, this can hold on to a lot of memory.
|
||||
*
|
||||
* @author sjfink
|
||||
*/
|
||||
public class TabulationCancelException extends CancelException {
|
||||
|
||||
private final Result result;
|
||||
|
||||
protected TabulationCancelException(CancelException cause, Result r) {
|
||||
super(cause);
|
||||
this.result = r;
|
||||
}
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -209,10 +209,16 @@ public class TabulationSolver<T, P> {
|
|||
*/
|
||||
public TabulationResult<T, P> solve() throws CancelException {
|
||||
|
||||
try {
|
||||
initialize();
|
||||
forwardTabulateSLRPs();
|
||||
Result r = new Result();
|
||||
return r;
|
||||
} catch (CancelException e) {
|
||||
// store a partially-tabulated result in the thrown exception.
|
||||
Result r = new Result();
|
||||
throw new TabulationCancelException(e, r);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,10 +18,14 @@ package com.ibm.wala.eclipse.util;
|
|||
*/
|
||||
public class CancelException extends Exception {
|
||||
|
||||
private CancelException(String msg) {
|
||||
protected CancelException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
protected CancelException(Exception cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public static CancelException make(String msg) {
|
||||
return new CancelException(msg);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue