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

87e41d0d468ad56a3b07d9a6482fd6d5?d=identicon&s=25 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
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 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.
F3b7b8756d0c7f71cc7460cc33aefaee?d=identicon&s=25 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.
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 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"?
767d5e3739da3f56b785c591b409a95f?d=identicon&s=25 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
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 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.
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 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.
This topic is locked and can not be replied to.