diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-06-09 14:39:38 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 16:21:08 +0900 |
| commit | d428fa0c4acfe4f70ab534d420052c193bd83281 (patch) | |
| tree | 903e5ab41d1c358e3b512be90d36837e54580e29 /src/string.c | |
| parent | daa37be5495393ce3e4654e00e44099f627e6cd4 (diff) | |
| download | mruby-d428fa0c4acfe4f70ab534d420052c193bd83281.tar.gz mruby-d428fa0c4acfe4f70ab534d420052c193bd83281.zip | |
Replace entire `irep->pool`.
Changes:
- `pool format is completely replaced
- supported types: `STR`, `INT32`, `INT64`, `FLOAT`
- `FLOAT` may be replaced by binary representation in the future
- insert `NUL` after string literals in `mrb` files
- `irep->pool` no longer store values in `mrb_value`
- instead it stores in `mrb_pool_value`
- less allocation
- `mrb_irep` can be stored in ROM
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/string.c b/src/string.c index 97795221c..73e514f41 100644 --- a/src/string.c +++ b/src/string.c @@ -583,9 +583,6 @@ str_share(mrb_state *mrb, struct RString *orig, struct RString *s) else if (RSTR_FSHARED_P(orig)) { str_init_fshared(orig, s, orig->as.heap.aux.fshared); } - else if (mrb_frozen_p(orig) && !RSTR_POOL_P(orig)) { - str_init_fshared(orig, s, orig); - } else { if (orig->as.heap.aux.capa > orig->as.heap.len) { orig->as.heap.ptr = (char *)mrb_realloc(mrb, orig->as.heap.ptr, len+1); @@ -597,29 +594,6 @@ str_share(mrb_state *mrb, struct RString *orig, struct RString *s) } mrb_value -mrb_str_pool(mrb_state *mrb, const char *p, mrb_int len, mrb_bool nofree) -{ - struct RString *s = (struct RString *)mrb_malloc(mrb, sizeof(struct RString)); - - s->tt = MRB_TT_STRING; - s->c = mrb->string_class; - s->flags = 0; - - if (RSTR_EMBEDDABLE_P(len)) { - str_init_embed(s, p, len); - } - else if (nofree) { - str_init_nofree(s, p, len); - } - else { - str_init_normal(mrb, s, p, len); - } - RSTR_SET_POOL_FLAG(s); - MRB_SET_FROZEN_FLAG(s); - return mrb_obj_value(s); -} - -mrb_value mrb_str_byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len) { struct RString *orig, *s; |
