[ruby/prism] Let an embedder set PM_ARENA_INITIAL_SIZE

The arena's first block is 8 KB, sized for a host. An embedder on a
small heap parses short programs (a REPL line uses about 6 KB in two
arenas) and pays two 8 KB blocks for each; with the constant under
#ifndef it can build with -DPM_ARENA_INITIAL_SIZE=2048 instead.

https://github.com/ruby/prism/commit/f7a062efd4
This commit is contained in:
HASUMI Hitoshi authored and git committed 2026-10-26 15:43:57 +00:00
1 parent 51f2767aa0
commit 10c945beab
1 file changed
+6 -1
+6 -1
View File
@@ -12,8 +12,13 @@
*/
#define PM_ARENA_BLOCK_SIZE(data_size) (offsetof(pm_arena_block_t, data) + (data_size))
/** Initial block data size: 8 KB. */
/**
* Initial block data size: 8 KB. An embedder on a small heap can define a
* smaller one; a parse of a short program then takes blocks of that size.
*/
#ifndef PM_ARENA_INITIAL_SIZE
#define PM_ARENA_INITIAL_SIZE 8192
#endif
/** Double the block size every this many blocks. */
#define PM_ARENA_GROWTH_INTERVAL 8