summaryrefslogtreecommitdiff
path: root/yjit/src/cruby.rs
diff options
context:
space:
mode:
Diffstat (limited to 'yjit/src/cruby.rs')
-rw-r--r--yjit/src/cruby.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/yjit/src/cruby.rs b/yjit/src/cruby.rs
index 229cfa109e..c2f5790620 100644
--- a/yjit/src/cruby.rs
+++ b/yjit/src/cruby.rs
@@ -394,10 +394,28 @@ impl VALUE {
unsafe { CLASS_OF(self) }
}
- pub fn shape_of(self) -> u32 {
+ pub fn shape_id_of(self) -> u32 {
unsafe { rb_shape_get_shape_id(self) }
}
+ pub fn shape_of(self) -> *mut rb_shape {
+ unsafe {
+ let shape = rb_shape_get_shape_by_id(self.shape_id_of());
+
+ if shape.is_null() {
+ panic!("Shape should not be null");
+ } else {
+ shape
+ }
+ }
+ }
+
+ pub fn embedded_p(self) -> bool {
+ unsafe {
+ FL_TEST_RAW(self, VALUE(ROBJECT_EMBED as usize)) != VALUE(0)
+ }
+ }
+
pub fn as_isize(self) -> isize {
let VALUE(is) = self;
is as isize