rubinius/rubinius — pull request #3112 by ryoqun (2014-08-19 15:15:27+00:00)
Title: Improve keyword arguments coercion and fix GC crash

I stil don't grasp the exact reason of GC crash being fixed..

It was reproducible was by this:

```bash
RBXOPT='-Xgc.young_autotune_lifetime=0 -Xgc.young_initial_bytes=1000000 -Xgc.young_max_bytes=1000000 -Xgc.show -Xint=1 -Xjit.show -Xjit.call_til_compile=10 -Xjit.call_inline_threshold=10 -Xjit.inline.debug -Xjit.debug' ./bin/mspec --repeat 200 spec/ruby/language/method_spec.rb
```

Errors were like these:

```
1)
A method assigns local variables from method parameters for definition
def m(*a, b: 1) [a, b] end FAILED
Expected [[#], 1]
to equal [[#], 1]

[[[ JIT queued Rubinius::CompiledCode#line_from_ip (method) (5) 1383/519 ]]]
[[[ JIT queued Rubinius::Location#is_block (method) (10) 1384/519 ]]]
[[[ JIT queued ANONYMOUS#show (block) (10) 1385/519 ]]]
[[[ JIT queued Rubinius::Location#describe (method) (10) 1386/519 ]]]
[[[ JIT queued Rubinius::Location#describe_receiver (method) (10) 1387/519 ]]]
[[[ JIT queued Rubinius::Location#line (method) (10) 1388/519 ]]]
[[[ JIT queued String#=~ (method) (10) 1389/519 ]]]
[[[ JIT queued Rubinius::Backtrace#color_from_loc (method) (10) 1390/519 ]]]
[[[ JIT queued ANONYMOUS#show (block) (10) 1391/519 ]]]
[[[ JIT queued Rubinius::Location#position (method) (10) 1392/519 ]]]
[[[ JIT queued Rubinius::Location#file (method) (10) 1393/519 ]]]
[[[ JIT queued Rubinius::CompiledCode#active_path (method) (10) 1394/519 ]]]
[[[ JIT queued String#* (method) (10) 1395/519 ]]]
[[[ JIT queued ANONYMOUS#backtrace (block) (10) 1396/519 ]]]
{ } in Object(SpecEvaluate)#__script__ at spec/ruby/language/method_spec.rb:905
BasicObject(SpecEvaluate)#instance_eval at kernel/common/eval.rb:43
BasicObject(Object)#instance_eval at kernel/common/eval.rb:43
{ } in Enumerable(Array)#all? at kernel/common/enumerable.rb:325
Array#each at kernel/bootstrap/array.rb:76
Enumerable(Array)#all? at kernel/common/enumerable.rb:325
Integer(Fixnum)#times at kernel/common/integer.rb:196
Array#each at kernel/bootstrap/array.rb:76
Array#each at kernel/bootstrap/array.rb:76
Object#__script__ at spec/ruby/language/method_spec.rb:441
Kernel.load at kernel/common/kernel.rb:447
BasicObject(Object)#instance_eval at kernel/common/eval.rb:43
Array#each at kernel/bootstrap/array.rb:76
Rubinius::CodeLoader#load_script at kernel/delta/code_loader.rb:66
Rubinius::CodeLoader.load_script at kernel/delta/code_loader.rb:152

```

```
Rubinius Crash Report #rbxcrashreport

Error: signal SIGSEGV

[[Backtrace]]
bin/rbx[0x67f171]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f2e53570340]
/lib/x86_64-linux-gnu/libc.so.6(+0x98f00)[0x7f2e528e7f00]
bin/rbx(_ZN8rubinius11MarkSweepGC11move_objectEPNS_6ObjectEmPb+0xa5)[0x738175]
bin/rbx(_ZN8rubinius12ObjectMemory14promote_objectEPNS_6ObjectE+0x84)[0x664c84]
bin/rbx(_ZN8rubinius7BakerGC10saw_objectEPNS_6ObjectE+0x138)[0x72e758]
bin/rbx(_ZN8rubinius14SingletonClass4Info9auto_markEPNS_6ObjectERNS_10ObjectMarkE+0x2a5)[0x6a29b5]
bin/rbx(_ZN8rubinius6Module4Info4markEPNS_6ObjectERNS_10ObjectMarkE+0x12)[0x6e2042]
bin/rbx(_ZN8rubinius16GarbageCollector11scan_objectEPNS_6ObjectE+0xc6)[0x732826]
bin/rbx(_ZN8rubinius7BakerGC7collectEPNS_6GCDataEPNS_17YoungCollectStatsE+0x154)[0x72ea24]
bin/rbx(_ZN8rubinius12ObjectMemory13collect_youngEPNS_5StateEPNS_6GCDataEPNS_17YoungCollectStatsE+0x71)[0x665061]
bin/rbx(_ZN8rubinius12ObjectMemory13collect_maybeEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x12d)[0x664dbd]
bin/rbx(_ZN8rubinius2VM13collect_maybeERNS_11GCTokenImplEPNS_9CallFrameE+0x45)[0x6b20f5]
bin/rbx[0x6bf383]
bin/rbx(_ZN8rubinius5Class8allocateEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x40)[0x6bedd0]
bin/rbx(_ZN8rubinius10Primitives14class_allocateEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x6e)[0x62500e]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x397)[0x6b9ed7]
bin/rbx(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x200)[0x6b9ac0]
bin/rbx(_ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi+0x3d)[0x6ba18d]
bin/rbx(_ZN8rubinius4Proc4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsE+0x283)[0x6fd4d3]
bin/rbx(_ZN8rubinius10Primitives9proc_callEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x52)[0x63f482]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x21eb)[0x5c6d2b]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x397)[0x6b9ed7]
bin/rbx(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x200)[0x6b9ac0]
bin/rbx(_ZN8rubinius16BlockEnvironment10call_underEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0xeb)[0x6ba3ab]
bin/rbx(_ZN8rubinius10Primitives16block_call_underEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x52)[0x621c22]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius8CallSite11empty_cacheEPNS_5StateEPS0_PNS_9CallFrameERNS_9ArgumentsE+0x156)[0x6bc216]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x2068)[0x5c6ba8]
bin/rbx(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x397)[0x6b9ed7]
bin/rbx(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x200)[0x6b9ac0]
bin/rbx(_ZN8rubinius16BlockEnvironment10call_underEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0xeb)[0x6ba3ab]
bin/rbx(_ZN8rubinius10Primitives16block_call_underEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x52)[0x621c22]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x1f83)[0x5c6ac3]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x2068)[0x5c6ba8]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x2068)[0x5c6ba8]
bin/rbx(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x397)[0x6b9ed7]
bin/rbx(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x200)[0x6b9ac0]
bin/rbx(_ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi+0x3d)[0x6ba18d]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x2ec4)[0x5c7a04]
bin/rbx(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x397)[0x6b9ed7]
bin/rbx(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x200)[0x6b9ac0]
bin/rbx(_ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi+0x3d)[0x6ba18d]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x2ce7)[0x5c7827]
bin/rbx(_ZN8rubinius11MachineCode19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x39f)[0x619e2f]
bin/rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x2068)[0x5c6ba8]

[[System Info]]
sysname: Linux
nodename: rrm
release: 3.16.0-9-generic
version: #14-Ubuntu SMP Fri Aug 15 15:03:57 UTC 2014
machine: x86_64
```

Maybe, this should also be fixed in vm/block_environment.cpp. But my sleep time has come... ;)