summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Rakefile19
-rw-r--r--cmake/modules/IntrospectSystem.cmake2
-rw-r--r--src/codegen.c1
-rw-r--r--src/vm.c10
-rw-r--r--tools/mruby/mruby.c1
5 files changed, 21 insertions, 12 deletions
diff --git a/Rakefile b/Rakefile
index 5986f2fc4..aec259e06 100644
--- a/Rakefile
+++ b/Rakefile
@@ -2,9 +2,9 @@
# basic build file for mruby
# compiler, linker (gcc), archiver, parser generator
-CC = ENV['CC'] || 'gcc'
-LL = ENV['LL'] || 'gcc'
-AR = ENV['AR'] || 'ar'
+CC = ENV['CC'] || 'gcc'
+LL = ENV['LL'] || 'gcc'
+AR = ENV['AR'] || 'ar'
YACC = ENV['YACC'] || 'bison'
MAKE = ENV['MAKE'] || 'make'
@@ -15,10 +15,10 @@ MRUBY_ROOT = ENV['MRUBY_ROOT'] || File.expand_path(File.dirname(__FILE__))
ENABLE_GEMS = ENV['ENABLE_GEMS'] == 'true'
# the default file which contains the active GEMs
-ACTIVE_GEMS = File.join(File.dirname(__FILE__), 'mrbgems', 'GEMS.active')
+ACTIVE_GEMS = ENV['ACTIVE_GEMS'] || File.join(MRUBY_ROOT, '/mrbgems/GEMS.active')
# default compile option
-COMPILE_MODE = :debug
+COMPILE_MODE = ENV['COMPILE_MODE'] || :debug
##############################
@@ -34,13 +34,12 @@ else # including 'debug'
CFLAGS = if e then [e] else ['-g', '-O3'] end
end
LDFLAGS = [ENV['LDFLAGS']]
-LIBS = [ENV['LIBS'] || '-lm']
+LIBS = [ENV['LIBS'] || '-lm']
-if !ENABLE_GEMS
- CFLAGS << "-DDISABLE_GEMS"
-end
+CFLAGS << "-DDISABLE_GEMS" unless ENABLE_GEMS
CFLAGS << "-Wall" << "-Werror-implicit-function-declaration" << "-I#{MRUBY_ROOT}/include"
+
if ENV['OS'] == 'Windows_NT'
MAKE_FLAGS = "--no-print-directory CC=#{CC} LL=#{LL} AR=#{AR} YACC=#{YACC} CFLAGS=\"#{CFLAGS.join(' ')}\" LDFLAGS=\"#{LDFLAGS.join(' ')}\" LIBS=\"#{LIBS.join(' ')}\" ENABLE_GEMS=\"#{ENABLE_GEMS}\" MRUBY_ROOT=\"#{MRUBY_ROOT}\""
else
@@ -48,7 +47,6 @@ else
end
-
##############################
# internal variables
@@ -59,6 +57,7 @@ CAT = ENV['CAT'] ||= 'cat'
##############################
# generic build targets, rules
+
if ENABLE_GEMS
require './mrbgems/build_tasks'
end
diff --git a/cmake/modules/IntrospectSystem.cmake b/cmake/modules/IntrospectSystem.cmake
index 722f4c3d7..559b884b8 100644
--- a/cmake/modules/IntrospectSystem.cmake
+++ b/cmake/modules/IntrospectSystem.cmake
@@ -20,6 +20,8 @@ else()
endif()
endif()
+add_definitions(-DDISABLE_GEMS)
+
if(MSVC)
add_definitions(
-DRUBY_EXPORT # required by oniguruma.h
diff --git a/src/codegen.c b/src/codegen.c
index 2afd3a146..c6afa0184 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -2089,6 +2089,7 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
if (p->filename) {
p->lines = (short*)mrb_malloc(mrb, sizeof(short)*p->icapa);
}
+ p->lineno = prev->lineno;
return p;
}
diff --git a/src/vm.c b/src/vm.c
index da6700bdf..b84158d1d 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1151,8 +1151,9 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
int eidx;
L_RAISE:
+ ci = mrb->ci;
mrb_obj_iv_ifnone(mrb, mrb->exc, mrb_intern(mrb, "lastpc"), mrb_voidp_value(pc));
- ci = mrb->ci;
+ mrb_obj_iv_set(mrb, mrb->exc, mrb_intern(mrb, "ciidx"), mrb_fixnum_value(ci - mrb->cibase));
eidx = ci->eidx;
if (ci == mrb->cibase) {
if (ci->ridx == 0) goto L_STOP;
@@ -1198,7 +1199,12 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
localjump_error(mrb, "return");
goto L_RAISE;
}
- ci = mrb->ci = mrb->cibase + e->cioff;
+ ci = mrb->cibase + e->cioff;
+ if (ci == mrb->cibase) {
+ localjump_error(mrb, "return");
+ goto L_RAISE;
+ }
+ mrb->ci = ci;
break;
}
case OP_R_NORMAL:
diff --git a/tools/mruby/mruby.c b/tools/mruby/mruby.c
index 99af7bc5d..9d6182238 100644
--- a/tools/mruby/mruby.c
+++ b/tools/mruby/mruby.c
@@ -202,6 +202,7 @@ showcallinfo(mrb_state *mrb)
}
}
}
+ if (line == -1) continue;
if (ci->target_class == ci->proc->target_class)
sep = ".";
else