summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/mruby.h2
-rw-r--r--src/gc.c3
-rw-r--r--src/string.c3
-rw-r--r--src/vm.c18
4 files changed, 7 insertions, 19 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 5aba2934a..5bbfbb1ad 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -65,7 +65,7 @@
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L
#define mrb_static_assert(exp, str) _Static_assert(exp, str)
#else
-#define mrb_static_assert(exp, str) mrb_assert(exp)
+#define mrb_static_assert(exp, str)
#endif
#include "mrbconf.h"
diff --git a/src/gc.c b/src/gc.c
index be812c4d3..64e0b3eae 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -1619,9 +1619,6 @@ mrb_init_gc(mrb_state *mrb)
{
struct RClass *gc;
- mrb_static_assert(sizeof(RVALUE) <= sizeof(void*) * 6,
- "RVALUE size must be within 6 words");
-
gc = mrb_define_module(mrb, "GC");
mrb_define_class_method(mrb, gc, "start", gc_start, MRB_ARGS_NONE());
diff --git a/src/string.c b/src/string.c
index 78c41c5f3..e8f81c0ae 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2926,9 +2926,6 @@ mrb_init_string(mrb_state *mrb)
{
struct RClass *s;
- mrb_static_assert(RSTRING_EMBED_LEN_MAX < (1 << MRB_STR_EMBED_LEN_BIT),
- "pointer size too big for embedded string");
-
mrb->string_class = s = mrb_define_class(mrb, "String", mrb->object_class); /* 15.2.10 */
MRB_SET_INSTANCE_TT(s, MRB_TT_STRING);
diff --git a/src/vm.c b/src/vm.c
index 79bb3ed60..cc9a187b7 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -102,26 +102,20 @@ void mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value
static inline void
stack_clear(mrb_value *from, size_t count)
{
-#ifndef MRB_NAN_BOXING
- const mrb_value mrb_value_zero = { { 0 } };
-
- while (count-- > 0) {
- *from++ = mrb_value_zero;
- }
-#else
+#ifdef MRB_NAN_BOXING
while (count-- > 0) {
SET_NIL_VALUE(*from);
from++;
}
+#else
+ memset(from, 0, sizeof(mrb_value)*count);
#endif
}
static inline void
stack_copy(mrb_value *dst, const mrb_value *src, size_t size)
{
- while (size-- > 0) {
- *dst++ = *src++;
- }
+ memcpy(dst, src, sizeof(mrb_value)*size);
}
static void
@@ -273,7 +267,6 @@ cipush(mrb_state *mrb, const mrb_code *pc, int push_stacks, int acc,
struct RClass *target_class, struct RProc *proc, mrb_sym mid, int argc)
{
struct mrb_context *c = mrb->c;
- static const mrb_callinfo ci_zero = { 0 };
mrb_callinfo *ci = c->ci;
if (ci + 1 == c->ciend) {
@@ -284,7 +277,6 @@ cipush(mrb_state *mrb, const mrb_code *pc, int push_stacks, int acc,
c->ciend = c->cibase + size * 2;
}
ci = ++c->ci;
- *ci = ci_zero;
ci->mid = mid;
ci->proc = proc;
ci->stackent = c->stack;
@@ -294,6 +286,8 @@ cipush(mrb_state *mrb, const mrb_code *pc, int push_stacks, int acc,
ci->argc = argc;
ci->acc = acc;
ci->target_class = target_class;
+ ci->err = 0;
+ ci->env = 0;
c->stack += push_stacks;
return ci;