From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS35592 89.187.128.0/19 X-Spam-Status: No, score=-1.4 required=3.0 tests=AWL,BAYES_00,RCVD_IN_XBL, URIBL_BLOCKED shortcircuit=no autolearn=no version=3.3.2 X-Original-To: spew@80x24.org Received: from 80x24.org (exit1.torproxy.org [89.187.142.208]) by dcvr.yhbt.net (Postfix) with ESMTP id 6AE61633855 for ; Tue, 28 Jul 2015 21:16:17 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] Revert "symbol.h: memoize hashval for RSymbol" Date: Tue, 28 Jul 2015 21:16:16 +0000 Message-Id: <1438118176-438-1-git-send-email-e@80x24.org> List-Id: This reverts commit r51410 (442b77e72166c9c993e3c6663568431123510dec in git) --- common.mk | 1 - hash.c | 3 +-- symbol.c | 6 ------ symbol.h | 1 - 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/common.mk b/common.mk index 1a3e463..b0a4a96 100644 --- a/common.mk +++ b/common.mk @@ -1532,7 +1532,6 @@ hash.$(OBJEXT): {$(VPATH)}oniguruma.h hash.$(OBJEXT): {$(VPATH)}probes.h hash.$(OBJEXT): {$(VPATH)}st.h hash.$(OBJEXT): {$(VPATH)}subst.h -hash.$(OBJEXT): {$(VPATH)}symbol.h hash.$(OBJEXT): {$(VPATH)}util.h hash.$(OBJEXT): {$(VPATH)}vm_opts.h inits.$(OBJEXT): $(hdrdir)/ruby/ruby.h diff --git a/hash.c b/hash.c index f46662a..2a084f7 100644 --- a/hash.c +++ b/hash.c @@ -17,7 +17,6 @@ #include #include "probes.h" #include "id.h" -#include "symbol.h" #ifdef __APPLE__ # ifdef HAVE_CRT_EXTERNS_H @@ -150,7 +149,7 @@ rb_any_hash(VALUE a) hnum = rb_str_hash(a); } else if (BUILTIN_TYPE(a) == T_SYMBOL) { - return RSYMBOL(a)->hashval; + hnum = rb_objid_hash((st_index_t)a); } else if (BUILTIN_TYPE(a) == T_FLOAT) { return rb_dbl_hash(rb_float_value(a)); diff --git a/symbol.c b/symbol.c index 9e2fccd..9fbe3dd 100644 --- a/symbol.c +++ b/symbol.c @@ -505,18 +505,12 @@ static VALUE dsymbol_alloc(const VALUE klass, const VALUE str, rb_encoding * const enc, const ID type) { const VALUE dsym = rb_newobj_of(klass, T_SYMBOL | FL_WB_PROTECTED); - st_index_t hashval; rb_enc_associate(dsym, enc); OBJ_FREEZE(dsym); RB_OBJ_WRITE(dsym, &RSYMBOL(dsym)->fstr, str); RSYMBOL(dsym)->id = type; - /* we want hashval to be in Fixnum range [ruby-core:15713] r15672 */ - hashval = rb_str_hash(str); - hashval <<= 1; - RSYMBOL(dsym)->hashval = (st_index_t)RSHIFT(hashval, 1); - register_sym(str, dsym); rb_hash_aset(global_symbols.dsymbol_fstr_hash, str, Qtrue); diff --git a/symbol.h b/symbol.h index 5c52b97..549eabd 100644 --- a/symbol.h +++ b/symbol.h @@ -25,7 +25,6 @@ struct RSymbol { struct RBasic basic; - st_index_t hashval; VALUE fstr; ID id; }; -- EW