Skip to content
This repository

Jul 05, 2013

  1. Watson

    fix a bug in Array() where it will return incorrected value if passed…

    … NSArray as argument
    
    ary = [1, 2, 3] * 20
    nsary = NSArray.arrayWithArray(ary)
    
    p nsary.size        #=> 60
    p Array(nsary).size #=> Expected 60, but incorrected value returns
    authored

Jun 20, 2013

  1. Watson

    loop unrolling to improve the Objective-C methods performance in Stri…

    …ng object
    
    * before
          user     system      total        real
      2.310000   0.320000   2.630000 (  3.078306)
    
    * after
          user     system      total        real
      1.560000   0.230000   1.790000 (  2.309584)
    
    Test Code:
    ----
    framework 'Foundation'
    require 'benchmark'
    
    Benchmark.bm do |x|
      str = "abc" * 100000000
      x.report do
        str.writeToFile("test.txt", atomically:true, encoding:NSUTF8StringEncoding, error:nil)
      end
    end
    authored
  2. Watson

    refactor

    authored

Jun 17, 2013

  1. Watson

    fix a bug in defined?(super) which returns the incorrect value if use…

    … in included module
    
    Test Code:
    ----
    module Stuff
      def foo
        puts "In Stuff#foo"
        if defined?(super)
          puts "Calling super"
          super
        else
          puts "No super"
        end
      end
    end
    
    module OtherStuff
      def foo
        puts "In OtherStuff#foo"
        p defined?(super)
      end
    end
    
    class NoSuper
      include Stuff
    end
    NoSuper.new.foo
    
    class WithSuper
      include OtherStuff
      include Stuff
    end
    WithSuper.new.foo
    
    Result
    ----
    $ macruby t.rb
    In Stuff#foo
    Calling super
    /Volumes/Mac/Users/watson/tmp/t.rb:6:in `foo': super: no superclass method `foo' for #<NoSuper:0x4001a33a0> (NoMethodError)
    	from /Volumes/Mac/Users/watson/tmp/t.rb:23:in `<main>'
    
    Expected
    ----
    $ ruby t.rb
    In Stuff#foo
    No super
    In Stuff#foo
    Calling super
    In OtherStuff#foo
    nil
    authored

Jun 10, 2013

  1. Watson

    improve the performance of string interpolation

    This patch will reduce the count of reallocation.
    
    * before
          user     system      total        real
     10.900000   0.280000  11.180000 (  9.054008)
    
     * after
         user     system      total        real
     8.880000   0.230000   9.110000 (  7.260528)
    
    Test Code:
    ----
    require 'benchmark'
    
    Benchmark.bm do |x|
      part = "a" * 10
    
      x.report do
        1000000.times do
          "#{part} #{part} #{part} #{part} #{part} #{part} #{part}"
        end
      end
    end
    authored

May 19, 2013

  1. Watson

    update spec's tag

    authored
  2. Watson

    fix a bug in Module#remove_method which it could call undefined metho…

    …d if call it once
    
    Test Code:
    ----
    class Foo
      def meth
      end
    end
    
    obj = Foo.new
    obj.meth
    
    class Foo
      remove_method :meth
    end
    p obj.meth
    
    Result:
    ----
    $ macruby test_remove.rb
    nil
    
    Expected:
    ----
    $ ruby test_remove.rb
    test_remove.rb:12:in `<main>': undefined method `meth' for #<Foo:0x007fad558b9cc8> (NoMethodError)
    authored
  3. Watson

    fix a bug in `undef' which it could call undefined method if call it …

    …once
    
    Test Code:
    ----
    class Foo
      def meth
      end
    end
    
    obj = Foo.new
    obj.meth
    
    class Foo
      undef meth
    end
    p obj.meth
    
    Result:
    ----
    $ macruby test_undef.rb
    nil
    
    Expected:
    ----
    ruby test_undef.rb
    test_undef.rb:12:in `<main>': undefined method `meth' for #<Foo:0x007f8231935d18> (NoMethodError)
    authored
  4. Watson

    use MACRUBY_STATIC for rb_undef_alloc_func

    authored
  5. Watson

    update spec's tag

    authored
  6. Watson

    fix a bug in {Proc, Symbol}#allocate where it would be triggered the …

    …crash
    
    Result:
    $ macirb
    irb(main):001:0> Proc.allocate
    zsh: segmentation fault  macirb
    
    Expected:
    $ irb
    irb(main):001:0> Proc.allocate
    TypeError: allocator undefined for ProcExpected:
    authored

Apr 25, 2013

  1. Watson

    use macruby.mspec for `rake spec:list' task

    authored

Apr 24, 2013

  1. Watson

    enable IO specs

    authored
  2. Watson

    update rubyspec's tags

    authored

Apr 23, 2013

  1. Watson

    add BasicObject#__id__

    authored

Apr 21, 2013

  1. Watson

    not coerce an inline expansion

    authored

Apr 17, 2013

  1. Watson

    update rubyspec to dccc4f3

    authored
  2. Watson

    use inline instead of force_inline in vm_block_eval

    authored

Apr 13, 2013

  1. Watson

    [fix #208] fix a bug where set a constant which it will not raise an …

    …exception if it contains Fixnum in namaspec
    
    Result:
    $  macruby -e 'p 7::C = 42'
    42
    $ macruby -e 'A = 7; p A::C = 42'
    42
    
    Expect:
    $ ruby -e 'p 7::C = 42'
    -e:1:in `<main>': 7 is not a class/module (TypeError)
    $ ruby -e 'A = 7; p A::C = 42'
    -e:1:in `<main>': 7 is not a class/module (TypeError)
    authored

Apr 06, 2013

  1. Watson

    add rubyspec's tags

    authored
  2. Watson

    update rubyspec to 5f056fe

    authored
  3. Watson

    update mspec to 69c388b

    authored
  4. Watson

    update rubyspec's tags

    authored

Apr 04, 2013

  1. Watson

    [fix #203] fix a bug in super which fails to look up method in method…

    … which called by super
    
    The 'super' saves the calling status (caller class, selector, etc).
    At twice 'super' calling, look up wrong class.
    
    The following sequence had executed.
    
    - Base (Super class)
    - Foo (Inherited Base)
    
    1. Foo#bar -- super --> look up super class of Foo (Base)
    2. Foo#bar -- super --> look up super class of Base
    
    ----
    
    class Base
      def bar(args)
        $result << args.first
        if args = args[1..-1]
          obj = Foo.new
          obj.bar(args)
        end
      end
    end
    
    class Foo < Base
      def bar(args)
        $result << "a"
        super
      end
    end
    
    $result = []
    obj = Foo.new
    obj.bar(%w{1 2 3})
    p $result
    authored

Mar 10, 2013

  1. Watson

    fix a bug in respond_to_key which cannot generate a unique key for di…

    …fferent klass and sel
    
    The same key is generated in the following two cases.
    
    1. klass = 0xfd085b0
        sel = 0xfd3cf90
        (0xfd085b0 + 0xfd3cf90  -> 0x1FA45540)
    
    2. klass = 0xfd085d0
        sel = 0xfd3cf70
        (0xfd085d0 + 0xfd3cf70 -> 0x1FA45540)
    
      => generated key = 1068693925
    
    Object#respond_to? is not working as expected, because the keys that are not unique.
    authored

Feb 22, 2013

  1. Watson

    Merge pull request #189 from eitoball/encode_to_binary_before_writing…

    …_with_ssl_socket
    
    Encode to binary before writing with OpenSSL::SSL::SSLSocket
    authored
  2. Eito Katagiri

    follow changes in ruby/ruby@65ca601

    authored

Feb 21, 2013

  1. Eito Katagiri

    encode to binary before writing with ssl socket

    authored

Feb 20, 2013

  1. Watson

    add NSData#to_s

    authored

Feb 17, 2013

  1. Watson

    use __clang__ instead of __GNUC__

    because clang has __GNUC__ macro
    authored

Feb 15, 2013

  1. Watson

    Merge pull request #187 from eitoball/change_openssl_hmac_digest_enco…

    …ding_to_binary
    
    Change encoding of OpenSSL::HMAC.digest result to binary
    authored

Feb 12, 2013

  1. Eito Katagiri

    change encoding of OpenSSL::HMAC.digest result to binary

    authored

Feb 08, 2013

  1. Watson

    use pre-increment for C++ iterator

    authored

Jan 26, 2013

  1. Watson

    improve a performance in Array#hash

    * before
          user     system      total        real
      1.350000   0.010000   1.360000 (  1.356039)
    
    * after
          user     system      total        real
      0.800000   0.000000   0.800000 (  0.806837)
    
    Test Code
    ----
    Benchmark.bm do |x|
      ary = ["a", "b", "c"] * 10000
    
      x.report do
        1000.times do
          ary.hash
        end
      end
    end
    authored

Jan 17, 2013

  1. Watson

    fix a build error in GNU gcc 4.2

    authored
Something went wrong with that request. Please try again.