ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use
@ 2013-06-24 21:14 headius (Charles Nutter)
  2013-06-25  2:01 ` [ruby-core:55641] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
                   ` (15 more replies)
  0 siblings, 16 replies; 18+ messages in thread
From: headius (Charles Nutter) @ 2013-06-24 21:14 UTC (permalink / raw
  To: ruby-core


Issue #8568 has been reported by headius (Charles Nutter).

----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:55641] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
@ 2013-06-25  2:01 ` nobu (Nobuyoshi Nakada)
  2013-06-25  3:50 ` [ruby-core:55642] " headius (Charles Nutter)
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-06-25  2:01 UTC (permalink / raw
  To: ruby-core


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


In current CRuby, Fixnum is always limited as long, so Fixnum#size represents sizeof(long), not word size.
But it depends on what you define "word" as, of course.
If you mean SIZEOF_VALUE by "word size", it's simply a bug to use Fixnum#size for that purpose.

A way to achieve size of a pointer is `[""].pack("p").size` currently.
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-40125

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:55642] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
  2013-06-25  2:01 ` [ruby-core:55641] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
@ 2013-06-25  3:50 ` headius (Charles Nutter)
  2013-06-25  5:05 ` [ruby-core:55643] " nobu (Nobuyoshi Nakada)
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: headius (Charles Nutter) @ 2013-06-25  3:50 UTC (permalink / raw
  To: ruby-core


Issue #8568 has been updated by headius (Charles Nutter).


Size of a pointer is probably what I'm looking for, since that's usually what people will be using it for. However, implementations that can't give out real pointers can't support pack("p"), so that's not a portable option either.

So... RbConfig::CONFIG['pointer_size'] and some constant?
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-40126

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:55643] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
  2013-06-25  2:01 ` [ruby-core:55641] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
  2013-06-25  3:50 ` [ruby-core:55642] " headius (Charles Nutter)
@ 2013-06-25  5:05 ` nobu (Nobuyoshi Nakada)
  2013-06-25 10:48 ` [ruby-core:55647] " naruse (Yui NARUSE)
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-06-25  5:05 UTC (permalink / raw
  To: ruby-core


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


'pointer' or 'value'?

I'm curious for what purpose people use that size.
Pointers are not used usually in ruby, I think.

----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-40127

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:55647] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (2 preceding siblings ...)
  2013-06-25  5:05 ` [ruby-core:55643] " nobu (Nobuyoshi Nakada)
@ 2013-06-25 10:48 ` naruse (Yui NARUSE)
  2013-06-25 11:16 ` [ruby-core:55648] Re: [CommonRuby - Feature #8568][Open] " Tanaka Akira
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: naruse (Yui NARUSE) @ 2013-06-25 10:48 UTC (permalink / raw
  To: ruby-core


Issue #8568 has been updated by naruse (Yui NARUSE).


The place where word size info should be seems RbConfig, if it is needed.

nobu (Nobuyoshi Nakada) wrote:
> 'pointer' or 'value'?
> 
> I'm curious for what purpose people use that size.
> Pointers are not used usually in ruby, I think.

See #8553
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-40131

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:55648] Re: [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (3 preceding siblings ...)
  2013-06-25 10:48 ` [ruby-core:55647] " naruse (Yui NARUSE)
@ 2013-06-25 11:16 ` Tanaka Akira
  2013-07-03  7:56 ` [ruby-core:55773] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Tanaka Akira @ 2013-06-25 11:16 UTC (permalink / raw
  To: ruby-core

2013/6/25 headius (Charles Nutter) <headius@headius.com>:
> Issue #8568 has been reported by headius (Charles Nutter).

> I propose two additions to Ruby:
>
> 1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).
>
> 2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?

Although "word" is ambiguous, providing sizeof(long), sizeof(char*),
etc. via RbConfig
with clear names seems good feature:
RbConfig["sizeof(long)"], RbConfig["sieof(char*)"],
RbConfig["sizeof(time_t)"], ...
-- 
Tanaka Akira

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

* [ruby-core:55773] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (4 preceding siblings ...)
  2013-06-25 11:16 ` [ruby-core:55648] Re: [CommonRuby - Feature #8568][Open] " Tanaka Akira
@ 2013-07-03  7:56 ` nobu (Nobuyoshi Nakada)
  2013-07-03  9:46   ` [ruby-core:55775] " Tanaka Akira
  2013-07-03  8:03 ` [ruby-core:55774] " nobu (Nobuyoshi Nakada)
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 18+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-07-03  7:56 UTC (permalink / raw
  To: ruby-core


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

File sizeof.diff added

akr (Akira Tanaka) wrote:
>  Although "word" is ambiguous, providing sizeof(long), sizeof(char*),
>  etc. via RbConfig
>  with clear names seems good feature:
>  RbConfig["sizeof(long)"], RbConfig["sieof(char*)"],
>  RbConfig["sizeof(time_t)"], ...

RbConfig is a module, so `RbConfig.[]` doesn't seem good.
What about `RbConfig::SIZEOF` instead?
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-40268

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:55774] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (5 preceding siblings ...)
  2013-07-03  7:56 ` [ruby-core:55773] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
@ 2013-07-03  8:03 ` nobu (Nobuyoshi Nakada)
  2013-09-27 10:45 ` [ruby-core:57425] " headius (Charles Nutter)
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-07-03  8:03 UTC (permalink / raw
  To: ruby-core


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


naruse (Yui NARUSE) wrote:
> > I'm curious for what purpose people use that size.
> > Pointers are not used usually in ruby, I think.
> 
> See #8553

I can't see any needs in ruby level there.
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-40269

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:55775] Re: [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-07-03  7:56 ` [ruby-core:55773] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
@ 2013-07-03  9:46   ` Tanaka Akira
  0 siblings, 0 replies; 18+ messages in thread
From: Tanaka Akira @ 2013-07-03  9:46 UTC (permalink / raw
  To: ruby-core

2013/7/3 nobu (Nobuyoshi Nakada) <nobu@ruby-lang.org>:

> RbConfig is a module, so `RbConfig.[]` doesn't seem good.
> What about `RbConfig::SIZEOF` instead?

No problem.

They would be useful for ioctl and socket option.
-- 
Tanaka Akira

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

* [ruby-core:57425] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (6 preceding siblings ...)
  2013-07-03  8:03 ` [ruby-core:55774] " nobu (Nobuyoshi Nakada)
@ 2013-09-27 10:45 ` headius (Charles Nutter)
  2013-10-01  0:40 ` [ruby-core:57509] " headius (Charles Nutter)
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: headius (Charles Nutter) @ 2013-09-27 10:45 UTC (permalink / raw
  To: ruby-core


Issue #8568 has been updated by headius (Charles Nutter).


In for 2.1?
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42032

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:57509] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (7 preceding siblings ...)
  2013-09-27 10:45 ` [ruby-core:57425] " headius (Charles Nutter)
@ 2013-10-01  0:40 ` headius (Charles Nutter)
  2013-10-01  0:59 ` [ruby-core:57513] [CommonRuby - Feature #8568][Closed] " nobu (Nobuyoshi Nakada)
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: headius (Charles Nutter) @ 2013-10-01  0:40 UTC (permalink / raw
  To: ruby-core


Issue #8568 has been updated by headius (Charles Nutter).

Target version set to Ruby 2.1.0


----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42123

Author: headius (Charles Nutter)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 2.1.0


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:57513] [CommonRuby - Feature #8568][Closed] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (8 preceding siblings ...)
  2013-10-01  0:40 ` [ruby-core:57509] " headius (Charles Nutter)
@ 2013-10-01  0:59 ` nobu (Nobuyoshi Nakada)
  2013-10-01 18:16 ` [ruby-core:57557] [CommonRuby - Feature #8568] " headius (Charles Nutter)
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-10-01  0:59 UTC (permalink / raw
  To: ruby-core


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

Status changed from Open to Closed

r42685
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42128

Author: headius (Charles Nutter)
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 2.1.0


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:57557] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (9 preceding siblings ...)
  2013-10-01  0:59 ` [ruby-core:57513] [CommonRuby - Feature #8568][Closed] " nobu (Nobuyoshi Nakada)
@ 2013-10-01 18:16 ` headius (Charles Nutter)
  2013-10-02  0:52 ` [ruby-core:57571] " nobu (Nobuyoshi Nakada)
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: headius (Charles Nutter) @ 2013-10-01 18:16 UTC (permalink / raw
  To: ruby-core


Issue #8568 has been updated by headius (Charles Nutter).


nobu (Nobuyoshi Nakada) wrote:
> r42685

Thanks! I do have one question, though.. are the names of the types (acquired via #type in sizes.c) guaranteed to be consistent across platforms/compilers?
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42174

Author: headius (Charles Nutter)
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 2.1.0


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:57571] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (10 preceding siblings ...)
  2013-10-01 18:16 ` [ruby-core:57557] [CommonRuby - Feature #8568] " headius (Charles Nutter)
@ 2013-10-02  0:52 ` nobu (Nobuyoshi Nakada)
  2013-10-02  5:32 ` [ruby-core:57588] " headius (Charles Nutter)
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-10-02  0:52 UTC (permalink / raw
  To: ruby-core


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


They are extracted from configure.in script automatically.
And ANSI/ISO C standard requires stringize operator to turn the argument into a string literal *before* expanding it.
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42187

Author: headius (Charles Nutter)
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 2.1.0


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:57588] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (11 preceding siblings ...)
  2013-10-02  0:52 ` [ruby-core:57571] " nobu (Nobuyoshi Nakada)
@ 2013-10-02  5:32 ` headius (Charles Nutter)
  2013-10-02 17:05 ` [ruby-core:57607] " nobu (Nobuyoshi Nakada)
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: headius (Charles Nutter) @ 2013-10-02  5:32 UTC (permalink / raw
  To: ruby-core


Issue #8568 has been updated by headius (Charles Nutter).


nobu (Nobuyoshi Nakada) wrote:
> =begin
> They are extracted from ((%configure.in%)) script automatically.
> And ANSI/ISO C standard requires stringize operator to turn the argument into a string literal ((*before*)) expanding it.
> =end

I interpret this to mean that the names of the types should be ANSI/ISO C standard names. If that's the case, I'm satisfied.

My concern is if the type names vary across platforms; they would be *much* less useful if one platform reports "void*" and another platform reports "void *".
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42202

Author: headius (Charles Nutter)
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 2.1.0


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:57607] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (12 preceding siblings ...)
  2013-10-02  5:32 ` [ruby-core:57588] " headius (Charles Nutter)
@ 2013-10-02 17:05 ` nobu (Nobuyoshi Nakada)
  2013-10-02 18:38 ` [ruby-core:57615] " headius (Charles Nutter)
  2013-10-02 18:54 ` [ruby-core:57616] " nobu (Nobuyoshi Nakada)
  15 siblings, 0 replies; 18+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-10-02 17:05 UTC (permalink / raw
  To: ruby-core


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


Sorry that it's unclear.

It means that type names come from a distributed file, configure.in, so they are invariant on all platforms.
As for C standard, all names will become strings as-is, even if a type is defined by macro.
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42219

Author: headius (Charles Nutter)
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 2.1.0


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:57615] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (13 preceding siblings ...)
  2013-10-02 17:05 ` [ruby-core:57607] " nobu (Nobuyoshi Nakada)
@ 2013-10-02 18:38 ` headius (Charles Nutter)
  2013-10-02 18:54 ` [ruby-core:57616] " nobu (Nobuyoshi Nakada)
  15 siblings, 0 replies; 18+ messages in thread
From: headius (Charles Nutter) @ 2013-10-02 18:38 UTC (permalink / raw
  To: ruby-core


Issue #8568 has been updated by headius (Charles Nutter).


Ok...so hopefully we have tests for those names and we can consider them "spec".

BTW, I'm asking because we'll want to provide the same SIZEOF hash in JRuby, and I need to know the names will be consistent and not change in the future.

Thanks!
----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42228

Author: headius (Charles Nutter)
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 2.1.0


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

* [ruby-core:57616] [CommonRuby - Feature #8568] Introduce RbConfig value for native word size, to avoid Fixnum#size use
  2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
                   ` (14 preceding siblings ...)
  2013-10-02 18:38 ` [ruby-core:57615] " headius (Charles Nutter)
@ 2013-10-02 18:54 ` nobu (Nobuyoshi Nakada)
  15 siblings, 0 replies; 18+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-10-02 18:54 UTC (permalink / raw
  To: ruby-core


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


Almost of those names are defined by C standard or POSIX, so they won't change.
I think what names are included is *not* a spec, however.
New names may be added or existing names may be deleted, without any notice.

I think all I can guarantee is, in a same CRuby revision, same names are defined on all platforms where they are supported.

----------------------------------------
Feature #8568: Introduce RbConfig value for native word size, to avoid Fixnum#size use
https://bugs.ruby-lang.org/issues/8568#change-42229

Author: headius (Charles Nutter)
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 2.1.0


Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


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

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

end of thread, other threads:[~2013-10-02 19:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-24 21:14 [ruby-core:55638] [CommonRuby - Feature #8568][Open] Introduce RbConfig value for native word size, to avoid Fixnum#size use headius (Charles Nutter)
2013-06-25  2:01 ` [ruby-core:55641] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
2013-06-25  3:50 ` [ruby-core:55642] " headius (Charles Nutter)
2013-06-25  5:05 ` [ruby-core:55643] " nobu (Nobuyoshi Nakada)
2013-06-25 10:48 ` [ruby-core:55647] " naruse (Yui NARUSE)
2013-06-25 11:16 ` [ruby-core:55648] Re: [CommonRuby - Feature #8568][Open] " Tanaka Akira
2013-07-03  7:56 ` [ruby-core:55773] [CommonRuby - Feature #8568] " nobu (Nobuyoshi Nakada)
2013-07-03  9:46   ` [ruby-core:55775] " Tanaka Akira
2013-07-03  8:03 ` [ruby-core:55774] " nobu (Nobuyoshi Nakada)
2013-09-27 10:45 ` [ruby-core:57425] " headius (Charles Nutter)
2013-10-01  0:40 ` [ruby-core:57509] " headius (Charles Nutter)
2013-10-01  0:59 ` [ruby-core:57513] [CommonRuby - Feature #8568][Closed] " nobu (Nobuyoshi Nakada)
2013-10-01 18:16 ` [ruby-core:57557] [CommonRuby - Feature #8568] " headius (Charles Nutter)
2013-10-02  0:52 ` [ruby-core:57571] " nobu (Nobuyoshi Nakada)
2013-10-02  5:32 ` [ruby-core:57588] " headius (Charles Nutter)
2013-10-02 17:05 ` [ruby-core:57607] " nobu (Nobuyoshi Nakada)
2013-10-02 18:38 ` [ruby-core:57615] " headius (Charles Nutter)
2013-10-02 18:54 ` [ruby-core:57616] " nobu (Nobuyoshi Nakada)

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).