diff options
| -rw-r--r-- | include/mruby/ops.h | 4 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 2 | ||||
| -rw-r--r-- | mrbgems/mruby-test/mrbgem.rake | 1 | ||||
| -rw-r--r-- | test/t/kernel.rb | 17 |
4 files changed, 8 insertions, 16 deletions
diff --git a/include/mruby/ops.h b/include/mruby/ops.h index c8990ae43..e85ee3133 100644 --- a/include/mruby/ops.h +++ b/include/mruby/ops.h @@ -92,8 +92,8 @@ OPCODE(APOST, BBB) /* *R(a),R(a+1)..R(a+c) = R(a)[b..] */ OPCODE(INTERN, B) /* R(a) = intern(R(a)) */ OPCODE(STRING, BB) /* R(a) = str_dup(Lit(b)) */ OPCODE(STRCAT, B) /* str_cat(R(a),R(a+1)) */ -OPCODE(HASH, BB) /* R(a) = hash_new(R(a),R(a+1)..R(a+b)) */ -OPCODE(HASHADD, BB) /* R(a) = hash_push(R(a),R(a+1)..R(a+b)) */ +OPCODE(HASH, BB) /* R(a) = hash_new(R(a),R(a+1)..R(a+b*2-1)) */ +OPCODE(HASHADD, BB) /* R(a) = hash_push(R(a),R(a+1)..R(a+b*2)) */ OPCODE(HASHCAT, B) /* R(a) = hash_cat(R(a),R(a+1)) */ OPCODE(LAMBDA, BB) /* R(a) = lambda(SEQ[b],L_LAMBDA) */ OPCODE(BLOCK, BB) /* R(a) = lambda(SEQ[b],L_BLOCK) */ diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index da598adaf..c64ffc473 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -1889,7 +1889,7 @@ codegen(codegen_scope *s, node *tree, int val) len++; } tree = tree->cdr; - if (val && len == 255) { + if (val && cursp() > 127) { pop_n(len*2); if (!update) { genop_2(s, OP_HASH, cursp(), len); diff --git a/mrbgems/mruby-test/mrbgem.rake b/mrbgems/mruby-test/mrbgem.rake index 6ce24bc94..97189a67b 100644 --- a/mrbgems/mruby-test/mrbgem.rake +++ b/mrbgems/mruby-test/mrbgem.rake @@ -26,6 +26,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| file assert_lib => assert_c file assert_c => [assert_rb, build.mrbcfile] do |t| + mkdir_p File.dirname(t.name) open(t.name, 'w') do |f| mrbc.run f, assert_rb, 'mrbtest_assert_irep' end diff --git a/test/t/kernel.rb b/test/t/kernel.rb index e3b9fe8ab..b7291a000 100644 --- a/test/t/kernel.rb +++ b/test/t/kernel.rb @@ -29,7 +29,7 @@ assert('Kernel.block_given?', '15.3.1.2.2') do end end -# Kernel.eval is provided by the mruby-gem mrbgem. '15.3.1.2.3' +# Kernel.eval is provided by the mruby-eval mrbgem. '15.3.1.2.3' assert('Kernel.iterator?', '15.3.1.2.5') do assert_false Kernel.iterator? @@ -59,20 +59,11 @@ assert('Kernel.loop', '15.3.1.2.8') do assert_equal 100, i end -assert('Kernel.p', '15.3.1.2.9') do - # TODO search for a way to test p to stdio - assert_true true -end +# Kernel.p is provided by the mruby-print mrbgem. '15.3.1.2.9' -assert('Kernel.print', '15.3.1.2.10') do - # TODO search for a way to test print to stdio - assert_true true -end +# Kernel.print is provided by the mruby-print mrbgem. '15.3.1.2.10' -assert('Kernel.puts', '15.3.1.2.11') do - # TODO search for a way to test puts to stdio - assert_true true -end +# Kernel.puts is provided by the mruby-print mrbgem. '15.3.1.2.11' assert('Kernel.raise', '15.3.1.2.12') do assert_raise RuntimeError do |
