diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..fd8c681
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,147 @@
+# Generated from CLion Inspection settings
+---
+Checks: '-*,
+bugprone-argument-comment,
+bugprone-assert-side-effect,
+bugprone-bad-signal-to-kill-thread,
+bugprone-branch-clone,
+bugprone-copy-constructor-init,
+bugprone-dangling-handle,
+bugprone-dynamic-static-initializers,
+bugprone-fold-init-type,
+bugprone-forward-declaration-namespace,
+bugprone-forwarding-reference-overload,
+bugprone-inaccurate-erase,
+bugprone-incorrect-roundings,
+bugprone-integer-division,
+bugprone-lambda-function-name,
+bugprone-macro-parentheses,
+bugprone-macro-repeated-side-effects,
+bugprone-misplaced-operator-in-strlen-in-alloc,
+bugprone-misplaced-pointer-arithmetic-in-alloc,
+bugprone-misplaced-widening-cast,
+bugprone-move-forwarding-reference,
+bugprone-multiple-statement-macro,
+bugprone-no-escape,
+bugprone-parent-virtual-call,
+bugprone-posix-return,
+bugprone-reserved-identifier,
+bugprone-sizeof-container,
+bugprone-sizeof-expression,
+bugprone-spuriously-wake-up-functions,
+bugprone-string-constructor,
+bugprone-string-integer-assignment,
+bugprone-string-literal-with-embedded-nul,
+bugprone-suspicious-enum-usage,
+bugprone-suspicious-include,
+bugprone-suspicious-memset-usage,
+bugprone-suspicious-missing-comma,
+bugprone-suspicious-semicolon,
+bugprone-suspicious-string-compare,
+bugprone-suspicious-memory-comparison,
+bugprone-suspicious-realloc-usage,
+bugprone-swapped-arguments,
+bugprone-terminating-continue,
+bugprone-throw-keyword-missing,
+bugprone-too-small-loop-variable,
+bugprone-undefined-memory-manipulation,
+bugprone-undelegated-constructor,
+bugprone-unhandled-self-assignment,
+bugprone-unused-raii,
+bugprone-unused-return-value,
+bugprone-use-after-move,
+bugprone-virtual-near-miss,
+cert-dcl21-cpp,
+cert-dcl58-cpp,
+cert-err34-c,
+cert-err52-cpp,
+cert-err60-cpp,
+cert-flp30-c,
+cert-msc50-cpp,
+cert-msc51-cpp,
+cert-str34-c,
+cppcoreguidelines-interfaces-global-init,
+cppcoreguidelines-narrowing-conversions,
+cppcoreguidelines-pro-type-member-init,
+cppcoreguidelines-pro-type-static-cast-downcast,
+cppcoreguidelines-slicing,
+google-default-arguments,
+google-explicit-constructor,
+google-runtime-operator,
+hicpp-exception-baseclass,
+hicpp-multiway-paths-covered,
+misc-misplaced-const,
+misc-new-delete-overloads,
+misc-no-recursion,
+misc-non-copyable-objects,
+misc-throw-by-value-catch-by-reference,
+misc-unconventional-assign-operator,
+misc-uniqueptr-reset-release,
+modernize-avoid-bind,
+modernize-concat-nested-namespaces,
+modernize-deprecated-headers,
+modernize-deprecated-ios-base-aliases,
+modernize-loop-convert,
+modernize-make-shared,
+modernize-make-unique,
+modernize-pass-by-value,
+modernize-raw-string-literal,
+modernize-redundant-void-arg,
+modernize-replace-auto-ptr,
+modernize-replace-disallow-copy-and-assign-macro,
+modernize-replace-random-shuffle,
+modernize-return-braced-init-list,
+modernize-shrink-to-fit,
+modernize-unary-static-assert,
+modernize-use-auto,
+modernize-use-bool-literals,
+modernize-use-emplace,
+modernize-use-equals-default,
+modernize-use-equals-delete,
+modernize-use-nodiscard,
+modernize-use-noexcept,
+modernize-use-nullptr,
+modernize-use-override,
+modernize-use-transparent-functors,
+modernize-use-uncaught-exceptions,
+mpi-buffer-deref,
+mpi-type-mismatch,
+openmp-use-default-none,
+performance-faster-string-find,
+performance-for-range-copy,
+performance-implicit-conversion-in-loop,
+performance-inefficient-algorithm,
+performance-inefficient-string-concatenation,
+performance-inefficient-vector-operation,
+performance-move-const-arg,
+performance-move-constructor-init,
+performance-no-automatic-move,
+performance-noexcept-move-constructor,
+performance-trivially-destructible,
+performance-type-promotion-in-math-fn,
+performance-unnecessary-copy-initialization,
+performance-unnecessary-value-param,
+portability-simd-intrinsics,
+readability-avoid-const-params-in-decls,
+readability-const-return-type,
+readability-container-size-empty,
+readability-convert-member-functions-to-static,
+readability-delete-null-pointer,
+readability-deleted-default,
+readability-inconsistent-declaration-parameter-name,
+readability-make-member-function-const,
+readability-misleading-indentation,
+readability-misplaced-array-index,
+readability-non-const-parameter,
+readability-redundant-control-flow,
+readability-redundant-declaration,
+readability-redundant-function-ptr-dereference,
+readability-redundant-smartptr-get,
+readability-redundant-string-cstr,
+readability-redundant-string-init,
+readability-simplify-subscript-expr,
+readability-static-accessed-through-instance,
+readability-static-definition-in-anonymous-namespace,
+readability-string-compare,
+readability-uniqueptr-delete-release,
+readability-use-anyofallof'
\ No newline at end of file
diff --git a/.idea/cmake.xml b/.idea/cmake.xml
index 802ba29..b7ec5ba 100644
--- a/.idea/cmake.xml
+++ b/.idea/cmake.xml
@@ -3,6 +3,7 @@
+
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index f603881..4b411e6 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -1,5 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..4bb41dd
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7b055cd..bae6c4c 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,6 +4,7 @@
+
\ No newline at end of file
diff --git a/src/vm/includes/Cell.h b/src/vm/includes/Cell.h
index 62decaf..d869096 100644
--- a/src/vm/includes/Cell.h
+++ b/src/vm/includes/Cell.h
@@ -23,7 +23,7 @@ struct Cell {
virtual ~Cell() = 0;
CellType _type;
- bool live = false;
+ std::atomic live = false;
};
struct NumAtomCell : public Cell {
@@ -45,8 +45,8 @@ struct ConsCell : public Cell {
explicit ConsCell(Cell *car) : Cell(CellType::CONS), _car(car) {}
ConsCell(Cell *car, Cell *cdr) : Cell(CellType::CONS), _car(car), _cdr(cdr) {}
- Cell *_car = nullptr;
- Cell *_cdr = nullptr;
+ std::atomic _car = nullptr;
+ std::atomic _cdr = nullptr;
};
#endif//PSIL_CELL_H
diff --git a/src/vm/includes/ConsUtils.h b/src/vm/includes/ConsUtils.h
index 89208e9..3413841 100644
--- a/src/vm/includes/ConsUtils.h
+++ b/src/vm/includes/ConsUtils.h
@@ -9,13 +9,13 @@
#include "MemoryContext.h"
namespace ConsUtils {
- static inline MCHandle car(const MCHandle &cell) { return dynamic_cast(*cell)._car; }
- static inline MCHandle cdr(const MCHandle &cell) { return dynamic_cast(*cell)._cdr; }
+ static inline MCHandle car(const MCHandle &cell) { return dynamic_cast(*cell)._car.load(); }
+ static inline MCHandle cdr(const MCHandle &cell) { return dynamic_cast(*cell)._cdr.load(); }
static inline CellValType val(const MCHandle &cell) { return dynamic_cast(*cell)._val; }
static inline std::string_view strval(const MCHandle &cell) { return dynamic_cast(*cell)._val; }
MCHandle cons(const MCHandle &car, const MCHandle &cdr);
MCHandle pop(MCHandle &from);
- MCHandle push(MCHandle &to, const MCHandle &what);
+ void push(MCHandle &to, const MCHandle &what);
void append(MCHandle to, const MCHandle &what);
MCHandle makeNumCell(int64_t val);
MCHandle makeStrCell(std::string val);
diff --git a/src/vm/includes/MemoryContext.h b/src/vm/includes/MemoryContext.h
index f75c752..4ad8515 100644
--- a/src/vm/includes/MemoryContext.h
+++ b/src/vm/includes/MemoryContext.h
@@ -6,7 +6,14 @@
#define PSIL_MEMORYCONTEXT_H
#include
+#include
+#include
#include
+#include | |