3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

Improved memory use of the Java API. Thanks to Joerg Pfaehler for reporting this issue!

+ formatting

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2015-01-30 21:04:18 -06:00
parent 3b78509d0a
commit d7a62baef4
60 changed files with 3149 additions and 2992 deletions

View file

@ -4399,16 +4399,16 @@ namespace Microsoft.Z3
readonly private ASTMap.DecRefQueue m_ASTMap_DRQ = new ASTMap.DecRefQueue(10);
readonly private ASTVector.DecRefQueue m_ASTVector_DRQ = new ASTVector.DecRefQueue(10);
readonly private ApplyResult.DecRefQueue m_ApplyResult_DRQ = new ApplyResult.DecRefQueue(10);
readonly private FuncInterp.Entry.DecRefQueue m_FuncEntry_DRQ = new FuncInterp.Entry.DecRefQueue();
readonly private FuncInterp.DecRefQueue m_FuncInterp_DRQ = new FuncInterp.DecRefQueue();
readonly private FuncInterp.Entry.DecRefQueue m_FuncEntry_DRQ = new FuncInterp.Entry.DecRefQueue(10);
readonly private FuncInterp.DecRefQueue m_FuncInterp_DRQ = new FuncInterp.DecRefQueue(10);
readonly private Goal.DecRefQueue m_Goal_DRQ = new Goal.DecRefQueue(10);
readonly private Model.DecRefQueue m_Model_DRQ = new Model.DecRefQueue(10);
readonly private Params.DecRefQueue m_Params_DRQ = new Params.DecRefQueue();
readonly private ParamDescrs.DecRefQueue m_ParamDescrs_DRQ = new ParamDescrs.DecRefQueue();
readonly private Probe.DecRefQueue m_Probe_DRQ = new Probe.DecRefQueue();
readonly private Params.DecRefQueue m_Params_DRQ = new Params.DecRefQueue(10);
readonly private ParamDescrs.DecRefQueue m_ParamDescrs_DRQ = new ParamDescrs.DecRefQueue(10);
readonly private Probe.DecRefQueue m_Probe_DRQ = new Probe.DecRefQueue(10);
readonly private Solver.DecRefQueue m_Solver_DRQ = new Solver.DecRefQueue(10);
readonly private Statistics.DecRefQueue m_Statistics_DRQ = new Statistics.DecRefQueue(10);
readonly private Tactic.DecRefQueue m_Tactic_DRQ = new Tactic.DecRefQueue();
readonly private Tactic.DecRefQueue m_Tactic_DRQ = new Tactic.DecRefQueue(10);
readonly private Fixedpoint.DecRefQueue m_Fixedpoint_DRQ = new Fixedpoint.DecRefQueue(10);
internal AST.DecRefQueue AST_DRQ { get { Contract.Ensures(Contract.Result<AST.DecRefQueue>() != null); return m_AST_DRQ; } }

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ASTDecRefQueue extends IDecRefQueue
{
public ASTDecRefQueue()
{
super();
}
public ASTDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ApplyResultDecRefQueue extends IDecRefQueue
{
public ApplyResultDecRefQueue()
{
super();
}
public ApplyResultDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ASTMapDecRefQueue extends IDecRefQueue
{
public ASTMapDecRefQueue()
{
super();
}
public ASTMapDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ASTVectorDecRefQueue extends IDecRefQueue
{
public ASTVectorDecRefQueue()
{
super();
}
public ASTVectorDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -3659,20 +3659,20 @@ public class Context extends IDisposable
}
private ASTDecRefQueue m_AST_DRQ = new ASTDecRefQueue();
private ASTMapDecRefQueue m_ASTMap_DRQ = new ASTMapDecRefQueue();
private ASTVectorDecRefQueue m_ASTVector_DRQ = new ASTVectorDecRefQueue();
private ApplyResultDecRefQueue m_ApplyResult_DRQ = new ApplyResultDecRefQueue();
private FuncInterpEntryDecRefQueue m_FuncEntry_DRQ = new FuncInterpEntryDecRefQueue();
private FuncInterpDecRefQueue m_FuncInterp_DRQ = new FuncInterpDecRefQueue();
private GoalDecRefQueue m_Goal_DRQ = new GoalDecRefQueue();
private ModelDecRefQueue m_Model_DRQ = new ModelDecRefQueue();
private ParamsDecRefQueue m_Params_DRQ = new ParamsDecRefQueue();
private ParamDescrsDecRefQueue m_ParamDescrs_DRQ = new ParamDescrsDecRefQueue();
private ProbeDecRefQueue m_Probe_DRQ = new ProbeDecRefQueue();
private SolverDecRefQueue m_Solver_DRQ = new SolverDecRefQueue();
private StatisticsDecRefQueue m_Statistics_DRQ = new StatisticsDecRefQueue();
private TacticDecRefQueue m_Tactic_DRQ = new TacticDecRefQueue();
private FixedpointDecRefQueue m_Fixedpoint_DRQ = new FixedpointDecRefQueue();
private ASTMapDecRefQueue m_ASTMap_DRQ = new ASTMapDecRefQueue(10);
private ASTVectorDecRefQueue m_ASTVector_DRQ = new ASTVectorDecRefQueue(10);
private ApplyResultDecRefQueue m_ApplyResult_DRQ = new ApplyResultDecRefQueue(10);
private FuncInterpEntryDecRefQueue m_FuncEntry_DRQ = new FuncInterpEntryDecRefQueue(10);
private FuncInterpDecRefQueue m_FuncInterp_DRQ = new FuncInterpDecRefQueue(10);
private GoalDecRefQueue m_Goal_DRQ = new GoalDecRefQueue(10);
private ModelDecRefQueue m_Model_DRQ = new ModelDecRefQueue(10);
private ParamsDecRefQueue m_Params_DRQ = new ParamsDecRefQueue(10);
private ParamDescrsDecRefQueue m_ParamDescrs_DRQ = new ParamDescrsDecRefQueue(10);
private ProbeDecRefQueue m_Probe_DRQ = new ProbeDecRefQueue(10);
private SolverDecRefQueue m_Solver_DRQ = new SolverDecRefQueue(10);
private StatisticsDecRefQueue m_Statistics_DRQ = new StatisticsDecRefQueue(10);
private TacticDecRefQueue m_Tactic_DRQ = new TacticDecRefQueue(10);
private FixedpointDecRefQueue m_Fixedpoint_DRQ = new FixedpointDecRefQueue(10);
ASTDecRefQueue ast_DRQ()
{

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class FixedpointDecRefQueue extends IDecRefQueue
{
public FixedpointDecRefQueue()
{
super();
}
public FixedpointDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class FuncInterpDecRefQueue extends IDecRefQueue
{
public FuncInterpDecRefQueue()
{
super();
}
public FuncInterpDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class FuncInterpEntryDecRefQueue extends IDecRefQueue
{
public FuncInterpEntryDecRefQueue()
{
super();
}
public FuncInterpEntryDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class GoalDecRefQueue extends IDecRefQueue
{
public GoalDecRefQueue()
{
super();
}
public GoalDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -23,7 +23,17 @@ abstract class IDecRefQueue
{
protected Object m_lock = new Object();
protected LinkedList<Long> m_queue = new LinkedList<Long>();
protected final int m_move_limit = 1024;
protected int m_move_limit;
public IDecRefQueue()
{
m_move_limit = 1024;
}
public IDecRefQueue(int move_limit)
{
m_move_limit = move_limit;
}
protected abstract void incRef(Context ctx, long obj);

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ModelDecRefQueue extends IDecRefQueue
{
public ModelDecRefQueue()
{
super();
}
public ModelDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ParamDescrsDecRefQueue extends IDecRefQueue
{
public ParamDescrsDecRefQueue()
{
super();
}
public ParamDescrsDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ParamsDecRefQueue extends IDecRefQueue
{
public ParamsDecRefQueue()
{
super();
}
public ParamsDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class ProbeDecRefQueue extends IDecRefQueue
{
public ProbeDecRefQueue()
{
super();
}
public ProbeDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -121,20 +121,20 @@ public class Solver extends Z3Object
}
}
// /
// / Assert multiple constraints into the solver, and track them (in the
// unsat) core
// / using the Boolean constants in ps.
// /
// / Remarks:
// / This API is an alternative to <see cref="Check"/> with assumptions for
// extracting unsat cores.
// / Both APIs can be used in the same solver. The unsat core will contain a
// combination
// / of the Boolean variables provided using <see cref="AssertAndTrack"/>
// and the Boolean literals
// / provided using <see cref="Check"/> with assumptions.
// /
/**
* Assert multiple constraints into the solver, and track them (in the
* unsat) core
* using the Boolean constants in ps.
*
* Remarks:
* This API is an alternative to <see cref="Check"/> with assumptions for
* extracting unsat cores.
* Both APIs can be used in the same solver. The unsat core will contain a
* combination
* of the Boolean variables provided using <see cref="AssertAndTrack"/>
* and the Boolean literals
* provided using <see cref="Check"/> with assumptions.
**/
public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps) throws Z3Exception
{
getContext().checkContextMatch(constraints);
@ -147,19 +147,19 @@ public class Solver extends Z3Object
constraints[i].getNativeObject(), ps[i].getNativeObject());
}
// /
// / Assert a constraint into the solver, and track it (in the unsat) core
// / using the Boolean constant p.
// /
// / Remarks:
// / This API is an alternative to <see cref="Check"/> with assumptions for
// extracting unsat cores.
// / Both APIs can be used in the same solver. The unsat core will contain a
// combination
// / of the Boolean variables provided using <see cref="AssertAndTrack"/>
// and the Boolean literals
// / provided using <see cref="Check"/> with assumptions.
// /
/**
* Assert a constraint into the solver, and track it (in the unsat) core
* using the Boolean constant p.
*
* Remarks:
* This API is an alternative to <see cref="Check"/> with assumptions for
* extracting unsat cores.
* Both APIs can be used in the same solver. The unsat core will contain a
* combination
* of the Boolean variables provided using <see cref="AssertAndTrack"/>
* and the Boolean literals
* provided using <see cref="Check"/> with assumptions.
*/
public void assertAndTrack(BoolExpr constraint, BoolExpr p) throws Z3Exception
{
getContext().checkContextMatch(constraint);

View file

@ -19,6 +19,13 @@ package com.microsoft.z3;
class SolverDecRefQueue extends IDecRefQueue
{
public SolverDecRefQueue() { super(); }
public SolverDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class StatisticsDecRefQueue extends IDecRefQueue
{
public StatisticsDecRefQueue()
{
super();
}
public StatisticsDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try

View file

@ -19,6 +19,16 @@ package com.microsoft.z3;
class TacticDecRefQueue extends IDecRefQueue
{
public TacticDecRefQueue()
{
super();
}
public TacticDecRefQueue(int move_limit)
{
super(move_limit);
}
protected void incRef(Context ctx, long obj)
{
try