Skip to content

Commit

Permalink
Add SimpleModel which simply starts as an empty model and use that
Browse files Browse the repository at this point in the history
in place of `FileSerializableModel` where appropriate.
  • Loading branch information
afd committed Aug 28, 2019
1 parent 3f90b56 commit 01b8151
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
27 changes: 27 additions & 0 deletions include/jfs/Core/SimpleModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//===----------------------------------------------------------------------===//
//
// JFS - The JIT Fuzzing Solver
//
// Copyright 2017-2018 Alastair Donaldson
//
// This file is distributed under the MIT license.
// See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#ifndef JFS_CORE_SIMPLE_MODEL_H
#define JFS_CORE_SIMPLE_MODEL_H
#include "jfs/Core/Model.h"

namespace jfs {
namespace core {

// A model that on creation is empty
class SimpleModel : public Model {
public:
SimpleModel(JFSContext& ctx);
};

} // namespace core
} // namespace jfs

#endif
1 change: 1 addition & 0 deletions lib/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jfs_add_component(JFSCore
Model.cpp
ModelValidator.cpp
Query.cpp
SimpleModel.cpp
SMTLIB2Parser.cpp
Solver.cpp
ToolErrorHandler.cpp
Expand Down
20 changes: 20 additions & 0 deletions lib/Core/SimpleModel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===----------------------------------------------------------------------===//
//
// JFS - The JIT Fuzzing Solver
//
// Copyright 2017-2018 Alastair Donaldson
//
// This file is distributed under the MIT license.
// See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#include "jfs/Core/SimpleModel.h"

namespace jfs {
namespace core {

SimpleModel::SimpleModel(JFSContext& ctx) : Model(ctx) {
z3Model = Z3ModelHandle(::Z3_mk_model(ctx.getZ3Ctx()), ctx.getZ3Ctx());
}
} // namespace core
} // namespace jfs
9 changes: 4 additions & 5 deletions lib/FuzzingCommon/FuzzingSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//===----------------------------------------------------------------------===//
#include "jfs/FuzzingCommon/FuzzingSolver.h"
#include "jfs/Core/IfVerbose.h"
#include "jfs/FuzzingCommon/FileSerializableModel.h"
#include "jfs/Core/SimpleModel.h"
#include "jfs/FuzzingCommon/FuzzingAnalysisInfo.h"
#include "jfs/FuzzingCommon/FuzzingSolverOptions.h"
#include "jfs/Transform/QueryPassManager.h"
Expand Down Expand Up @@ -83,8 +83,8 @@ class FuzzingSolverImpl {
new TrivialFuzzingSolverResponse(SolverResponse::SAT));
if (produceModel) {
// Make empty model
auto model = std::unique_ptr<FileSerializableModel>(
new FileSerializableModel(q.getContext()));
auto model =
std::unique_ptr<SimpleModel>(new SimpleModel(q.getContext()));
resp->setModel(std::move(model));
}
return resp;
Expand Down Expand Up @@ -149,8 +149,7 @@ class FuzzingSolverImpl {
new TrivialFuzzingSolverResponse(SolverResponse::SAT));
if (produceModel) {
// Make empty model
auto model = std::unique_ptr<FileSerializableModel>(
new FileSerializableModel(q.getContext()));
auto model = std::unique_ptr<Model>(new SimpleModel(q.getContext()));
// Now convert model so that it satisfies the query given to the
// preprocessing passes.
bool convertModelSuccess =
Expand Down

0 comments on commit 01b8151

Please sign in to comment.