mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 21:38:44 +00:00
commit
d48b25f38b
|
@ -41,13 +41,12 @@ public class AST extends Z3Object implements Comparable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return (this == casted) ||
|
||||||
(this == casted) ||
|
|
||||||
(this != null) &&
|
(this != null) &&
|
||||||
(casted != null) &&
|
(casted != null) &&
|
||||||
(getContext().nCtx() == casted.getContext().nCtx()) &&
|
(getContext().nCtx() == casted.getContext().nCtx()) &&
|
||||||
(Native.isEqAst(getContext().nCtx(), getNativeObject(), casted.getNativeObject()));
|
(Native.isEqAst(getContext().nCtx(), getNativeObject(), casted.getNativeObject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object Comparison.
|
* Object Comparison.
|
||||||
|
|
|
@ -80,12 +80,21 @@ public class Constructor extends Z3Object
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
|
* @throws Throwable
|
||||||
* @throws Z3Exception on error
|
* @throws Z3Exception on error
|
||||||
**/
|
**/
|
||||||
protected void finalize()
|
protected void finalize() throws Throwable
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
Native.delConstructor(getContext().nCtx(), getNativeObject());
|
Native.delConstructor(getContext().nCtx(), getNativeObject());
|
||||||
}
|
}
|
||||||
|
catch (Throwable t) {
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int n = 0;
|
private int n = 0;
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,21 @@ public class ConstructorList extends Z3Object
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
|
* @throws Throwable
|
||||||
* @throws Z3Exception on error
|
* @throws Z3Exception on error
|
||||||
**/
|
**/
|
||||||
protected void finalize()
|
protected void finalize() throws Throwable
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
Native.delConstructorList(getContext().nCtx(), getNativeObject());
|
Native.delConstructorList(getContext().nCtx(), getNativeObject());
|
||||||
}
|
}
|
||||||
|
catch (Throwable t) {
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ConstructorList(Context ctx, long obj)
|
ConstructorList(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,7 @@ Notes:
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import com.microsoft.z3.enumerations.Z3_ast_print_mode;
|
import com.microsoft.z3.enumerations.Z3_ast_print_mode;
|
||||||
|
|
||||||
|
@ -3761,16 +3762,18 @@ public class Context extends IDisposable
|
||||||
return m_Optimize_DRQ;
|
return m_Optimize_DRQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long m_refCount = 0;
|
protected AtomicInteger m_refCount = new AtomicInteger(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalizer.
|
* Finalizer.
|
||||||
|
* @throws Throwable
|
||||||
**/
|
**/
|
||||||
protected void finalize()
|
protected void finalize() throws Throwable
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
dispose();
|
dispose();
|
||||||
|
|
||||||
if (m_refCount == 0)
|
if (m_refCount.get() == 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -3781,9 +3784,13 @@ public class Context extends IDisposable
|
||||||
}
|
}
|
||||||
m_ctx = 0;
|
m_ctx = 0;
|
||||||
}
|
}
|
||||||
/*
|
}
|
||||||
else
|
catch (Throwable t) {
|
||||||
CMW: re-queue the finalizer? */
|
throw t;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,11 +25,20 @@ public class Z3Object extends IDisposable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Finalizer.
|
* Finalizer.
|
||||||
|
* @throws Throwable
|
||||||
**/
|
**/
|
||||||
protected void finalize()
|
protected void finalize() throws Throwable
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
catch (Throwable t) {
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
super.finalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disposes of the underlying native Z3 object.
|
* Disposes of the underlying native Z3 object.
|
||||||
|
@ -44,7 +53,7 @@ public class Z3Object extends IDisposable
|
||||||
|
|
||||||
if (m_ctx != null)
|
if (m_ctx != null)
|
||||||
{
|
{
|
||||||
m_ctx.m_refCount--;
|
m_ctx.m_refCount.decrementAndGet();
|
||||||
m_ctx = null;
|
m_ctx = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,13 +63,13 @@ public class Z3Object extends IDisposable
|
||||||
|
|
||||||
Z3Object(Context ctx)
|
Z3Object(Context ctx)
|
||||||
{
|
{
|
||||||
ctx.m_refCount++;
|
ctx.m_refCount.incrementAndGet();
|
||||||
m_ctx = ctx;
|
m_ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
Z3Object(Context ctx, long obj)
|
Z3Object(Context ctx, long obj)
|
||||||
{
|
{
|
||||||
ctx.m_refCount++;
|
ctx.m_refCount.incrementAndGet();
|
||||||
m_ctx = ctx;
|
m_ctx = ctx;
|
||||||
incRef(obj);
|
incRef(obj);
|
||||||
m_n_obj = obj;
|
m_n_obj = obj;
|
||||||
|
|
Loading…
Reference in a new issue