ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:84940] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits
       [not found] <redmine.issue-14378.20180120102459@ruby-lang.org>
@ 2018-01-20 10:25 ` sxysxygm
  2018-01-20 11:08 ` [ruby-core:84941] " nobu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: sxysxygm @ 2018-01-20 10:25 UTC (permalink / raw
  To: ruby-core

Issue #14378 has been reported by HfCloud (Xiangyu Shi).

----------------------------------------
Bug #14378: On windows, RUBY_FIXNUM_MAX of 64 bits ruby  is 32 bits
https://bugs.ruby-lang.org/issues/14378

* Author: HfCloud (Xiangyu Shi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.5.0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
On windows, start an IRB of a 64-bits ruby, enter these code:
~~~ ruby
(1<<29).equal?(1<<29)  
#=>true
(1<<30).equal?(1<<30)
#=>false
~~~
So, it is that FIXNUM of the 64-bits ruby is a 32-bits data?
But my friend try these code on linux platform and all got true(it means FIXNUM is 64bits) 
Then I opened ruby/ruby.h and found this:
~~~ ruby
#define RUBY_FIXNUM_MAX (LONG_MAX>>1)
~~~
The LONG_MAX of my compiler(msvc140, vs2017) is 2147483647, and the ruby which is installed by ruby-installer also have the same problem.





-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:84941] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits
       [not found] <redmine.issue-14378.20180120102459@ruby-lang.org>
  2018-01-20 10:25 ` [ruby-core:84940] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits sxysxygm
@ 2018-01-20 11:08 ` nobu
  2018-01-20 11:29 ` [ruby-core:84942] " sxysxygm
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: nobu @ 2018-01-20 11:08 UTC (permalink / raw
  To: ruby-core

Issue #14378 has been updated by nobu (Nobuyoshi Nakada).

Description updated

HfCloud (Xiangyu Shi) wrote:
> So, it is that FIXNUM of the 64-bits ruby is a 32-bits data?

Yes, we are using `long` for fixnums, and Windows is the so-called IL32LLP64 platform.
To "fix" this, or relax this limitation, we have to replace tons of `long` in the source code.


----------------------------------------
Bug #14378: On windows, RUBY_FIXNUM_MAX of 64 bits ruby  is 32 bits
https://bugs.ruby-lang.org/issues/14378#change-69650

* Author: HfCloud (Xiangyu Shi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.5.0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
On windows, start an IRB of a 64-bits ruby, enter these code:

~~~ruby
(1<<29).equal?(1<<29) 
#=>true

(1<<30).equal?(1<<30)
#=>false
~~~

So, it is that FIXNUM of the 64-bits ruby is a 32-bits data?
But my friend try these code on linux platform and all got true(it means FIXNUM is 64bits) 
Then I opened ruby/ruby.h and found this:

~~~ ruby
#define RUBY_FIXNUM_MAX (LONG_MAX>>1)
~~~

The LONG_MAX of my compiler(msvc140, vs2017) is 2147483647, and the ruby which is installed by ruby-installer also have the same problem.





-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:84942] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits
       [not found] <redmine.issue-14378.20180120102459@ruby-lang.org>
  2018-01-20 10:25 ` [ruby-core:84940] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits sxysxygm
  2018-01-20 11:08 ` [ruby-core:84941] " nobu
@ 2018-01-20 11:29 ` sxysxygm
  2018-01-20 12:01 ` [ruby-core:84945] " sxysxygm
  2018-01-20 14:22 ` [ruby-core:84947] " eregontp
  4 siblings, 0 replies; 7+ messages in thread
From: sxysxygm @ 2018-01-20 11:29 UTC (permalink / raw
  To: ruby-core

Issue #14378 has been updated by HfCloud (Xiangyu Shi).


I'm using vs2017 and embed ruby interpreter in my game engine. In certain situation I need to use Fixnum to pass values of pointers(64-bits pointers). So ruby will use big integer to pass the pointer's values, what may cause unsatisfying performance on runtime speed.

----------------------------------------
Bug #14378: On windows, RUBY_FIXNUM_MAX of 64 bits ruby  is 32 bits
https://bugs.ruby-lang.org/issues/14378#change-69651

* Author: HfCloud (Xiangyu Shi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.5.0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
On windows, start an IRB of a 64-bits ruby, enter these code:

~~~ruby
(1<<29).equal?(1<<29) 
#=>true

(1<<30).equal?(1<<30)
#=>false
~~~

So, it is that FIXNUM of the 64-bits ruby is a 32-bits data?
But my friend try these code on linux platform and all got true(it means FIXNUM is 64bits) 
Then I opened ruby/ruby.h and found this:

~~~ ruby
#define RUBY_FIXNUM_MAX (LONG_MAX>>1)
~~~

The LONG_MAX of my compiler(msvc140, vs2017) is 2147483647, and the ruby which is installed by ruby-installer also have the same problem.





-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:84945] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits
       [not found] <redmine.issue-14378.20180120102459@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2018-01-20 11:29 ` [ruby-core:84942] " sxysxygm
@ 2018-01-20 12:01 ` sxysxygm
  2018-01-21  0:15   ` [ruby-core:84954] " Bill Kelly
  2018-01-20 14:22 ` [ruby-core:84947] " eregontp
  4 siblings, 1 reply; 7+ messages in thread
From: sxysxygm @ 2018-01-20 12:01 UTC (permalink / raw
  To: ruby-core

Issue #14378 has been updated by HfCloud (Xiangyu Shi).


nobu (Nobuyoshi Nakada) wrote:
> To "fix" this, or relax this limitation, we have to replace tons of `long` in the source code.

Oh...I tried just now. The codes uses so large amount of '#define' to alias types' names, it makes the work more difficult.....
what I only want to say is 'why didn't use typedef?...' I found that Matz once said 'IL32LLP64 platform is not hackneyed' :(

----------------------------------------
Bug #14378: On windows, RUBY_FIXNUM_MAX of 64 bits ruby  is 32 bits
https://bugs.ruby-lang.org/issues/14378#change-69653

* Author: HfCloud (Xiangyu Shi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.5.0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
On windows, start an IRB of a 64-bits ruby, enter these code:

~~~ruby
(1<<29).equal?(1<<29) 
#=>true

(1<<30).equal?(1<<30)
#=>false
~~~

So, it is that FIXNUM of the 64-bits ruby is a 32-bits data?
But my friend try these code on linux platform and all got true(it means FIXNUM is 64bits) 
Then I opened ruby/ruby.h and found this:

~~~ ruby
#define RUBY_FIXNUM_MAX (LONG_MAX>>1)
~~~

The LONG_MAX of my compiler(msvc140, vs2017) is 2147483647, and the ruby which is installed by ruby-installer also have the same problem.





-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:84947] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits
       [not found] <redmine.issue-14378.20180120102459@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2018-01-20 12:01 ` [ruby-core:84945] " sxysxygm
@ 2018-01-20 14:22 ` eregontp
  4 siblings, 0 replies; 7+ messages in thread
From: eregontp @ 2018-01-20 14:22 UTC (permalink / raw
  To: ruby-core

Issue #14378 has been updated by Eregon (Benoit Daloze).


This is indeed very surprising that on a platform with 64-bit pointers, Fixnum are still only 30 bits.
+1 to making this more intuitive.
It creates a lot of weird edge cases in ruby/spec.

There are also places in the code where VALUE is used as a synonym of unsigned long (e.g.: rb_uint2inum(VALUE)) but those should just be replaced by "unsigned long".

----------------------------------------
Bug #14378: On windows, RUBY_FIXNUM_MAX of 64 bits ruby  is 32 bits
https://bugs.ruby-lang.org/issues/14378#change-69657

* Author: HfCloud (Xiangyu Shi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.5.0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
On windows, start an IRB of a 64-bits ruby, enter these code:

~~~ruby
(1<<29).equal?(1<<29) 
#=>true

(1<<30).equal?(1<<30)
#=>false
~~~

So, it is that FIXNUM of the 64-bits ruby is a 32-bits data?
But my friend try these code on linux platform and all got true(it means FIXNUM is 64bits) 
Then I opened ruby/ruby.h and found this:

~~~ ruby
#define RUBY_FIXNUM_MAX (LONG_MAX>>1)
~~~

The LONG_MAX of my compiler(msvc140, vs2017) is 2147483647, and the ruby which is installed by ruby-installer also have the same problem.





-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:84954] Re: [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits
  2018-01-20 12:01 ` [ruby-core:84945] " sxysxygm
@ 2018-01-21  0:15   ` Bill Kelly
  2018-01-21  6:48     ` [ruby-core:84955] " Bill Kelly
  0 siblings, 1 reply; 7+ messages in thread
From: Bill Kelly @ 2018-01-21  0:15 UTC (permalink / raw
  To: Ruby developers

sxysxygm@gmail.com wrote:
>
> what I only want to say is 'why didn't use typedef?...'

In the 1980s, when the 'int' type was fluctuating between 16 bits and
32 bits, we learned to _NEVER_ trust naked C types.

This defensive tactic may have been lost during the 90's and early 2000's
while 32-bit platforms had a lengthy run.

(Interesting to see the old problem re-emerge finally, 30 years later.)


Regards,

Bill



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:84955] Re: [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits
  2018-01-21  0:15   ` [ruby-core:84954] " Bill Kelly
@ 2018-01-21  6:48     ` Bill Kelly
  0 siblings, 0 replies; 7+ messages in thread
From: Bill Kelly @ 2018-01-21  6:48 UTC (permalink / raw
  To: Ruby developers

a mere data point:

(cygwin-64 ruby includes the full 64-bit Fixnum)

>> RUBY_VERSION
=> "2.2.5"
>> `uname -om`
=> "x86_64 Cygwin\n"
>> (1<<61).class
=> Fixnum
>> (1<<62).class
=> Bignum



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-01-21  6:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-14378.20180120102459@ruby-lang.org>
2018-01-20 10:25 ` [ruby-core:84940] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits sxysxygm
2018-01-20 11:08 ` [ruby-core:84941] " nobu
2018-01-20 11:29 ` [ruby-core:84942] " sxysxygm
2018-01-20 12:01 ` [ruby-core:84945] " sxysxygm
2018-01-21  0:15   ` [ruby-core:84954] " Bill Kelly
2018-01-21  6:48     ` [ruby-core:84955] " Bill Kelly
2018-01-20 14:22 ` [ruby-core:84947] " eregontp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).