mirror of
https://github.com/Z3Prover/z3
synced 2025-04-13 12:28:44 +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:
parent
3b78509d0a
commit
d7a62baef4
|
@ -4399,16 +4399,16 @@ namespace Microsoft.Z3
|
||||||
readonly private ASTMap.DecRefQueue m_ASTMap_DRQ = new ASTMap.DecRefQueue(10);
|
readonly private ASTMap.DecRefQueue m_ASTMap_DRQ = new ASTMap.DecRefQueue(10);
|
||||||
readonly private ASTVector.DecRefQueue m_ASTVector_DRQ = new ASTVector.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 ApplyResult.DecRefQueue m_ApplyResult_DRQ = new ApplyResult.DecRefQueue(10);
|
||||||
readonly private FuncInterp.Entry.DecRefQueue m_FuncEntry_DRQ = new FuncInterp.Entry.DecRefQueue();
|
readonly private FuncInterp.Entry.DecRefQueue m_FuncEntry_DRQ = new FuncInterp.Entry.DecRefQueue(10);
|
||||||
readonly private FuncInterp.DecRefQueue m_FuncInterp_DRQ = new FuncInterp.DecRefQueue();
|
readonly private FuncInterp.DecRefQueue m_FuncInterp_DRQ = new FuncInterp.DecRefQueue(10);
|
||||||
readonly private Goal.DecRefQueue m_Goal_DRQ = new Goal.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 Model.DecRefQueue m_Model_DRQ = new Model.DecRefQueue(10);
|
||||||
readonly private Params.DecRefQueue m_Params_DRQ = new Params.DecRefQueue();
|
readonly private Params.DecRefQueue m_Params_DRQ = new Params.DecRefQueue(10);
|
||||||
readonly private ParamDescrs.DecRefQueue m_ParamDescrs_DRQ = new ParamDescrs.DecRefQueue();
|
readonly private ParamDescrs.DecRefQueue m_ParamDescrs_DRQ = new ParamDescrs.DecRefQueue(10);
|
||||||
readonly private Probe.DecRefQueue m_Probe_DRQ = new Probe.DecRefQueue();
|
readonly private Probe.DecRefQueue m_Probe_DRQ = new Probe.DecRefQueue(10);
|
||||||
readonly private Solver.DecRefQueue m_Solver_DRQ = new Solver.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 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);
|
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; } }
|
internal AST.DecRefQueue AST_DRQ { get { Contract.Ensures(Contract.Result<AST.DecRefQueue>() != null); return m_AST_DRQ; } }
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class ASTDecRefQueue extends IDecRefQueue
|
class ASTDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public ASTDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ASTDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class ApplyResultDecRefQueue extends IDecRefQueue
|
class ApplyResultDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public ApplyResultDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplyResultDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class ASTMapDecRefQueue extends IDecRefQueue
|
class ASTMapDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public ASTMapDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ASTMapDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class ASTVectorDecRefQueue extends IDecRefQueue
|
class ASTVectorDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public ASTVectorDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ASTVectorDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -3659,20 +3659,20 @@ public class Context extends IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
private ASTDecRefQueue m_AST_DRQ = new ASTDecRefQueue();
|
private ASTDecRefQueue m_AST_DRQ = new ASTDecRefQueue();
|
||||||
private ASTMapDecRefQueue m_ASTMap_DRQ = new ASTMapDecRefQueue();
|
private ASTMapDecRefQueue m_ASTMap_DRQ = new ASTMapDecRefQueue(10);
|
||||||
private ASTVectorDecRefQueue m_ASTVector_DRQ = new ASTVectorDecRefQueue();
|
private ASTVectorDecRefQueue m_ASTVector_DRQ = new ASTVectorDecRefQueue(10);
|
||||||
private ApplyResultDecRefQueue m_ApplyResult_DRQ = new ApplyResultDecRefQueue();
|
private ApplyResultDecRefQueue m_ApplyResult_DRQ = new ApplyResultDecRefQueue(10);
|
||||||
private FuncInterpEntryDecRefQueue m_FuncEntry_DRQ = new FuncInterpEntryDecRefQueue();
|
private FuncInterpEntryDecRefQueue m_FuncEntry_DRQ = new FuncInterpEntryDecRefQueue(10);
|
||||||
private FuncInterpDecRefQueue m_FuncInterp_DRQ = new FuncInterpDecRefQueue();
|
private FuncInterpDecRefQueue m_FuncInterp_DRQ = new FuncInterpDecRefQueue(10);
|
||||||
private GoalDecRefQueue m_Goal_DRQ = new GoalDecRefQueue();
|
private GoalDecRefQueue m_Goal_DRQ = new GoalDecRefQueue(10);
|
||||||
private ModelDecRefQueue m_Model_DRQ = new ModelDecRefQueue();
|
private ModelDecRefQueue m_Model_DRQ = new ModelDecRefQueue(10);
|
||||||
private ParamsDecRefQueue m_Params_DRQ = new ParamsDecRefQueue();
|
private ParamsDecRefQueue m_Params_DRQ = new ParamsDecRefQueue(10);
|
||||||
private ParamDescrsDecRefQueue m_ParamDescrs_DRQ = new ParamDescrsDecRefQueue();
|
private ParamDescrsDecRefQueue m_ParamDescrs_DRQ = new ParamDescrsDecRefQueue(10);
|
||||||
private ProbeDecRefQueue m_Probe_DRQ = new ProbeDecRefQueue();
|
private ProbeDecRefQueue m_Probe_DRQ = new ProbeDecRefQueue(10);
|
||||||
private SolverDecRefQueue m_Solver_DRQ = new SolverDecRefQueue();
|
private SolverDecRefQueue m_Solver_DRQ = new SolverDecRefQueue(10);
|
||||||
private StatisticsDecRefQueue m_Statistics_DRQ = new StatisticsDecRefQueue();
|
private StatisticsDecRefQueue m_Statistics_DRQ = new StatisticsDecRefQueue(10);
|
||||||
private TacticDecRefQueue m_Tactic_DRQ = new TacticDecRefQueue();
|
private TacticDecRefQueue m_Tactic_DRQ = new TacticDecRefQueue(10);
|
||||||
private FixedpointDecRefQueue m_Fixedpoint_DRQ = new FixedpointDecRefQueue();
|
private FixedpointDecRefQueue m_Fixedpoint_DRQ = new FixedpointDecRefQueue(10);
|
||||||
|
|
||||||
ASTDecRefQueue ast_DRQ()
|
ASTDecRefQueue ast_DRQ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class FixedpointDecRefQueue extends IDecRefQueue
|
class FixedpointDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public FixedpointDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FixedpointDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class FuncInterpDecRefQueue extends IDecRefQueue
|
class FuncInterpDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public FuncInterpDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FuncInterpDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class FuncInterpEntryDecRefQueue extends IDecRefQueue
|
class FuncInterpEntryDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public FuncInterpEntryDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FuncInterpEntryDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class GoalDecRefQueue extends IDecRefQueue
|
class GoalDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public GoalDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GoalDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -23,7 +23,17 @@ abstract class IDecRefQueue
|
||||||
{
|
{
|
||||||
protected Object m_lock = new Object();
|
protected Object m_lock = new Object();
|
||||||
protected LinkedList<Long> m_queue = new LinkedList<Long>();
|
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);
|
protected abstract void incRef(Context ctx, long obj);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class ModelDecRefQueue extends IDecRefQueue
|
class ModelDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public ModelDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class ParamDescrsDecRefQueue extends IDecRefQueue
|
class ParamDescrsDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public ParamDescrsDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ParamDescrsDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class ParamsDecRefQueue extends IDecRefQueue
|
class ParamsDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public ParamsDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ParamsDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class ProbeDecRefQueue extends IDecRefQueue
|
class ProbeDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public ProbeDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProbeDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -121,20 +121,20 @@ public class Solver extends Z3Object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /
|
/**
|
||||||
// / Assert multiple constraints into the solver, and track them (in the
|
* Assert multiple constraints into the solver, and track them (in the
|
||||||
// unsat) core
|
* unsat) core
|
||||||
// / using the Boolean constants in ps.
|
* using the Boolean constants in ps.
|
||||||
// /
|
*
|
||||||
// / Remarks:
|
* Remarks:
|
||||||
// / This API is an alternative to <see cref="Check"/> with assumptions for
|
* This API is an alternative to <see cref="Check"/> with assumptions for
|
||||||
// extracting unsat cores.
|
* extracting unsat cores.
|
||||||
// / Both APIs can be used in the same solver. The unsat core will contain a
|
* Both APIs can be used in the same solver. The unsat core will contain a
|
||||||
// combination
|
* combination
|
||||||
// / of the Boolean variables provided using <see cref="AssertAndTrack"/>
|
* of the Boolean variables provided using <see cref="AssertAndTrack"/>
|
||||||
// and the Boolean literals
|
* and the Boolean literals
|
||||||
// / provided using <see cref="Check"/> with assumptions.
|
* provided using <see cref="Check"/> with assumptions.
|
||||||
// /
|
**/
|
||||||
public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps) throws Z3Exception
|
public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps) throws Z3Exception
|
||||||
{
|
{
|
||||||
getContext().checkContextMatch(constraints);
|
getContext().checkContextMatch(constraints);
|
||||||
|
@ -147,19 +147,19 @@ public class Solver extends Z3Object
|
||||||
constraints[i].getNativeObject(), ps[i].getNativeObject());
|
constraints[i].getNativeObject(), ps[i].getNativeObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
// /
|
/**
|
||||||
// / Assert a constraint into the solver, and track it (in the unsat) core
|
* Assert a constraint into the solver, and track it (in the unsat) core
|
||||||
// / using the Boolean constant p.
|
* using the Boolean constant p.
|
||||||
// /
|
*
|
||||||
// / Remarks:
|
* Remarks:
|
||||||
// / This API is an alternative to <see cref="Check"/> with assumptions for
|
* This API is an alternative to <see cref="Check"/> with assumptions for
|
||||||
// extracting unsat cores.
|
* extracting unsat cores.
|
||||||
// / Both APIs can be used in the same solver. The unsat core will contain a
|
* Both APIs can be used in the same solver. The unsat core will contain a
|
||||||
// combination
|
* combination
|
||||||
// / of the Boolean variables provided using <see cref="AssertAndTrack"/>
|
* of the Boolean variables provided using <see cref="AssertAndTrack"/>
|
||||||
// and the Boolean literals
|
* and the Boolean literals
|
||||||
// / provided using <see cref="Check"/> with assumptions.
|
* provided using <see cref="Check"/> with assumptions.
|
||||||
// /
|
*/
|
||||||
public void assertAndTrack(BoolExpr constraint, BoolExpr p) throws Z3Exception
|
public void assertAndTrack(BoolExpr constraint, BoolExpr p) throws Z3Exception
|
||||||
{
|
{
|
||||||
getContext().checkContextMatch(constraint);
|
getContext().checkContextMatch(constraint);
|
||||||
|
|
|
@ -19,6 +19,13 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class SolverDecRefQueue extends IDecRefQueue
|
class SolverDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public SolverDecRefQueue() { super(); }
|
||||||
|
|
||||||
|
public SolverDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class StatisticsDecRefQueue extends IDecRefQueue
|
class StatisticsDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public StatisticsDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatisticsDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -19,6 +19,16 @@ package com.microsoft.z3;
|
||||||
|
|
||||||
class TacticDecRefQueue extends IDecRefQueue
|
class TacticDecRefQueue extends IDecRefQueue
|
||||||
{
|
{
|
||||||
|
public TacticDecRefQueue()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TacticDecRefQueue(int move_limit)
|
||||||
|
{
|
||||||
|
super(move_limit);
|
||||||
|
}
|
||||||
|
|
||||||
protected void incRef(Context ctx, long obj)
|
protected void incRef(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in a new issue