summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iseq.c4
-rw-r--r--ruby.c9
-rw-r--r--vm_core.h2
3 files changed, 9 insertions, 6 deletions
diff --git a/iseq.c b/iseq.c
index e42525cb9f..21622fa288 100644
--- a/iseq.c
+++ b/iseq.c
@@ -866,11 +866,11 @@ rb_iseq_new_top(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath
}
rb_iseq_t *
-rb_iseq_new_main(const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent)
+rb_iseq_new_main(const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent, int opt)
{
return rb_iseq_new_with_opt(ast, rb_fstring_lit("<main>"),
path, realpath, INT2FIX(0),
- parent, 0, ISEQ_TYPE_MAIN, &COMPILE_OPTION_DEFAULT);
+ parent, 0, ISEQ_TYPE_MAIN, opt ? &COMPILE_OPTION_DEFAULT : &COMPILE_OPTION_FALSE);
}
rb_iseq_t *
diff --git a/ruby.c b/ruby.c
index b9ed1ae89c..09b7c770cf 100644
--- a/ruby.c
+++ b/ruby.c
@@ -143,13 +143,15 @@ enum feature_flag_bits {
X(parsetree_with_comment) \
SEP \
X(insns) \
+ SEP \
+ X(insns_without_opt) \
/* END OF DUMPS */
enum dump_flag_bits {
dump_version_v,
EACH_DUMPS(DEFINE_DUMP, COMMA),
dump_exit_bits = (DUMP_BIT(yydebug) | DUMP_BIT(syntax) |
DUMP_BIT(parsetree) | DUMP_BIT(parsetree_with_comment) |
- DUMP_BIT(insns))
+ DUMP_BIT(insns) | DUMP_BIT(insns_without_opt))
};
typedef struct ruby_cmdline_options ruby_cmdline_options_t;
@@ -330,6 +332,7 @@ usage(const char *name, int help, int highlight, int columns)
};
static const struct message dumps[] = {
M("insns", "", "instruction sequences"),
+ M("insns_without_out", "", "instruction sequences compiled with no optimization"),
M("yydebug", "", "yydebug of yacc parser generator"),
M("parsetree", "", "AST"),
M("parsetree_with_comment", "", "AST with comments"),
@@ -2161,11 +2164,11 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
GetBindingPtr(rb_const_get(rb_cObject, rb_intern("TOPLEVEL_BINDING")),
toplevel_binding);
const struct rb_block *base_block = toplevel_context(toplevel_binding);
- iseq = rb_iseq_new_main(&ast->body, opt->script_name, path, vm_block_iseq(base_block));
+ iseq = rb_iseq_new_main(&ast->body, opt->script_name, path, vm_block_iseq(base_block), !(dump & DUMP_BIT(insns_without_opt)));
rb_ast_dispose(ast);
}
- if (dump & DUMP_BIT(insns)) {
+ if (dump & (DUMP_BIT(insns) | DUMP_BIT(insns_without_opt))) {
rb_io_write(rb_stdout, rb_iseq_disasm((const rb_iseq_t *)iseq));
rb_io_flush(rb_stdout);
dump &= ~DUMP_BIT(insns);
diff --git a/vm_core.h b/vm_core.h
index bcb0255a00..78d06012a1 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1105,7 +1105,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
/* node -> iseq */
rb_iseq_t *rb_iseq_new (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type);
rb_iseq_t *rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
-rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent);
+rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent, int opt);
rb_iseq_t *rb_iseq_new_eval (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth);
rb_iseq_t *rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth,
enum iseq_type, const rb_compile_option_t*);