Add specs for marshalling exceptions

This was causing a problem with the Rails specs and also relates to
issue #1123
Fix marshalling Exception

Fixes #1123
Add specs for String#gsub and String#gsub! on invalid encodings.

Calling String#gsub and String#gsub! on a string with invalid encoding
should raise ArgumentError.
Handle constant handling for unmarshalling directly

This catches the exception at the place where we raise it. This also
allows for a message similar to MRI, which apparently Rails depends on
in their code.
Add spec for StringIO with different encodings
Add String#byte_append and have StringIO use it

StringIO needs to binary add data together without doing any conversions
etc. This new primitive allows it to do that.

Fixes an issue with the ActiveSupport specs.
Update to latest logger from stdlib 1.9.3
Add specs for Regexp#match with a negative position
Fix Regexp#match with negative position from X19
Add specs for String#match with a negative position
Fix String#match with negative position from X19
Handle invalid encodings when calling String#gsub and String#gsub!
Ensure to reset valid and ascii_only flags when setting encoding
Merge branch 'razielgn-feature-gsub-raise-on-invalid-encoding'
Merge pull request #2408 from kachick/fix-match-negative_pos

{Regexp,String}#match should work with negative positions
Move setting sleeping status just before we actually might sleep

This makes sure we do this at the last possible moment.
Location#method_module can be nil here
Also use serials for JIT specializations

This uses the same check now as the cache invalidation, ensuring we
don't use old jitted code versions.
Add back -fPIC to CCDLFLAGS

Also see 22225807eb87f1d2b16c102a6cbdde75062b32b5