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:
sjfink 2007-11-19 16:24:11 +00:00
parent 7a91db9fe6
commit 93f189f42e
3 changed files with 50 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -209,10 +209,16 @@ public class TabulationSolver<T, P> {
*/
public TabulationResult<T, P> solve() throws CancelException {
initialize();
forwardTabulateSLRPs();
Result r = new Result();
return r;
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);
}
}
/**

View File

@ -18,9 +18,13 @@ 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);