summaryrefslogtreecommitdiffhomepage
path: root/src/symbol.c
AgeCommit message (Collapse)Author
2019-04-01Avoid keeping pointers from `mrb_sym2name_len()`; fix #4342Yukihiro "Matz" Matsumoto
The addresses for packed inline symbols reference `mrb->symbuf` that could be overridden by the later call of `mrb_sym2name_len`. Since file names in call stack information are kept as symbols, keeping the address in the C structures could cause problems like #4342. This changes small incompatible changes in function prototypes: * `mrb_parser_get_filename`: return value changed to `mrb_sym`. * `mrb_debug_get_filename`: add `mrb_state*` as a first argument. * `mrb_debug_get_line`: ditto. I believe above functions are almost internal, and no third-party mrbgem use them.
2019-03-28Use `mrb_sym2str` in implementation of `Symbol#to_s`KOBAYASHI Shuji
2019-03-28Fixed mistakes in 92dce05Yukihiro "Matz" Matsumoto
* rename `sym2name` to `sym2name_len`. * `MRB_API` -> `static`
2019-03-27Fix another bug related to #4342Yukihiro "Matz" Matsumoto
For short symbols with alpha numeric characters, `mrb_sym2name_len()` returns the same buffer `mrb->symbuf`. Some occasion, we forget the fact that the second call could overwrite the result of first call of the function. We have prepared the static function `sym2name()` which specifies the buffer region for inline packed symbols and use the function in `mrb_sym_to_s`.
2019-03-27Avoid using 'mrb_str_new_static` if a symbol is packed; fix #4342Yukihiro "Matz" Matsumoto
2019-03-25Remove implementation of `Symbol#===`KOBAYASHI Shuji
For reducing program size.
2019-03-25Need to check length before packing a symbol; fix #4340Yukihiro "Matz" Matsumoto
2019-02-18Parenthesize expression to suppress warning; ref #4278Yukihiro "Matz" Matsumoto
2019-02-17Merge pull request #4279 from dearblue/fix-inline-packed-symbolsYukihiro "Matz" Matsumoto
Fix destroyed "inline packed symbols" on 32 bit mode with `MRB_WORD_BOXING`
2019-02-16Use `const int` instead of `enum`dearblue
2019-02-16Fix inline packed symbols on 32 bit mode with MRB_WORD_BOXINGdearblue
2019-02-16Add length argument for `sym_inline_unpack()`KOBAYASHI Shuji
`sym_inline_unpack_with_bit()` is moved inside of `sym_inline_unpack()` because this is used only one place.
2019-02-15Extract code fragment for unpacking into method in `sym_inline_unpack()`KOBAYASHI Shuji
2019-02-15Merge pull request #4276 from ↵Yukihiro "Matz" Matsumoto
shuujii/use-assert-for-checking-sym-in-sym_inline_unpack Use `mrb_assert()` for checking `sym` in `sym_inline_unpack()`
2019-02-14Use `mrb_assert()` for checking `sym` in `sym_inline_unpack()`KOBAYASHI Shuji
2019-02-14Add `const` to `pack_table` to `src/symbol.c`KOBAYASHI Shuji
2019-02-12Disable `Symbol.all_symbols`.Yukihiro "Matz" Matsumoto
2019-02-12Implement inline packed symbols.Yukihiro "Matz" Matsumoto
Small symbols with all alphanumeric characters (<5) are packed in 32bit symbol integer a la base64. This means those small symbols are not listed in `Symbol.all_symbols`.
2019-02-06Implement symbol hash table to boost `find_symbol`.Yukihiro "Matz" Matsumoto
In 4174e02, we removed the symbol hash table from `mrb_state` but `find_symbol` was too slow with linear search. My performance estimation was wrong. So we implemented a new compact hash table for symbols.
2019-02-06Remove symbol hash table from `mrb_state` structure.Yukihiro "Matz" Matsumoto
Use linear search instead. Number of symbols is usually small (<1K), so we don't need performance boost from hash tables. In our benchmark measurement, hash tables consumes 790KB for `build/full-debug/mrbtest`.
2019-02-05Remove old comment for `mrb_sym2name_len()` [ci skip]KOBAYASHI Shuji
2018-11-02Remove reserved symbols for now.Yukihiro "Matz" Matsumoto
It should be done by planned embedded symbols.
2018-10-29Define null symboltake-cheeze
2018-10-29Reduce instruction sizetake-cheeze
2018-09-07Fix indentdearblue
2017-10-11Use division expression instead of some floating point literalsYAMAMOTO Masaya
2016-11-30Prohibit instantiation of immediate objectsYukihiro "Matz" Matsumoto
2016-01-06symname_p support `!~`ksss
2015-11-27include changed from by quotes ("") to by brackets (<>); close #3032Yukihiro "Matz" Matsumoto
2015-10-20Increasing docs coverageSeba Gamboa
2015-05-28remove unnecessary including of <ctype.h>cremno
Not needed anymore since 85075bef7583edd0a48cfbdfaa632cbdacf78f2c
2014-10-02Pacify MSVC warnings for numeric.c, proc.c, and symbol.cHiroshi Mimaki
2014-09-30mrbconf.h option MRB_USE_ETEXT_EDATA to reduce memory.Yukihiro "Matz" Matsumoto
on platforms with _etext and _edata, mruby can distinguish string literals so that it avoids memory allocation to copy them. for example, on my Linux box (x86 32bit), memory consumed by mrbtest decreased from 8,168,203 to 8,078,848 (reduced 88KB).
2014-09-30mrb_sym2name_len() should initialize lenp even when proper symbol does not existYukihiro "Matz" Matsumoto
2014-09-30remove unnecessary trailing comma to remove pre C99 declaration error with ↵Yukihiro "Matz" Matsumoto
-Wdeclaration-after-statement
2014-09-30O(1) mrb_sym2name_len(); close #2591Yukihiro "Matz" Matsumoto
instead of adding sym->name hash table, linear symbol table is added, and reduced name->sym hash table size.
2014-09-15change mrb_sym type from uint16_t to uint32_tYukihiro "Matz" Matsumoto
2014-09-05use uint16_t instead of short; ref #2568Yukihiro "Matz" Matsumoto
2014-08-29use RITE_LV_NULL_MARK for better readabilitycremno
The comment didn't say why the length is reserved. Using RITE_LV_NULL_MARK makes things a bit clearer.
2014-08-29add sym_validate_len() to validate symbol lengthcremno
This also fixes an off-by-one in mrb_check_intern().
2014-08-27add symbol table overflow checkcremno
Since raising an error might intern a few new strings, some symbols need to be reserved. 8 should be sufficient. If the real limit has been reached, mrb_bug() is called.
2014-08-04add MRB_API modifiers to mruby API functionsYukihiro "Matz" Matsumoto
2014-07-27Refactor sym_equal() in symbol.cJun Hiroe
2014-05-19UINT16_MAX as symbol length is reserved; ref #2294Yukihiro "Matz" Matsumoto
2014-04-29Fix MSVC warning for symbol.ckyab
2014-04-25better integer size assertion suggested by usakYukihiro "Matz" Matsumoto
2014-04-25remove -Wsign-compare warningsYukihiro "Matz" Matsumoto
2014-04-15resolve conflictYukihiro "Matz" Matsumoto
2014-04-14fixed wrong use of pointer reference found by @tsahara; ref #2059Yukihiro "Matz" Matsumoto
2014-04-14reduce RSTRING_PTR usagecremno