-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #382 #629
Fix #382 #629
Conversation
1474e0f
to
20da911
Compare
@delcypher metaSTM is going to give you a lot of fun. |
We really need to think whether such a change is worth it, as many things would become more confusing. The assumption that STP is the core solver is not that terrible in my opinion, even though other solvers are equally supported directly or via metaSMT. |
There are numerous changes here which removes the assumption that STP is the core solver. * `-write-cvcs` has been renamed to `-write-core-solver-queries` * `LogType::STP` has been renamed to `LogType::CORE_SOLVER_LANG` * `Interpreter::getConstraintLog()` and `Executor::getConstraintLog()` now have a `fileExtension` parameter which returns the file extension for constraint language requested. * The `Solver::getConstraintLog()` and `SolverImpl::getConstraintLog()` methods (and all their descendants) now have a `fileExtension` parameter which will be set (if requested by the client) to the file extension for the core solver's constraint language.
20da911
to
98af1f6
Compare
Can you be more concrete? I can't think of anything that is made more confusing by this change. If anything this greatly improves things because STP being the core solver is not true anymore. The cost is having to make the API change but if KLEE is to make progress as a project we should not be resisting sensible API changes. This PR doesn't change anything related to LLVM versions so it should not conflict with the outstanding PRs that add support for newer LLVM versions (I consider these to be important PRs that we should try to avoid conflicting with).
I really don't like this assumption because it makes things confusing when STP is not the core example. For example when using Z3 as the core solver the |
What I mean is that there are other ways to solve this, which would not break backward-compatibility unnecessarily, and might be in fact easier to use. For instance, we could only enable |
That isn't a great solution. We don't know what the core solver will be until runtime which means we will be showing In the case of Z3 as the core solver the existing This solution also requires that the Exectuor know about the internal details of the core solver which is an unnecessary coupling in my opinion.
I don't think it's particularly confusing. For each test case we get a file called |
I'm still not convinced that this is worth breaking the API. The Finally, the notion of core solver is blurred when a portfolio of solvers is used (something almost supported via metaSMT), which is another argument against this change. I find your proposed API reasonable, but I see both pros and cons when compared to the existing API, in which case I'd prefer to preserve backward compatibility. |
We have already broken KLEE's API. My fork of KLEE is only a few months away from current master and there were API breaking changes that I had to deal with when writing this PR.
Who are we preserving backward compatibility for? If it's for unmaintained forks then I'd argue we shouldn't be maintaining backward compatibility for them. |
Just note having played with this a bit, the API isn't that great. In my fork I hit a scenario where I needed to the file extension for the core solver's native language without actually needing the printed constraints. The current API forces me to do this. // FIXME: Kind of gross. Should probably have method on solver
// that just gives us the file extension.
// Create dummy query to determine file extension
const char* fileExtension = NULL;
ConstraintManager cm;
Query q(cm, ConstantExpr::alloc(0, Expr::Bool));
char* dummy = solver->getConstraintLog(q, &fileExtension);
free(dummy); |
That is true but this not something supported in the code today. In fact |
I should also note a motivation behind this work is to extend the |
Update on how the API is progressing in my fork. This is what I'm currently using in my fork. /// getConstraintLog - Get constraints in the solver's native query
/// language.
///
/// \param query - The Query to output
/// \param fileExtension - If not set to NULL the passed in pointer is
/// modified to point to a C string containing the
/// file extension appropriate for the constraints.
/// \param ConstraintLogConfig - if not set to NULL sets options
/// for constraint logging.
/// \return Constraints in the solver's native query language.
/// Clients must free this.
virtual char *getConstraintLog(const Query &query,
const char **fileExtension = NULL,
const ConstraintLogConfig * = NULL); and //===-- ConstraintLogConfig.h -----------------------------------*- C++ -*-===//
//
// The KLEE Symbolic Virtual Machine
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef CONSTRAINT_LOG_CONFIG_H
#define CONSTRAINT_LOG_CONFIG_H
#include "klee/Config/config.h"
#include "llvm/Support/Casting.h"
namespace klee {
class ConstraintLogConfig {
public:
enum ConstraintLogConfigKind { CLCK_Z3 };
private:
const ConstraintLogConfigKind kind;
public:
ConstraintLogConfigKind getKind() const { return kind; }
// Allocate memory for a copy of this configuration.
// Clients must free using `delete`.
virtual ConstraintLogConfig *alloc() const = 0;
virtual ~ConstraintLogConfig() {}
protected:
ConstraintLogConfig(ConstraintLogConfigKind k) : kind(k) {}
};
class Z3ConstraintLogConfig : public ConstraintLogConfig {
public:
// Configuration settings
bool ackermannizeArrays;
Z3ConstraintLogConfig()
: ConstraintLogConfig(CLCK_Z3), ackermannizeArrays(false) {}
static bool classof(const ConstraintLogConfig *clc) {
return clc->getKind() == CLCK_Z3;
}
virtual ConstraintLogConfig *alloc() const {
ConstraintLogConfig *clc = new Z3ConstraintLogConfig(*this);
return clc;
}
};
}
#endif /* CONSTRAINT_LOG_CONFIG_H */
|
@ccadar Have you had a chance to think about this some more? After using it for a while I've come to the conclusion that having a For metaSMT this would also be useful if it ever supported logging because the options could be used to control any aspect of its logging facility. I'm not so sure about the
|
Hi Dan, your recent comments about |
They are orthogonal in concept but not in implementation. Both require changing the They are also related because a
Z3 has a very powerful API so there are many things that could be done to the expressions before printing. The use case I imagine is an option to control if simplification of expressions is done before printing this can be done with Z3 but STP also supports this (see |
Since this PR is over 3 years old and it's resolution is unclear, I'll close this. |
Fix #382
There are numerous changes here which removes the assumption that
STP is the core solver.
-write-cvcs
has been renamed to-write-core-solver-queries
LogType::STP
has been renamed toLogType::CORE_SOLVER_LANG
Interpreter::getConstraintLog()
andExecutor::getConstraintLog()
now have a
fileExtension
parameter which returns the file extensionfor constraint language requested.
Solver::getConstraintLog()
andSolverImpl::getConstraintLog()
methods (and all their descendants) now have a
fileExtension
parameter which will be set (if requested by the client) to the file
extension for the core solver's constraint language.