Skip to content

Commit 1d8d84b

Browse files
committed
Increase IMEMO_MASK by one bit
We are out of imemo types because IMEMO_MASK uses 4 bits and we have 16 imemo types. This makes it not possible to experiment with new imemo types, so we can increase it by one bit to have 16 more imemo types.
1 parent 5959582 commit 1d8d84b

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

internal/imemo.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
#include "ruby/internal/stdbool.h" /* for bool */
1616
#include "ruby/ruby.h" /* for rb_block_call_func_t */
1717

18-
#define IMEMO_MASK (FL_USER0 | FL_USER1 | FL_USER2 | FL_USER3)
19-
20-
/* FL_USER0 to FL_USER3 is for type */
21-
#define IMEMO_FL_USHIFT (FL_USHIFT + 4)
22-
#define IMEMO_FL_USER0 FL_USER4
23-
#define IMEMO_FL_USER1 FL_USER5
24-
#define IMEMO_FL_USER2 FL_USER6
25-
#define IMEMO_FL_USER3 FL_USER7
26-
#define IMEMO_FL_USER4 FL_USER8
27-
#define IMEMO_FL_USER5 FL_USER9
28-
#define IMEMO_FL_USER6 FL_USER10
18+
#define IMEMO_MASK (FL_USER0 | FL_USER1 | FL_USER2 | FL_USER3 | FL_USER4)
19+
20+
/* FL_USER0 to FL_USER4 is for type */
21+
#define IMEMO_FL_USHIFT (FL_USHIFT + 5)
22+
#define IMEMO_FL_USER0 FL_USER5
23+
#define IMEMO_FL_USER1 FL_USER6
24+
#define IMEMO_FL_USER2 FL_USER7
25+
#define IMEMO_FL_USER3 FL_USER8
26+
#define IMEMO_FL_USER4 FL_USER9
27+
#define IMEMO_FL_USER5 FL_USER10
28+
#define IMEMO_FL_USER6 FL_USER11
2929

3030
enum imemo_type {
3131
imemo_env = 0,

misc/lldb_cruby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def lldb_inspect(debugger, target, result, val):
417417
append_expression(debugger, "*(struct RMatch *) %0#x" % val.GetValueAsUnsigned(), result)
418418
elif flType == RUBY_T_IMEMO:
419419
# I'm not sure how to get IMEMO_MASK out of lldb. It's not in globals()
420-
imemo_type = (flags >> RUBY_FL_USHIFT) & 0x0F # IMEMO_MASK
420+
imemo_type = (flags >> RUBY_FL_USHIFT) & 0x1F # IMEMO_MASK
421421

422422
print("T_IMEMO: ", file=result)
423423
append_expression(debugger, "(enum imemo_type) %d" % imemo_type, result)

misc/lldb_rb/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
HEAP_PAGE_ALIGN = (1 << HEAP_PAGE_ALIGN_LOG)
44
HEAP_PAGE_SIZE = HEAP_PAGE_ALIGN
55

6-
IMEMO_MASK = 0x0F
6+
IMEMO_MASK = 0x1F

tool/timeline/lib/converter_defs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def self.FL_USER_N(n)
8585
})
8686

8787
# Keep in sync with `IMEMO_MASK` in `internal/imemo.h`.
88-
IMEMO_MASK = 0x0f
88+
IMEMO_MASK = 0x1f
8989

9090
# Keep in sync with both `internal/string.h` and `include/ruby/internal/core/rstring.h`.
9191
StringFlags = FlagsConverter.new({

yjit/src/cruby.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ mod manual_defs {
754754
pub const RSTRUCT_EMBED_LEN_MASK: usize = (RUBY_FL_USER7 | RUBY_FL_USER6 | RUBY_FL_USER5 | RUBY_FL_USER4 | RUBY_FL_USER3 |RUBY_FL_USER2 | RUBY_FL_USER1) as usize;
755755

756756
// From iseq.h - via a different constant, which seems to confuse bindgen
757-
pub const ISEQ_TRANSLATED: usize = RUBY_FL_USER7 as usize;
757+
pub const ISEQ_TRANSLATED: usize = RUBY_FL_USER8 as usize;
758758

759759
// We'll need to encode a lot of Ruby struct/field offsets as constants unless we want to
760760
// redeclare all the Ruby C structs and write our own offsetof macro. For now, we use constants.

zjit/src/cruby.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ mod manual_defs {
12241224
pub const RSTRUCT_EMBED_LEN_MASK: usize = (RUBY_FL_USER7 | RUBY_FL_USER6 | RUBY_FL_USER5 | RUBY_FL_USER4 | RUBY_FL_USER3 |RUBY_FL_USER2 | RUBY_FL_USER1) as usize;
12251225

12261226
// From iseq.h - via a different constant, which seems to confuse bindgen
1227-
pub const ISEQ_TRANSLATED: usize = RUBY_FL_USER7 as usize;
1227+
pub const ISEQ_TRANSLATED: usize = RUBY_FL_USER8 as usize;
12281228

12291229
// We'll need to encode a lot of Ruby struct/field offsets as constants unless we want to
12301230
// redeclare all the Ruby C structs and write our own offsetof macro. For now, we use constants.

0 commit comments

Comments
 (0)