110 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 83f2654bac Do not use MRB_METHOD_TABLE_INLINE by default; fix #3924
It was default on Linux. Abandoned for 2 reasons:

* some cross-platform compiler defines `__linux__` even on bare metal
  environment (RTL8196 (MIPS big endian soc) for example).

* some compilers do not align functions pointers so that we need to
  specify `-falign-functions=n` (where n>1). It's not suitable for
  default configuration.

By our measurement, `mrbtest` consumes 400KB less memory. So if your
target machine is memory tight, add the following command-line options
to `GCC` (unfortunately `clang` does not support `-falign-functions`).

`-falign-functions=2 -DMRB_METHOD_TABLE_INLINE`
2018-01-25 14:22:01 +09:00
Yukihiro "Matz" Matsumoto 8f2c62407c Add MRB_METHOD_TABLE_INLINE option.
Now the method tables (in classes/modules and caches) keeps C function
pointers without wrapping in `struct RProc` objects. For the sake of
portability, `mrb_method_t` is represented by the struct and union, but
if the most significant bit of the pointer is not used by the platform,
`mrb_method_t` should be packed in `uintptr_t` to reduce memory usage.

`MRB_METHOD_TABLE_INLINE` is turned on by default for linux.
2017-11-20 18:33:41 +09:00
Yukihiro "Matz" Matsumoto 6c06e77446 Add MRB_METHOD_CACHE description to include/mrbconf.h 2017-11-20 06:04:27 +09:00
YAMAMOTO Masaya 81ea81e05c Fix typo 2017-10-11 19:52:21 +09:00
YAMAMOTO Masaya acdc2d1f24 Add MRB_WITHOUT_FLOAT 2017-10-11 17:58:11 +09:00
Yukihiro "Matz" Matsumoto f0f4a1088a Make the default integer size to be MRB_INT64 on 64bit systems; close #3800
Unless `MRB_NAN_BOXING` is specified.
2017-09-01 06:51:59 +09:00
Christopher Aue 2fadddcd20 Replaced tabs with spaces 2017-08-09 21:56:27 +02:00
Yukihiro "Matz" Matsumoto 1e41026b28 Always use MRB_USE_IV_SEGLIST. 2017-07-27 16:14:03 +09:00
Kazuho Oku b491f4b06a set MRB_64BIT if the sizeof(size_t) is 8 2016-12-07 15:31:32 +09:00
Tomasz Dąbrowski d86f5d2dca mruby architecture detection 2016-11-21 12:37:45 +01:00
cremno ad21e5e6d8 fix MRB_DISABLE_STDIO typos 2015-11-17 00:08:41 +01:00
Yukihiro "Matz" Matsumoto 4440566b95 DISABLE_STDIO/ENABLE_DEBUG macros to rename; close #3014
changes:
 * rename DISABLE_STDIO -> MRB_DISABLE_STDIO
 * rename ENABLE_DEBUG -> MRB_ENABLE_DEBUG_HOOK
 * no more opposite macro definitions (e.g. ENABLE_STDIO, DISABLE_DEBUG).
 * rewrite above macro references throughout the code.
 * update documents
2015-11-17 07:30:34 +09:00
Yukihiro "Matz" Matsumoto 798ec3aff4 UTF-8 string support in core
define MRB_UTF8_STRING (in mrbconf.h) to enable UTF-8 support.
2015-09-24 02:37:33 +09:00
Seba Gamboa c127614638 Setting up doxygen groups 2015-09-20 21:14:07 -03:00
Yukihiro "Matz" Matsumoto 6b956f1c1b use __init_array_start to determine readonly data section;
b72e94f used _etext and _edata to distinguish C string literals from heap allocated strings,
but using _edata, global char arrays may be considered as string literals.  to avoid the issue,
we have to use __init_array_start, which might be less portable.  you can still use _edata, by
using MRB_NO_INIT_ARRAY_START.
2014-10-02 09:27:39 +09:00
Yukihiro "Matz" Matsumoto b72e94fa6b mrbconf.h option MRB_USE_ETEXT_EDATA to reduce memory.
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-30 23:48:57 +09:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
take_cheeze 62f41ddd3b Add fixed state atexit stack feature.
Adds following macros:
* MRB_FIXED_STATE_ATEXIT_STACK (not defined by default)
  * When defined enables fixed state atexit stack.
* MRB_FIXED_STATE_ATEXIT_STACK_SIZE (default value: 5)
  * This macro will be ignored when `MRB_FIXED_STATE_ATEXIT_STACK` isn't defined.
  * When `mrb_state_atexit` is called more than this value it will raise runtime error.
2014-06-16 16:03:35 +09:00
yui-knk 087bab2335 Remove space. 2014-05-18 13:32:34 +09:00
Yukihiro "Matz" Matsumoto 7074a55913 revert changes to mrbconf.h 2014-03-01 10:53:38 +09:00
cubicdaiya 67de10bfcb use C style comments instead of C++ style comments
According to CONTRIBUTING.md,

Don't use C++ style comments

 /* This is the prefered comment style */

Use C++ style comments only for temporary comment e.g. commenting out some code lines.
2014-03-01 03:31:45 +09:00
Yukihiro "Matz" Matsumoto 9fab01caee remove MRB_IREP_ARRAY_INIT_SIZE which is no longer used 2013-12-24 07:26:35 +09:00
Yukihiro "Matz" Matsumoto ed0d9f0066 remove MRB_PARSER_BUF_SIZE configuration; close #1596 2013-11-25 09:48:31 +09:00
Yukihiro "Matz" Matsumoto 07b8a5b042 Make mrb->arena variable sized. Use MRB_GC_FIXED_ARENA for old behavior.
You will not see "arena overflow" error anymore, but I encourage gem authors
to check your gems with MRB_GC_FIXED_ARENA to avoid memory broat.
2013-11-22 09:20:06 +09:00
Yukihiro "Matz" Matsumoto 1e87bf6d2f allow turning off GC generational mode by default by MRB_GC_TURN_OFF_GENERATIONAL; #1447 2013-08-08 21:42:20 +09:00
Yukihiro "Matz" Matsumoto 4e877bc92f restructure header files; move non config lines away from mrbconf.h 2013-06-10 14:40:32 +09:00
kimu_shu e720782f81 Add MRB_WORD_BOXING mode (represent mrb_value as a word) 2013-05-26 10:09:17 +09:00
Ryan Scott 37e3643f8f Potential fix for 'inline' macro redefinition error - VS2012 C++ 2013-05-11 23:32:49 +10:00
Yukihiro "Matz" Matsumoto 8890a992a6 always use unsigned int as mrb_bool even in C++ 2013-04-29 09:23:43 +09:00
Yukihiro "Matz" Matsumoto ecd87aa545 quote error message in mrbconf.h to stop warning 2013-04-26 18:49:12 +09:00
Masaki Muranaka d4476109c4 Add a descrption of MRB_INT16. 2013-04-26 11:44:53 +09:00
Masaki Muranaka cbcd39bae4 Avoid defining MRB_INT16 adn MRB_INT64 at the same time. This is a poka-yoke. 2013-04-26 11:41:34 +09:00
Masaki Muranaka 59c8d6c13a Remove str_to_mrb_int(). There is some reasons.
It is not used in the core.
 It does not have mrb_ prefix.
 strtol() is slightly heavy and we have similar API.
2013-03-29 16:31:11 +09:00
Masaki Muranaka 2f8dc97e2d Move TRUE/FALSE existence checks. 2013-03-29 10:41:28 +09:00
Masaki Muranaka 6eda7c28e9 Include stddef.h. It is required by size_t. In case you include stdio.h, stddef.h is included indirectly. 2013-03-24 13:42:25 +09:00
Yukihiro Matz Matsumoto e69a13a20e resolve conflict 2013-03-24 00:44:28 +09:00
Masaki Muranaka 4656073b60 Add configuration macro MRB_PARSER_BUF_SIZE. 2013-03-22 16:46:56 +09:00
Yukihiro Matz Matsumoto 13cd0363f0 applying C++ patch from @monaka to support C++ bool type; close #1019 2013-03-18 07:57:07 +09:00
Yukihiro Matz Matsumoto 228687cfff experimental MRB_INT16 added 2013-03-14 23:12:00 +09:00
Masaki Muranaka 1ffc9ba325 Define type mrb_bool. It is typedef-ed to _Bool on C99, unsigned int on MSVC.
It is safer than applying 1bit bit-fields to signed int.

For forward compatibility, you should substiture only 1 or 0 for the variable typed mrb_bool.
2013-03-14 15:13:12 +09:00
Masaki Muranaka e2d31ba3f3 Rename STR_BUF_MIN_SIZE to MRB_STR_BUF_MIN_SIZE. Make it configurable. 2013-03-12 17:10:18 +09:00
Cremno f719b0e7ff define and use print format macros for mrb_int
For portability: %ld can't be used to print a 64-bit mrb_int on
WIN(32|64) because long is 32-bit wide.
2013-03-08 18:20:54 +01:00
Masaki Muranaka 5a025813b5 Include stdio.h in mrbconf.h instead of C extension sources. 2013-03-05 01:38:51 +09:00
Masaki Muranaka 97136825e2 Separate Kernel#sprintf support from mruby core. It's moved to mrbgems. 2013-03-04 23:04:39 +09:00
Yukihiro "Matz" Matsumoto e13248bedf Merge pull request #884 from monaka/pr-use-MRB_IREP_ARRY_INIT_SIZE-macro
Use MRB_IREP_ARRAY_INIT_SIZE macro.
2013-03-03 16:40:27 -08:00
Masaki Muranaka 6cd7017ec1 Remove trailing whitespaces. This is just a cosmetic change. 2013-03-03 10:54:00 +09:00
mattn 138ecf4723 Pluggable Struct 2013-03-01 13:37:46 +09:00
mattn 6bee2fd193 Pluggable Math 2013-02-28 17:52:18 +09:00
mattn f2d62c7c9f Fix build 2013-02-26 17:22:24 +09:00
Masaki Muranaka 6dda588503 Use MRB_IREP_ARRAY_INIT_SIZE macro. It should be configurable since it is possible to reduce RAM size. 2013-02-25 13:59:20 +09:00