From: Eric Wong <normalperson@yhbt.net>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:60682] volatile usages
Date: Thu, 13 Feb 2014 10:04:36 +0000 [thread overview]
Message-ID: <20140213100436.GA14947@dcvr.yhbt.net> (raw)
Hi all, I went ahead and removed some use of volatile which were once
needed, but no longer. (r44929. r44930)
I'm not sure about the reason for the volatile VALUE v in re.c:
rb_reg_s_union, so I'm leaving it alone.
Also, in string.c, I'm not sure if the volatile declaration is enough,
using RB_GC_GUARD below seems more correct (and generates smaller code
on x86-32, at least):
--- a/string.c
+++ b/string.c
@@ -1401,10 +1401,12 @@ rb_str_times(VALUE str, VALUE times)
static VALUE
rb_str_format_m(VALUE str, VALUE arg)
{
- volatile VALUE tmp = rb_check_array_type(arg);
+ VALUE tmp = rb_check_array_type(arg);
if (!NIL_P(tmp)) {
- return rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
+ VALUE rv = rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
+ RB_GC_GUARD(tmp);
+ return rv;
}
return rb_str_format(1, &arg, str);
}
next reply other threads:[~2014-02-13 10:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-13 10:04 Eric Wong [this message]
2014-02-14 2:40 ` [ruby-core:60688] Re: volatile usages Nobuyoshi Nakada
2014-02-14 10:55 ` [ruby-core:60741] " Eric Wong
2014-02-15 1:53 ` [ruby-core:60751] " Eric Wong
2014-02-16 4:48 ` [ruby-core:60780] " Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140213100436.GA14947@dcvr.yhbt.net \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).