From: Joseph Jones Date: 2015-12-17T21:06:37-07:00 Subject: [ruby-core:72277] [Ruby trunk - Feature #9171] [patch] use fstrings for symbol table --5673864d_153ea438_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 3, 2015 at 23:21:= 47 MST, nobu=40ruby-lang.org wrote:Issue =239171 has been updated by Nobu= yoshi Nakada.Tracker changed from Bug to =46eatureDescription updated----= ------------------------------------=46eature =239171: =5Bpatch=5D use fs= trings for symbol tablehttps://bugs.ruby-lang.org/issues/9171=23change-55= 234* Author: Aman Gupta* Status: Closed* Priority: Normal* Assignee: Nobu= yoshi Nakada----------------------------------------Here is a simple patc= h to use fstrings for the table backing symbols.Unfortunately it causes a= segfault in test/rdoc/test=5Frdoc=5Fparser=5Fruby.rb. Maybe someone want= s to investigate.=7E=7E=7Ediffdiff --git a/parse.y b/parse.yindex 8207ad7= ..b1f3112 100644--- a/parse.y+++ b/parse.y=40=40 -10333,7 +10333,7 =40=40= register=5Fsymid(ID id, const char *name, long len, rb=5Fencoding *enc) = static ID register=5Fsymid=5Fstr(ID id, VALUE str) =7B- OBJ=5F=46REEZE(st= r);+ str =3D rb=5Ffstring(str); if (RUBY=5FDTRACE=5FSYMBOL=5FCREATE=5FEN= ABLED()) =7B RUBY=5FDTRACE=5FSYMBOL=5FCREATE(RSTRING=5FPTR(str), rb=5Fsou= rcefile(), rb=5Fsourceline());diff --git a/string.c b/string.cindex 231bb= 2f..6ae33e3 100644--- a/string.c+++ b/string.c=40=40 -138,6 +138,9 =40=40= rb=5Ffstring(VALUE str) st=5Fdata=5Ft fstr; Check=5FType(str, T=5FSTRING= ); + if (=21frozen=5Fstrings)+ frozen=5Fstrings =3D st=5Finit=5Ftable(&fs= tring=5Fhash=5Ftype);+ if (=46L=5FTEST(str, RSTRING=5F=46STR)) return str= ; =40=40 -8707,8 +8710,6 =40=40 Init=5FString(void) =23undef rb=5Fintern = =23define rb=5Fintern(str) rb=5Fintern=5Fconst(str) - frozen=5Fstrings =3D= st=5Finit=5Ftable(&fstring=5Fhash=5Ftype);- rb=5FcString =3D rb=5Fdefine= =5Fclass(=22String=22, rb=5FcObject); rb=5Finclude=5Fmodule(rb=5FcString,= rb=5FmComparable); rb=5Fdefine=5Falloc=5Ffunc(rb=5FcString, empty=5Fstr=5F= alloc);-- https://bugs.ruby-lang.org/ --5673864d_153ea438_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 3, 2015 at 23:21:47 MST, nobu=40ruby-lang.org wrote:
Issue =239171 has been updated= by Nobuyoshi Nakada.

Tracker changed from Bug to =46eatureDescription updated

---------------------------------------= -
=46eature =239171: =5Bpatch=5D use fstrings for symbol table
= https://bugs.ruby-lang.org/issues/9171=23change-55234

* Author= : Aman Gupta
* Status: Closed
* Priority: Normal
* Assigne= e: Nobuyoshi Nakada
----------------------------------------
He= re is a simple patch to use fstrings for the table backing symbols.
=
Unfortunately it causes a segfault in test/rdoc/test=5Frdoc=5Fparse= r=5Fruby.rb. Maybe someone wants to investigate.

=7E=7E=7Ediff=
diff --git a/parse.y b/parse.y
index 8207ad7..b1f3112 100644--- a/parse.y
+++ b/parse.y
=40=40 -10333,7 +10333,7 =40=40= register=5Fsymid(ID id, const char *name, long len, rb=5Fencoding *enc)<= br /> static ID
register=5Fsymid=5Fstr(ID id, VALUE str)
=7B<= br />- OBJ=5F=46REEZE(str);
+ str =3D rb=5Ffstring(str);
=
if (RUBY=5FDTRACE=5FSYMBOL=5FCREATE=5FENABLED()) =7B
R= UBY=5FDTRACE=5FSYMBOL=5FCREATE(RSTRING=5FPTR(str), rb=5Fsourcefile(), rb=5F= sourceline());
diff --git a/string.c b/string.c
index 231bb2f..= 6ae33e3 100644
--- a/string.c
+++ b/string.c
=40=40 -138,6= +138,9 =40=40 rb=5Ffstring(VALUE str)
st=5Fdata=5Ft fstr;
Check=5FType(str, T=5FSTRING);

+ if (=21frozen=5Fstr= ings)
+ frozen=5Fstrings =3D st=5Finit=5Ftable(&fstring=5Fhash=5Ftyp= e);
+
if (=46L=5FTEST(str, RSTRING=5F=46STR))
retur= n str;

=40=40 -8707,8 +8710,6 =40=40 Init=5FString(void)
=23undef rb=5Fintern
=23define rb=5Fintern(str) rb=5Fintern=5Fcon= st(str)

- frozen=5Fstrings =3D st=5Finit=5Ftable(&fstring=5F= hash=5Ftype);
-
rb=5FcString =3D rb=5Fdefine=5Fclass(=22S= tring=22, rb=5FcObject);
rb=5Finclude=5Fmodule(rb=5FcString, rb= =5FmComparable);
rb=5Fdefine=5Falloc=5Ffunc(rb=5FcString, empty= =5Fstr=5Falloc);




--
https://bugs.ruby-= lang.org/
--5673864d_153ea438_16c--