This articles was published on 2013-10-01

[Jul.Aug.Sep 2013] mruby news

What happened on the mruby front from July to September 2013?

Improve Core and Standard Library

The mruby-toplevel-ext GEM was added to the default GEMBox and the new mruby-exit GEM was created. The Exception class got the new method backtrace. And finally Object#instance_exec was implemented.

Refactoring

Several parts of the C API were refactored (i.e. Class, Array, String and Range).

Test Refactoring

After the big test refactoring in June 2013, more improvements to individual test cases were performed.

Garbage Collector

A large amount of commits from Fleurer were targeted at the Garbage Collector. Mainly refactoring and documentation work, but also several bugs and API improvements were done.

Commits

Here a list with all commits during this month.

Improve Core and Standard Library

add Exception#backtrace

add Exception#backtrace test

implement Class.new in C again

add new mrbgem mruby-exit

Cleaned up some of the Module#attr tests

Reset the so-render benchmark so that it is what it was before my attr performance testing.

Changed the attr methods in mrblib, so that they take advantage of validating the name against a string parameter if need be

Wrote tests around attr, attr_reader, attr_writer, attr_accessor

First round of trying to improve the performance of attr_reader and attr_writer. From ~24sec to ~15sec

add mruby-toplevel-ext as default

Add Object#instance_exec

add private/protected/public to main

add dummy visibility methods (public/protected/private) that do nothing; ref #1357

fix bugs on Heredocument – heredoc in array literal – heredoc in args – heredoc in expression expand

Refactoring

refactor genop_peep(); ref #1505

Refactor of String#start_with? comparison logic.

Refactor of String#end_with? comparison logic.

Fix for string-length-related issue in String#end_with? logic.

Added test case for String#end_with? with string of length 2.

Fix for string-length-related issue in String#start_with? logic.

Added test case for String#start_with? with string of length 1.

Check type of arguments for #start_with and #end_with.

add mrb_string_type().

refactor out longjmp() to a function

Refactor true_or() and false_and() in object.c.

Refactor codes using REGEXP_CLASS define.

Refactor mrb_range_beg_len() func in range.c

Refactor mrb_define_class() method in class.c.c

Refactor mrb_ary_eql() func in array.c.

Refactor mrb_ary_equal() func in array.c.

Add Range#eql? test case.

rename voidp to cptr

voidp should be an Object; close #1508

remove unreferenced local variables caused by mrb_assert()

rename node->filename to node->filename_index

rename debug function name

reduce node size

use uint16_t for line type

rename mrb_value_p() to mrb_ptr() since _p means predicate in mruby source

Rename –pull_gems to –pull-gems

remove unused mrb_proc_new_with_target()

remove unused inspect_range

use CHAR_BIT instead of bare 8

replace assert with mrb_assert

replace gc_assert with mrb_assert

introduce mrb_assert() in mruby.h

remove an unused local variable

Improve Tests

Improve test of mruby-objectspace-ext GEM

Improve test of mruby-toplevel-ext GEM

Improve test of mruby-symbol-ext GEM

Improve test of mruby-string-ext GEM

Improve test of mruby-range-ext GEM

Improve test of mruby-proc-ext GEM

Improve test of mruby-object-ext GEM

Improve test of mruby-numeric-ext GEM

Improve test of mruby-hash-ext GEM

Improve test of mruby-enum-ext GEM

I fix order of actual and expect test value in typeerror.rb.

I fix order of actual and expect test value in true.rb.

I fix order of actual and expect test value in syntax.rb.

I fix order of actual and expect test value in symbol.rb.

I fix order of actual and expect test value in string.rb.

I fix order of actual and expect test value in standarderror.rb.

I fix order of actual and expect test value in runtimeerror.rb.

I fix order of actual and expect test value in rangeerror.rb.

I fix order of actual and expect test value in range.rb.

I fix order of actual and expect test value in proc.rb.

I fix order of actual and expect test value in object.rb.

I fix order of actual and expect test value in numeric.rb.

I fix order of actual and expect test value in nomethoderror.rb.

I fix order of actual and expect test value in nil.rb.

I fix order of actual and expect test value in nameerror.rb.

I fix order of actual and expect test value in module.rb.

I fix order of actual and expect test value in localjumperror.rb.

I fix order of actual and expect test value in literals.rb.

I fix order of actual and expect test value in kernel.rb.

I fix order of actual and expect test value in integer.rb.

I fix order of actual and expect test value in indexerror.rb.

I fix order of actual and expect test value in hash.rb.

I fix order of actual and expect test value in gc.rb.

I fix order of actual and expect test value in float.rb.

I fix order of actual and expect test value in false.rb.

I fix order of actual and expect test value in exception.rb.

I fix order of actual and expect test value in enumerable.rb.

I fix order of actual and expect test value in class.rb.

I fix order of actual and expect test value in bs_block.rb.

I fix order of actual and expect test value in basicobject.rb.

Fix order of actual and expect test value for Array

Fix order of actual and expect test value for ArgumentError

Add a couple splat tests

Add test for Class.new(*args)

Garbage Collector

Refactor mrb_realloc() func in gc.c.

rename mrb_garbage_collect() to mrb_full_gc()

rename variable_gray_list to atomic_gray_list

introduce gc_mark_gray_list(), and cleanup redaunt code with it

cleanup redundant codes with incremental_gc_until()

rename advance_phase to incremental_gc_until

remove duplicated incremental_gc_until() in generational GC; #1449

clean up the warnings when GC_PROFILE is on

add comments for major GC

finish half-baked GC cycle before starting full GC; #1447

allow turning off GC generational mode by default by MRB_GC_TURN_OFF_GENERATIONAL; #1447

revise the comment in mrb_full_gc()

add comment for clear_all_old()

move mrb_gc_arena_restore() after cipop(); a bug found by Kilo Kawai

revise gc_mark_gray_list() not to cause SEGV on Ubuntu 32bit

restore once removed mrb_garbage_collect()

gc: replace comment “a round of GC” to “a GC cycle”

introduce incremental_gc_step()

gc: add comments for Generational Mode

revise the Two White Parts comments in gc.c

Others

Remove function delaration not implemented in code

fix build error when ENABLE_DEBUG is defined

change type of mrb->c->status from uint8_t to enum mrb_fiber_state; #1511

fix a bug introduced in prev commit

eliminate use of traditional intern API (mrb_intern()) completely

index to mrb_digitmap[] should always be positive

Use self for the given proc

incomplete renaming node->filename -> node->filename_index

Fix self value in a block is changed with return value for Fixnum, nil, instance variable.

Fixed self value in a block is changed with return value

remove executable bit from include/mruby/dump.h file

Fix checking return value of fread()

check file debug info is appended correctly

remove unnecessary scope filename update

update filename before appending file debug info

fix line getting handler of line_ary

add comment to mrb_assert in src/debug.c

check returning line entry pointer is greater or equal to the first line entry pointer

fix wrong assertion fail when debug info contains more than one files

BUG: mrb_irep_free (access of freed memory)

MSVC: compilation works again (+minor style fixes)

remove Exception#verbose_backtrace; #1495

fix line number after first file

improve checkings in debug.c

don’t use RArray in filename table generating

declare variable outside for

better line type selector

support c++ in mruby/debug.h

support multiple filename in irep

print singleton class name in verbose backtrace

add verbose_backtrace

fix crash in 2nd call to vsnprintf

revert #1470; fix #1493

Removed unnecessary #undef ISPRINT in include/mruby.h

Remove function delarations not implemented in code

support file extension .cpp/.cxx in mrbgem and tool

do not use mrb_alloca() that keeps memory until mrb_state freed

add cast to void*

undef print_backtrace_i() unless ENABLE_STDIO

Fix a problem of ‘z’ option and shared string

add x86_64-darwin host platform.

android doesn’t have log2

remove unnecessary return

Fix return block argument error

remove Class#alloc method

use newer DATA API

remove Ruby defined Class#new

remove alloc from Time class

redesign mruby/data.h API; use DATA_PTR() for raw data pointer, DATA_GET_PTR() to type safe retrieval (TypeError will be raised), DATA_CHECK_GET_PTR() to get nil if type mismatched

add compatibility macro mrb_class_new_instance()

check d->type before accessing d->type->dfree; #1474 #858

define allocation method for Time class; close #1474

longjmp too far when exception raised from C function called from mrb_funcall()

Test for Class#inherited

Fix inerited to inherited

Adding line numbers to the output of mirb.

Add two tests for issue #1467

This check and class change is redundant because it is done in class.c#mrb_include_module

Remove debug printf

ci->target_class should point to ICLASS, not MODULE; close #1467

I add ISO test ’15.2.12.3′ included modules in Arrray

define Class#new in ruby to call #initialize

fix #1459

move (void) cast after declarations

I fix ISO No in String class in comparison with ISO_IEC_30170_2012(E)-Charactor_PDF_document.pdf

Silence ‘unused parameter’ warnings

def statement and define_method now return symbol a la Ruby2.1

parse.y: fixed bison 3.0 warning

class.c and numeric.c: fixed MSVC warnings

parse.y: don’t use strcat

don’t use str{cpy,cat} in mruby and mrbc

use intptr_t instead of int64_t for 32bit platforms

fix #1442

return statement should terminate execution of a method defined by define_method

Add travisci badge

muby-time: use mrb_free directly

add “Yuichi Nishiwaki” to AUTHORS

should protect resume fiber by write barrier; close #1434

fix bugs in comment

add commentary to value representation

bugfix: the bit mask was smaller than the size it should be

revert one of the API changes: MRB_SET_VALUE_P no longer used

cosmetic changes

implement 64bit nan-boxing

add read barrier to value.p

Set filename like irb

Added support for custom gem clone directories when using git

End loop if nextc is -1

add mrbc -h option

Fix assignment of block as actual value and not expected

ci->target_class should be updated as well; #1418

remove unnecessary spaces

stop storing target_class info for C defined methods

forget to re-initialize target_class for top-level eval; close #1418

Remove pop that was done when not a return val

I replace ‘Pre-Conditions’ with ‘Preconditions’ because the former is a wrong word.

replace “if not” to “unless”

I replace 0 with NULL because struct pointer be should set NULL in.

I correct the mistakes of grammer in README.md. ‘update’ word is an countable noun.

I correct the mistakes of grammer in README.md.

enabe MRB_DEBUG on travis_config.rb

if mrbc.run fail, abort rake

I fix typos in variable.c.

suppress the warnings from get_valid_iv_sym()

fix warning

Fix mrbc error for space included path

String `=~` and `match` to work with pluggable Regexp; close #1398

Check home is null

“spec.author” is better for single-author gems.

display multiple authors better.

If readline is enabled add readline to libraries to link

Move home variable into readline ifdef

change else formatting

Slight cleanup of code

Fail if dependency isn’t found

Improve Android NDK toolchain support.

Changed use of MRB_INT_MAX to MRB_INT_MAX-1

Use env[USERPROFILE] for Windows

Save mirb history when readline enabled

Fix string test for so that it works for int16

Fix warning by making call explicit

Repalace int with mrb_bool because a return value is boolean.

Allow programmers to specify build path manually

Add comments.

Replace int with mrb_bool because a return value is boolean.

Replace 0 with NULL because struct pointer is set NULL in.

Replace 0 with NULL because set NULL in sturct pointer.

Replace int with mrb_bool because return a value is boolean.

Replace 0 with FALSE and replace 1 with TRUE.

Add comments in variable.c

Replace mrb_intern() with mrb_intern2() in random.c

Replace mrb_intern() with mrb_intern2() or mrb_intern_cstr().

Replace 0 with NULL because NULL is used in struct pointer.

singleton class super initialize failed

make_metaclass should skip MRB_TT_ICLASS; close #1369

make_metaclass should skip MRB_TT_ICLASS; close #1369

Fix comments in opcode.h

Add comments in opcode.h

Fix indents in opcode.h.

add the name ‘Narihiro Nakamura’

2.Replace mrb_intern() func with mrb_intern2() func or mrb_intern_cstr() func.

Replace mrb_intern() func with mrb_intern2() func or mrb_intern_cstr() func.

mark stacks in final_marking; close #1359; close #1362

factor out context stack marking

Replace mrb_intern() with mrb_intern_cstr().

Replace 0 with ‘\0′ as nul terminated string.

put pointer tables before bitmap to avoid alignment issues; ref #1353

mrb_bob_missing to use mrb_get_args(“n”)

mrb_mod_alias to use mrb_get_args(“nn”)

Fix the androideabi toolchain not matching host

call Class#inherited when Class.new(klass)

It optimizes more.

Change parameter type to suppress -Wsign-compare warnings

kh_resize_##name bug fixed.

Change width to size_t to fix warning

Add a few more shift tests

khash optimize

[doc]Introduce ./minirake –pull_gems

[doc]Introduce ./minirake -v

Fix indents in object.c.

Add the name ‘Jun Hiroe’ in AUTHORS.

name format updated for MATSUMOTO Ryosuke

Add yet another Matsumoto

Could you add me to AUTHORS?

Add –pull_gems option to minirake

Add comments in mrb_state struct.

Add comments in mrb_get_args() func.

Fix signed/unsigned warning, size_t for start_index was discarded.

Fix signed/unsigned warning.

Fix signed/unsigned warning, make pcapa a size_t

Add include for toplevel self(main)

Fix signed/unsigned warning.

Fix unsigned/signed warning.

Fix unsigned/signed comparison.

Add mrb_class_get_under()