From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] variable.c: remove generic ivar support for special constants
Date: Tue, 2 Jun 2015 03:05:40 +0000 [thread overview]
Message-ID: <1433214340-21577-1-git-send-email-e@80x24.org> (raw)
Special constants are all frozen since [Feature #8923] and cannot
support ivars. Remove some unused code we had for supporting them.
---
gc.c | 4 ----
internal.h | 1 -
variable.c | 22 ++--------------------
3 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/gc.c b/gc.c
index eb0a073..5ce7a8f 100644
--- a/gc.c
+++ b/gc.c
@@ -4596,10 +4596,6 @@ gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
MARK_CHECKPOINT("global_tbl");
rb_gc_mark_global_tbl();
- /* mark generic instance variables for special constants */
- MARK_CHECKPOINT("generic_ivars");
- rb_mark_generic_ivar_tbl();
-
MARK_CHECKPOINT("live_method_entries");
rb_gc_mark_unlinked_live_method_entries(th->vm);
diff --git a/internal.h b/internal.h
index 64896e0..9a6940b 100644
--- a/internal.h
+++ b/internal.h
@@ -1281,7 +1281,6 @@ extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, si
/* variable.c (export) */
void rb_gc_mark_global_tbl(void);
void rb_mark_generic_ivar(VALUE);
-void rb_mark_generic_ivar_tbl(void);
VALUE rb_const_missing(VALUE klass, VALUE name);
int rb_st_insert_id_and_value(VALUE obj, st_table *tbl, ID key, VALUE value);
diff --git a/variable.c b/variable.c
index a5f6579..827ceb7 100644
--- a/variable.c
+++ b/variable.c
@@ -25,7 +25,6 @@ static void setup_const_entry(rb_const_entry_t *, VALUE, VALUE, rb_const_flag_t)
static int const_update(st_data_t *, st_data_t *, st_data_t, int);
static st_table *generic_iv_tbl;
static st_table *generic_iv_tbl_compat;
-static int special_generic_ivar;
/* per-object */
struct gen_ivtbl {
@@ -1182,23 +1181,6 @@ rb_mark_generic_ivar(VALUE obj)
}
}
-static int
-givar_i(st_data_t k, st_data_t v, st_data_t a)
-{
- VALUE obj = (VALUE)k;
- if (rb_special_const_p(obj)) {
- gen_ivtbl_mark((const struct gen_ivtbl *)v);
- }
- return ST_CONTINUE;
-}
-
-void
-rb_mark_generic_ivar_tbl(void)
-{
- if (special_generic_ivar == 0) return;
- st_foreach_safe(generic_iv_tbl, givar_i, 0);
-}
-
void
rb_free_generic_ivar(VALUE obj)
{
@@ -1371,7 +1353,7 @@ generic_ivar_set(VALUE obj, ID id, VALUE val)
if (rb_special_const_p(obj)) {
if (rb_obj_frozen_p(obj)) rb_error_frozen("object");
- special_generic_ivar = 1;
+ rb_bug("non-frozen special constant");
}
ivup.extended = 0;
@@ -1579,7 +1561,7 @@ rb_copy_generic_ivar(VALUE clone, VALUE obj)
if (rb_special_const_p(clone)) {
if (rb_obj_frozen_p(clone)) rb_error_frozen("object");
- special_generic_ivar = 1;
+ rb_bug("non-frozen special constant");
}
if (!FL_TEST(obj, FL_EXIVAR)) {
--
EW
next reply other threads:[~2015-06-02 3:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 3:05 Eric Wong [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-06-02 3:04 [PATCH] variable.c: remove generic ivar support for special constants 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-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1433214340-21577-1-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.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).