<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_time.rb, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[DOC] State timezone info in the string wins `in:` keyword</title>
<updated>2023-11-24T10:38:55+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-11-24T10:16:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2ecc372a5d623ff4e470c354c771f8797e527c2d'/>
<id>2ecc372a5d623ff4e470c354c771f8797e527c2d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use embedded TypedData for Time objects</title>
<updated>2023-11-07T20:48:06+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-11-07T18:22:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=aa6642de630cfc10063154d84e45a7bff30e9103'/>
<id>aa6642de630cfc10063154d84e45a7bff30e9103</id>
<content type='text'>
This drops the total size of a Time object from 86 bytes to 80 bytes.

Running the benchmark benchmark/time_now.yml, this commit improves
performance of Time.now by about 30%:

```
  Time.now
Branch:  13159405.4 i/s
Master:  10036908.7 i/s - 1.31x  slower

  Time.now(in: "+09:00")
Branch:   2712172.6 i/s
Master:   2138637.9 i/s - 1.27x  slower
```

It also decreases memory usage by about 20%:

```
ary = 10_000_000.times.map { Time.now }

puts `ps -o rss= -p #{$$}`
```

Branch: 961792
Master: 1196544

Co-Authored-By: Jean Boussier &lt;byroot@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This drops the total size of a Time object from 86 bytes to 80 bytes.

Running the benchmark benchmark/time_now.yml, this commit improves
performance of Time.now by about 30%:

```
  Time.now
Branch:  13159405.4 i/s
Master:  10036908.7 i/s - 1.31x  slower

  Time.now(in: "+09:00")
Branch:   2712172.6 i/s
Master:   2138637.9 i/s - 1.27x  slower
```

It also decreases memory usage by about 20%:

```
ary = 10_000_000.times.map { Time.now }

puts `ps -o rss= -p #{$$}`
```

Branch: 961792
Master: 1196544

Co-Authored-By: Jean Boussier &lt;byroot@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove --disable-gems for assert_separately</title>
<updated>2023-08-03T00:11:08+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-08-02T21:02:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4b6c584023f41827c891f33a16cb5db221b7cd19'/>
<id>4b6c584023f41827c891f33a16cb5db221b7cd19</id>
<content type='text'>
assert_separately adds --disable=gems so we don't need to add
--disable-gems when calling assert_separately.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
assert_separately adds --disable=gems so we don't need to add
--disable-gems when calling assert_separately.
</pre>
</div>
</content>
</entry>
<entry>
<title>Tighten Time.new(string) parsing</title>
<updated>2023-07-13T23:49:39+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-06-22T21:31:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5d4fff845602872eef072e7611558b5f8762efe0'/>
<id>5d4fff845602872eef072e7611558b5f8762efe0</id>
<content type='text'>
Disallow:

* Only year-month
* Only year-month-day
* Preceding whitespace
* Trailing whitespace

Fixes [Bug #19293]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Disallow:

* Only year-month
* Only year-month-day
* Preceding whitespace
* Trailing whitespace

Fixes [Bug #19293]
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix crash in Time on 32-bit systems</title>
<updated>2023-04-04T15:12:07+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-04-04T13:27:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a84c99468f26a9f79fec57926d561ed906505eac'/>
<id>a84c99468f26a9f79fec57926d561ed906505eac</id>
<content type='text'>
[Bug #19575]

struct vtm is packed causing it to have a size that is not aligned on
32-bit systems. When allocating it on the stack, it will have unaligned
addresses which means that the fields won't be marked by the GC when
scanning the stack (since the GC only marks aligned addresses). This can
cause crashes when the fields are heap allocated objects like Bignums.

This commit moves the flags in struct time_object into struct vtm for
space efficiency and removes the need for packing.

This is an example of a crash:

    ruby(rb_print_backtrace+0xd) [0x56848945] ../src/vm_dump.c:785
    ruby(rb_vm_bugreport) ../src/vm_dump.c:1101
    ruby(rb_assert_failure+0x7a) [0x56671857] ../src/error.c:878
    ruby(vm_search_cc+0x0) [0x56666e47] ../src/vm_method.c:1366
    ruby(rb_vm_search_method_slowpath) ../src/vm_insnhelper.c:2090
    ruby(callable_method_entry+0x5) [0x568232d3] ../src/vm_method.c:1406
    ruby(rb_callable_method_entry) ../src/vm_method.c:1413
    ruby(gccct_method_search_slowpath) ../src/vm_eval.c:427
    ruby(gccct_method_search+0x20f) [0x568237ef] ../src/vm_eval.c:476
    ruby(opt_equality_by_mid_slowpath+0x2c) [0x5682388c] ../src/vm_insnhelper.c:2338
    ruby(rb_equal+0x37) [0x566fe577] ../src/object.c:133
    ruby(rb_big_eq+0x34) [0x56876ee4] ../src/bignum.c:5554
    ruby(rb_int_equal+0x14) [0x566f3ed4] ../src/numeric.c:4640
    ruby(rb_int_equal) ../src/numeric.c:4634
    ruby(vm_call0_cfunc_with_frame+0x6d) [0x568303c2] ../src/vm_eval.c:148
    ruby(vm_call0_cfunc) ../src/vm_eval.c:162
    ruby(vm_call0_body) ../src/vm_eval.c:208
    ruby(rb_funcallv_scope+0xd1) [0x56833971] ../src/vm_eval.c:85
    ruby(RB_TEST+0x0) [0x567e8488] ../src/time.c:78
    ruby(eq) ../src/time.c:78
    ruby(small_vtm_sub) ../src/time.c:1523
    ruby(timelocalw+0x23b) [0x567f3e9b] ../src/time.c:1593
    ruby(time_s_alloc+0x0) [0x567f536b] ../src/time.c:3698
    ruby(time_new_timew) ../src/time.c:2694
    ruby(time_s_mktime) ../src/time.c:3698
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #19575]

struct vtm is packed causing it to have a size that is not aligned on
32-bit systems. When allocating it on the stack, it will have unaligned
addresses which means that the fields won't be marked by the GC when
scanning the stack (since the GC only marks aligned addresses). This can
cause crashes when the fields are heap allocated objects like Bignums.

This commit moves the flags in struct time_object into struct vtm for
space efficiency and removes the need for packing.

This is an example of a crash:

    ruby(rb_print_backtrace+0xd) [0x56848945] ../src/vm_dump.c:785
    ruby(rb_vm_bugreport) ../src/vm_dump.c:1101
    ruby(rb_assert_failure+0x7a) [0x56671857] ../src/error.c:878
    ruby(vm_search_cc+0x0) [0x56666e47] ../src/vm_method.c:1366
    ruby(rb_vm_search_method_slowpath) ../src/vm_insnhelper.c:2090
    ruby(callable_method_entry+0x5) [0x568232d3] ../src/vm_method.c:1406
    ruby(rb_callable_method_entry) ../src/vm_method.c:1413
    ruby(gccct_method_search_slowpath) ../src/vm_eval.c:427
    ruby(gccct_method_search+0x20f) [0x568237ef] ../src/vm_eval.c:476
    ruby(opt_equality_by_mid_slowpath+0x2c) [0x5682388c] ../src/vm_insnhelper.c:2338
    ruby(rb_equal+0x37) [0x566fe577] ../src/object.c:133
    ruby(rb_big_eq+0x34) [0x56876ee4] ../src/bignum.c:5554
    ruby(rb_int_equal+0x14) [0x566f3ed4] ../src/numeric.c:4640
    ruby(rb_int_equal) ../src/numeric.c:4634
    ruby(vm_call0_cfunc_with_frame+0x6d) [0x568303c2] ../src/vm_eval.c:148
    ruby(vm_call0_cfunc) ../src/vm_eval.c:162
    ruby(vm_call0_body) ../src/vm_eval.c:208
    ruby(rb_funcallv_scope+0xd1) [0x56833971] ../src/vm_eval.c:85
    ruby(RB_TEST+0x0) [0x567e8488] ../src/time.c:78
    ruby(eq) ../src/time.c:78
    ruby(small_vtm_sub) ../src/time.c:1523
    ruby(timelocalw+0x23b) [0x567f3e9b] ../src/time.c:1593
    ruby(time_s_alloc+0x0) [0x567f536b] ../src/time.c:3698
    ruby(time_new_timew) ../src/time.c:2694
    ruby(time_s_mktime) ../src/time.c:3698
</pre>
</div>
</content>
</entry>
<entry>
<title>bignum.c: rb_int_parse_cstr handle `0` strings</title>
<updated>2023-01-30T13:42:40+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>byroot@ruby-lang.org</email>
</author>
<published>2023-01-30T10:03:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3f54d09a5b8b6e4fd734abc8911e170d5967b5b0'/>
<id>3f54d09a5b8b6e4fd734abc8911e170d5967b5b0</id>
<content type='text'>
[Bug #19390]

We shouldn't check the string length when skipping zeros, as the
string might only contains zero characters, resulting in an empty string.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #19390]

We shouldn't check the string length when skipping zeros, as the
string might only contains zero characters, resulting in an empty string.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19296] Precheck bits of time components</title>
<updated>2023-01-02T14:29:19+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-01-02T14:23:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5be0d42d2c4dc765230c76738289560f9ee37f09'/>
<id>5be0d42d2c4dc765230c76738289560f9ee37f09</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add missing assertion</title>
<updated>2023-01-02T14:17:27+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-01-02T14:17:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=291a4098cf649c027cb50c16b872455f26ad1dfb'/>
<id>291a4098cf649c027cb50c16b872455f26ad1dfb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19292] Re-initialize tm when wday or yday is not set</title>
<updated>2023-01-01T07:39:00+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-01-01T07:39:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=542e984d82fa25098eb15398d716d907acc52b93'/>
<id>542e984d82fa25098eb15398d716d907acc52b93</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Feature #18033] Parse more strictly conformant with ISO-8601</title>
<updated>2022-12-16T13:52:59+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-11-18T05:18:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3e49d62bc1696a7943e4407328714e32b539b007'/>
<id>3e49d62bc1696a7943e4407328714e32b539b007</id>
<content type='text'>
* 4-digits or more is required as year
* Minutes and seconds parts are not ommittable
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 4-digits or more is required as year
* Minutes and seconds parts are not ommittable
</pre>
</div>
</content>
</entry>
</feed>
