summaryrefslogtreecommitdiff
path: root/shape.h
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2023-03-17 11:39:35 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2023-03-22 08:46:12 -0700
commit1a9e2d20e2c66933f8eb891a1ee85fae6015fcf1 (patch)
tree281d6536edd16ee9ece6971462f27fcf70151550 /shape.h
parente340eb2106544dffe909104df1ff61236f70f280 (diff)
downloadruby-1a9e2d20e2c66933f8eb891a1ee85fae6015fcf1.tar.gz
Fix shape allocation limits
We can only allocate enough shapes to fit in the shape buffer. MAX_SHAPE_ID was based on the theoretical maximum number of shapes we could have, not on the amount of memory we can actually consume. This commit changes the MAX_SHAPE_ID to be based on the amount of memory we're allowed to consume. Co-Authored-By: Jemma Issroff <jemmaissroff@gmail.com>
Diffstat (limited to 'shape.h')
-rw-r--r--shape.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/shape.h b/shape.h
index b635ddf8b7..5366631f8d 100644
--- a/shape.h
+++ b/shape.h
@@ -28,12 +28,12 @@ typedef uint16_t shape_id_t;
# define SHAPE_FLAG_SHIFT ((SIZEOF_VALUE * 8) - SHAPE_ID_NUM_BITS)
-# define SHAPE_BITMAP_SIZE 16384
+# define SHAPE_BUFFER_SIZE 0x80000
# define SHAPE_MAX_VARIATIONS 8
# define SHAPE_MAX_NUM_IVS 80
-# define MAX_SHAPE_ID (SHAPE_MASK - 1)
+# define MAX_SHAPE_ID SHAPE_BUFFER_SIZE
# define INVALID_SHAPE_ID SHAPE_MASK
# define ROOT_SHAPE_ID 0x0