Remove duplicate NotImplementedError class definition
Merge pull request #2027 from ikataitsev/master

Removed duplicate NotImplementedError definition
Failing test for encoding a string where target == source encoding
Add -tx18 option to bin/mspec

This allows to run the specs in 1.8 mode if you are
using 1.9 mode by default.
Add -tx20 option to bin/mspec

This allows to run the specs in 2.0 mode.
Add -tx18, -tx19 and -tx20 options to the docs
Merge pull request #2031 from frodsan/add_tx18_option

Add -tx18 and -tx20 options to bin/mspec
Fix Socket#new on X19.

Socket#new `socket_type` argument can accept a symbol
or string that references to a `Socket::SOCK_*`
constant.

    require 'socket'

    # Before:

    >> Socket.new(Socket::PF_UNIX, :DGRAM, 0)
    TypeError: Tried to use non-reference value 0x10256 as type Bignum (10)

    >> Socket.new(Socket::PF_UNIX, 'SOCK_DGRAM', 0)
    TypeError: converting to int

    # After:

    >> Socket.new(Socket::PF_UNIX, :DGRAM, 0)
    => #<Socket:fd 5>

    >> Socket.new(Socket::PF_UNIX, 'SOCK_DGRAM', 0)
    => #<Socket:fd 6>
Add specs for Socket#new on X19
Fix Socket#new on X18

This fixes the following behaviour:

    require 'socket'

    # rbx -X18
    >> Socket.new(Socket::PF_UNIX, 'SOCK_DGRAM', 0)
    TypeError: converting to int

    >> Socket.new(Socket::PF_UNIX, :DGRAM, 0)
    TypeError: Tried to use non-reference value 0xf266 as type Bignum (10)

    # ruby1.8

    >> Socket.new(Socket::PF_UNIX, 'SOCK_DGRAM', 0)
    => #<Socket:0x106117798>

    >> Socket.new(Socket::PF_UNIX, :DGRAM, 0)
    Errno::EPROTONOSUPPORT: Protocol not supported - socket(2)
Add specs for Socket#new on X18
Merge pull request #2033 from frodsan/fix_socket_new_19

Fix Socket#new on X19.
Fix invalid memory writing in String

We were writing outside the string space in rare cases. The problem is
that when the original string had a capacity of 0 and the appended
string also has size 0. This results in a new minimal capacity of 0.

This means the string didn't need to be resized, but we still write a \0
byte at the end. This means we overwrite memory of the next object in
memory, causing corruption.

This change makes sure we always increase the capacity when needed.

Fixes #2030
Style improvements for VM code

In general we prefer using C++ style casts over C ones. Also we don't
need to cast if we already have the correct type. In a few cases we
should use our proper as<> template for casting.

In the tooling interface we also have methods for casting, so we should
use them and not do it manually.

Another thing is to make sure we initialize all properties in
constructors.

Lastly we use variable array allocation where we can instead of using
alloca() manually. This creates much simpler and easier to understand
code.
Make sure don't write outside buffer for encodings
More places to use variable arrays
Don't share a global stream for loading data

This creates global states and corrupts reading data in all kinds of
random ways. We should never do this.

Fixes #2035
Change private directive to be explicit
Merge pull request #2038 from frodsan/fix_implicit_privates

Change private directive to be explicit
Specs for encoding of STDIN, STDOUT, STDERR.