diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-09-26 23:07:37 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-10-01 16:24:43 +0900 |
| commit | 7edbe428caca6814841195a3f2720745cf04353e (patch) | |
| tree | ba57b813d080cce44eea564760cb7dad4cf941ca /src/gc.c | |
| parent | 473b7d0efd210290d1093201254fa32b5473d5d1 (diff) | |
| download | mruby-7edbe428caca6814841195a3f2720745cf04353e.tar.gz mruby-7edbe428caca6814841195a3f2720745cf04353e.zip | |
Add new type of shared string: `RSTR_FSHARED`.
`RSTR_FSHARED` use frozen strings as shared body instead of
`struct mrb_shared_string`. This reduces allocation from
literal strings.
Diffstat (limited to 'src/gc.c')
| -rw-r--r-- | src/gc.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -698,6 +698,10 @@ gc_mark_children(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj) break; case MRB_TT_STRING: + if (RSTR_FSHARED_P(obj) && !RSTR_NOFREE_P(obj)) { + struct RString *s = (struct RString*)obj; + mrb_gc_mark(mrb, (struct RBasic*)s->as.heap.aux.fshared); + } break; case MRB_TT_RANGE: |
