Forum: Ruby-core Changes in C API of Ruby 1.9

Posted by Hemant Kumar (gnufied)
on 2007-12-07 14:35
(Received via mailing list)
Hi,

Trying to port couple of my extensions to Ruby1.9 and hitting on some
issues, because of API changes from Ruby1.8.


RSTRING(Data)-> len    ---> has been changed to  -- >
RSTRING(Data)->as.heap.len ( there is a better alternative apparently
)
CHECK_INTS              ----> No equivalent so far

Do we have a consolidated list? What can be done to improve this?






--
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org
Posted by Yukihiro Matsumoto (Guest)
on 2007-12-07 15:02
(Received via mailing list)
Hi,

In message "Re: Changes in C API of Ruby 1.9"
    on Fri, 7 Dec 2007 22:30:41 +0900, hemant <gethemant@gmail.com> 
writes:

|Trying to port couple of my extensions to Ruby1.9 and hitting on some
|issues, because of API changes from Ruby1.8.

|RSTRING(Data)-> len    ---> has been changed to  -- >
|RSTRING(Data)->as.heap.len ( there is a better alternative apparently)

use RSTRING_LEN() which is defined both in 1.8 and 1.9.

|CHECK_INTS              ----> No equivalent so far

Hmm, should we provide empty CHECK_INTS for 1.9?

              matz.
Posted by Berger, Daniel (Guest)
on 2007-12-07 16:09
(Received via mailing list)
> -----Original Message-----
> 
> RSTRING(Data)-> len    ---> has been changed to  -- >
> RSTRING(Data)->as.heap.len ( there is a better alternative apparently
> )

Ack. Please give me .length as a shortcut for as.heap.len.

Regards,

Dan


This communication is the property of Qwest and may contain confidential 
or
privileged information. Unauthorized use of this communication is 
strictly
prohibited and may be unlawful.  If you have received this communication
in error, please immediately notify the sender by reply e-mail and 
destroy
all copies of the communication and any attachments.
Posted by Nobuyoshi Nakada (nobu)
on 2007-12-09 04:42
(Received via mailing list)
Hi,

At Sat, 8 Dec 2007 00:07:53 +0900,
Berger, Daniel wrote in [ruby-core:13920]:
> Ack. Please give me .length as a shortcut for as.heap.len.

To define length as as.heap.len?  You never use variables named
as "length"?
Posted by Gonzalo Garramuño (Guest)
on 2007-12-09 06:04
(Received via mailing list)
Nobuyoshi Nakada wrote:
> Hi,
> 
> At Sat, 8 Dec 2007 00:07:53 +0900,
> Berger, Daniel wrote in [ruby-core:13920]:
>> Ack. Please give me .length as a shortcut for as.heap.len.
> 
> To define length as as.heap.len?  
> 

I'll admit I have not looked at the 1.9 source in some time.

While "as" is an union that seems to do some padding for better
alignment, I am wondering what's the benefit of the heap struct?  Why is
there the need to dereference a pointer for getting to the len or the
array now?  Isn't that much slower?
Also there's some flags that seem to indicate that strings can be stored
in two different ways now.  RSTRUCTs seem to be the same way.

Can you shed some light, Nobu?



--
Gonzalo 
Garramuñoggarra@advancedsl.com.ar

AMD4400 - ASUS48N-E
GeForce7300GT
Xubuntu Gutsy
Posted by Nobuyoshi Nakada (nobu)
on 2007-12-09 08:27
(Received via mailing list)
Hi,

At Sun, 9 Dec 2007 14:04:09 +0900,
Gonzalo Garramuño wrote in [ruby-core:13952]:
> While "as" is an union that seems to do some padding for better
> alignment, I am wondering what's the benefit of the heap struct?  Why is
> there the need to dereference a pointer for getting to the len or the
> array now?  Isn't that much slower?
> Also there's some flags that seem to indicate that strings can be stored
> in two different ways now.  RSTRUCTs seem to be the same way.

It's not related to alignment, but for embedding the contents in 
RSTRING.
Same for RSTRUCT.
Posted by Yukihiro Matsumoto (Guest)
on 2007-12-09 08:29
(Received via mailing list)
Hi,

In message "Re: [Spam] Re: Changes in C API of Ruby 1.9"
    on Sun, 9 Dec 2007 14:04:09 +0900, Gonzalo 
Garramuño <ggarra@advancedsl.com.ar> writes:

|While "as" is an union that seems to do some padding for better 
|alignment, I am wondering what's the benefit of the heap struct?  Why is 
|there the need to dereference a pointer for getting to the len or the 
|array now?  Isn't that much slower?
|Also there's some flags that seem to indicate that strings can be stored 
|in two different ways now.  RSTRUCTs seem to be the same way.

Instead, they consume much less memory, resulting less garbage
collection, more performance.

              matz.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.