summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/vm_core.h b/vm_core.h
index c18611e047..e1e3fb1e59 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -12,6 +12,22 @@
#ifndef RUBY_VM_CORE_H
#define RUBY_VM_CORE_H
+/*
+ * Enable check mode.
+ * 1: enable local assertions.
+ */
+#ifndef VM_CHECK_MODE
+#define VM_CHECK_MODE 0
+#endif
+
+#if VM_CHECK_MODE > 0
+#define VM_ASSERT(expr) do { \
+ if(!(expr)) rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr); \
+} while (0)
+#else
+#define VM_ASSERT(expr)
+#endif
+
#define RUBY_VM_THREAD_MODEL 2
#include "ruby/ruby.h"