8000 Add constants from vm_core.h (#171) · kddnewton/ruby@3a6d316 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a6d316

Browse files
authored
Add constants from vm_core.h (ruby#171)
* Add constants from vm_core.h * Remove definitions now exported through bindgen
1 parent 1b27a44 commit 3a6d316

File tree

3 files changed

+48
-10
lines changed

3 files changed

+48
-10
lines changed

yjit/bindgen/src/main.rs

Expand all lines: yjit/bindgen/src/main.rs
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ fn main() {
4141
.translate_enum_integer_types(true) // so we get fixed width Rust types for members
4242
.allowlist_type("ruby_value_type") // really old C extension API
4343

44+
// Constants defined in vm_core.h
45+
.allowlist_type("ruby_basic_operators")
46+
.allowlist_var(".*_REDEFINED_OP_FLAG")
47+
4448
.allowlist_function("rb_iseq_(get|set)_yjit_payload")
4549

4650
.allowlist_function("rb_iseq_pc_at_idx")

yjit/src/cruby.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,6 @@ pub const RUBY_OFFSET_RARRAY_AS_HEAP_LEN:i32 = 16; // struct RArray, subfield "
371371
pub const RUBY_OFFSET_RARRAY_AS_ARY:i32 = 16; // struct RArray, subfield "as.ary"
372372
pub const RUBY_OFFSET_RARRAY_AS_HEAP_PTR:i32 = 16; // struct RArray, subfield "as.heap.ptr"
373373

374-
// vm_core.h, enum ruby_basic_operators
375-
pub const BOP_PLUS: usize = 0;
376-
pub const BOP_MINUS: usize = 1;
377-
// ... more to export ...
378-
379-
// Defined in vm_core.h
380-
pub const INTEGER_REDEFINED_OP_FLAG: usize = 1 << 0;
381-
pub const FLOAT_REDEFINED_OP_FLAG: usize = 1 << 1;
382-
// ... more to export ...
383-
384374
// Constants from rb_control_frame_t vm_core.h
385375
pub const RUBY_OFFSET_CFP_PC: i32 = 0;
386376
pub const RUBY_OFFSET_CFP_SP: i32 = 8;

yjit/src/cruby_bindings.inc.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
/* automatically generated by rust-bindgen 0.59.2 */
22

3+
pub const INTEGER_REDEFINED_OP_FLAG: u32 = 1;
4+
pub const FLOAT_REDEFINED_OP_FLAG: u32 = 2;
5+
pub const STRING_REDEFINED_OP_FLAG: u32 = 4;
6+
pub const ARRAY_REDEFINED_OP_FLAG: u32 = 8;
7+
pub const HASH_REDEFINED_OP_FLAG: u32 = 16;
8+
pub const SYMBOL_REDEFINED_OP_FLAG: u32 = 64;
9+
pub const TIME_REDEFINED_OP_FLAG: u32 = 128;
10+
pub const REGEXP_REDEFINED_OP_FLAG: u32 = 256;
11+
pub const NIL_REDEFINED_OP_FLAG: u32 = 512;
12+
pub const TRUE_REDEFINED_OP_FLAG: u32 = 1024;
13+
pub const FALSE_REDEFINED_OP_FLAG: u32 = 2048;
14+
pub const PROC_REDEFINED_OP_FLAG: u32 = 4096;
15+
pub type __uint32_t = ::std::os::raw::c_uint;
316
#[repr(C)]
417
pub struct RBasic {
518
pub flags: VALUE,
@@ -40,6 +53,37 @@ extern "C" {
4053
extern "C" {
4154
pub fn rb_hash_aset(hash: VALUE, key: VALUE, val: VALUE) -> VALUE;
4255
}
56+
pub const BOP_PLUS: ruby_basic_operators = 0;
57+
pub const BOP_MINUS: ruby_basic_operators = 1;
58+
pub const BOP_MULT: ruby_basic_operators = 2;
59+
pub const BOP_DIV: ruby_basic_operators = 3;
60+
pub const BOP_MOD: ruby_basic_operators = 4;
61+
pub const BOP_EQ: ruby_basic_operators = 5;
62+
pub const BOP_EQQ: ruby_basic_operators = 6;
63+
pub const BOP_LT: ruby_basic_operators = 7;
64+
pub const BOP_LE: ruby_basic_operators = 8;
65+
pub const BOP_LTLT: ruby_basic_operators = 9;
66+
pub const BOP_AREF: ruby_basic_operators = 10;
67+
pub const BOP_ASET: ruby_basic_operators = 11;
68+
pub const BOP_LENGTH: ruby_basic_operators = 12;
69+
pub const BOP_SIZE: ruby_basic_operators = 13;
70+
pub const BOP_EMPTY_P: ruby_basic_operators = 14;
71+
pub const BOP_NIL_P: ruby_basic_operators = 15;
72+
pub const BOP_SUCC: ruby_basic_operators = 16;
73+
pub const BOP_GT: ruby_basic_operators = 17;
74+
pub const BOP_GE: ruby_basic_operators = 18;
75+
pub const BOP_NOT: ruby_basic_operators = 19;
76+
pub const BOP_NEQ: ruby_basic_operators = 20;
77+
pub const BOP_MATCH: ruby_basic_operators = 21;
78+
pub const BOP_FREEZE: ruby_basic_operators = 22;
79+
pub const BOP_UMINUS: ruby_basic_operators = 23;
80+
pub const BOP_MAX: ruby_basic_operators = 24;
81+
pub const BOP_MIN: ruby_basic_operators = 25;
82+
pub const BOP_CALL: ruby_basic_operators = 26;
83+
pub const BOP_AND: ruby_basic_operators = 27;
84+
pub const BOP_OR: ruby_basic_operators = 28;
85+
pub const BOP_LAST_: ruby_basic_operators = 29;
86+
pub type ruby_basic_operators = u32;
4387
extern "C" {
4488
pub fn rb_iseq_get_yjit_payload(iseq: *const rb_iseq_t) -> *mut ::std::os::raw::c_void;
4589
}

0 commit comments

Comments
 (0)
0