1
1
use super :: * ;
2
2
use std:: ops:: IndexMut ;
3
3
4
- //
5
- // Stack handling
6
- //
7
- // before frame preparation
8
- //
9
- // lfp cfp sp
10
- // v v <------ new local frame -----> v
11
- // +------+------+--+------+------+------+------+------+------+--------+------+------+--+------+------+------------------------
12
- // | a0 | a1 |..| an | self | flg1 | cfp2 | mfp1 | pc2 | .... | b0 | b1 |..| bn | self |
13
- // +------+------+--+------+------+------+------+------+------+--------+------+------+--+------+------+------------------------
14
- // <------- local frame --------> <-- control frame ->
15
- //
16
- //
17
- // after frame preparation
18
- //
19
- // lfp1 cfp1 lfp cfp sp
20
- // v v v v v
21
- // +------+------+--+------+------+------+------+------+------+--------+------+------+--+------+------+------+------+------+------+---
22
- // | a0 | a1 |..| an | self | flg1 | cfp2 | mfp1 | pc2 | .... | b0 | b1 |..| bn | self | flg | cfp1 | mfp | pc1 |
23
- // +------+------+--+------+------+------+------+------+------+--------+------+------+--+------+------+------+------+------+------+---
24
- // <------- local frame --------> <------- control frame -------
25
- //
26
- // after execution
27
- //
28
- // lfp cfp sp
29
- // v v v
30
- // +------+------+--+------+------+------+------+------+------+--------+-------------------------------------------------------
31
- // | a0 | a1 |..| an | self | flg1 | cfp2 | mfp1 | pc2 | .... |
32
- // +------+------+--+------+------+------+------+------+------+--------+-------------------------------------------------------
33
- //
34
-
35
4
pub const CFP_OFFSET : usize = 0 ;
36
5
pub const LFP_OFFSET : usize = 1 ;
37
6
pub const FLAG_OFFSET : usize = 2 ;
@@ -44,7 +13,7 @@ pub const BLK_OFFSET: usize = 8;
44
13
pub const NATIVE_FRAME_LEN : usize = 3 ;
45
14
pub const RUBY_FRAME_LEN : usize = 9 ;
46
15
47
- /// Control frame.
16
+ /// Control frame on the RubyStack .
48
17
#[ derive( Debug , Clone , Copy , PartialEq ) ]
49
18
pub struct Frame ( pub usize ) ;
50
19
@@ -241,6 +210,13 @@ impl ControlFrame {
241
210
}
242
211
}
243
212
213
+ ///
214
+ /// Dynamic frame
215
+ ///
216
+ /// Wrapped raw pointer which points to a control frame on the stack or heap.
217
+ /// You can obtain or alter various information like cfp, lfp, and the number of local variables
218
+ /// in the frame through `DynamicFrame`.
219
+ ///
244
220
#[ derive( Debug , Clone , Copy , PartialEq ) ]
245
221
pub struct DynamicFrame ( * mut Value ) ;
246
222
@@ -300,6 +276,12 @@ impl DynamicFrame {
300
276
}
301
277
}
302
278
279
+ ///
280
+ /// Local frame
281
+ ///
282
+ /// Wrapped raw pointer which points to a local variables area on the stack or heap.
283
+ /// You can handle local variables of the frame.
284
+ ///
303
285
#[ derive( Debug , Clone , Copy , PartialEq ) ]
304
286
pub struct LocalFrame ( pub ( super ) * mut Value ) ;
305
287
0 commit comments