-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrjit_c.rb
1665 lines (1440 loc) · 90.9 KB
/
rjit_c.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# frozen_string_literal: true
# Part of this file is generated by tool/rjit/bindgen.rb.
# Run `make rjit-bindgen` to update code between "RJIT bindgen begin" and "RJIT bindgen end".
module RubyVM::RJIT # :nodoc: all
#
# Main: Used by RJIT
#
# This `class << C` section is for calling C functions with Primitive.
# For importing variables or macros, use tool/rjit/bindgen.rb instead.
class << C = Module.new
def mmap(mem_size)
Primitive.cexpr! 'SIZET2NUM((size_t)rjit_reserve_addr_space(NUM2UINT(mem_size)))'
end
def mprotect_write(mem_block, mem_size)
Primitive.mprotect_write(mem_block, mem_size)
end
def mprotect_exec(mem_block, mem_size)
Primitive.mprotect_exec(mem_block, mem_size)
end
def rjit_insn_exits
addr = Primitive.cexpr! 'SIZET2NUM((size_t)rjit_insn_exits)'
CType::Immediate.parse("size_t").new(addr)
end
def rb_rjit_counters
addr = Primitive.cexpr! 'SIZET2NUM((size_t)&rb_rjit_counters)'
rb_rjit_runtime_counters.new(addr)
end
# @param from [Integer] - From address
# @param to [Integer] - To address
def dump_disasm(from, to, test: false)
Primitive.dump_disasm(from, to, test)
end
# Convert a Ruby object to a VALUE in Integer
def to_value(obj)
Primitive.cexpr! 'SIZET2NUM((size_t)obj)'
end
def BASIC_OP_UNREDEFINED_P(op, klass)
Primitive.cexpr! 'RBOOL(BASIC_OP_UNREDEFINED_P(NUM2INT(op), NUM2INT(klass)))'
end
def rb_iseq_line_no(iseq, pos)
_iseq_addr = iseq.to_i
Primitive.cexpr! 'UINT2NUM(rb_iseq_line_no((const rb_iseq_t *)NUM2SIZET(_iseq_addr), NUM2SIZET(pos)))'
end
def rb_class_of(obj)
Primitive.cexpr! 'rb_class_of(obj)'
end
def rb_callable_method_entry(klass, mid)
cme_addr = Primitive.cexpr! 'SIZET2NUM((size_t)rb_callable_method_entry(klass, NUM2UINT(mid)))'
return nil if cme_addr == 0
rb_callable_method_entry_t.new(cme_addr)
end
def METHOD_ENTRY_VISI(cme)
_cme_addr = cme.to_i
Primitive.cexpr! 'UINT2NUM(METHOD_ENTRY_VISI((const rb_callable_method_entry_t *)NUM2SIZET(_cme_addr)))'
end
def rb_simple_iseq_p(iseq)
_iseq_addr = iseq.to_i
Primitive.cexpr! 'RBOOL(rb_simple_iseq_p((rb_iseq_t *)NUM2SIZET(_iseq_addr)))'
end
def SPECIAL_CONST_P(obj)
_value = to_value(obj)
Primitive.cexpr! 'RBOOL(SPECIAL_CONST_P((VALUE)NUM2SIZET(_value)))'
end
def BUILTIN_TYPE(obj)
_value = to_value(obj)
Primitive.cexpr! 'INT2NUM(BUILTIN_TYPE((VALUE)NUM2SIZET(_value)))'
end
def RB_TYPE_P(obj, type)
Primitive.cexpr! 'RBOOL(RB_TYPE_P(obj, NUM2UINT(type)))'
end
def rb_shape_get_shape_id(obj)
_value = to_value(obj)
Primitive.cexpr! 'UINT2NUM((unsigned int)rb_shape_get_shape_id((VALUE)NUM2SIZET(_value)))'
end
def rb_shape_id_offset
Primitive.cexpr! 'INT2NUM(rb_shape_id_offset())'
end
def rb_shape_get_iv_index(shape_id, ivar_id)
Primitive.cstmt! %{
rb_shape_t *shape = rb_shape_get_shape_by_id((shape_id_t)NUM2SIZET(shape_id));
attr_index_t index;
bool found = rb_shape_get_iv_index(shape, (ID)NUM2SIZET(ivar_id), &index);
return found ? UINT2NUM(index) : Qnil;
}
end
def FL_TEST_RAW(obj, flags)
Primitive.cexpr! 'RBOOL(FL_TEST_RAW(obj, (VALUE)NUM2SIZET(flags)))'
end
def FL_TEST(obj, flags)
Primitive.cexpr! 'RBOOL(FL_TEST(obj, (VALUE)NUM2SIZET(flags)))'
end
def rjit_for_each_iseq(&block)
Primitive.rjit_for_each_iseq(block)
end
def get_symbol_id(name)
Primitive.cexpr! 'SIZET2NUM((size_t)rb_get_symbol_id(name))'
end
def rb_vm_frame_method_entry(cfp)
_cfp = cfp.to_i
cme_addr = Primitive.cexpr! 'SIZET2NUM((size_t)rb_vm_frame_method_entry((const rb_control_frame_t *)NUM2SIZET(_cfp)))'
return nil if cme_addr == 0
rb_callable_method_entry_t.new(cme_addr)
end
def rb_class_get_superclass(klass)
Primitive.cexpr! 'rb_class_get_superclass(klass)'
end
def ID2SYM(id)
Primitive.cexpr! 'ID2SYM((ID)NUM2SIZET(id))'
end
def obj_is_kind_of(obj, c)
Primitive.cexpr! 'rb_obj_is_kind_of(obj, c)'
end
def imemo_type_p(ptr, type)
_ptr = ptr.to_i
Primitive.cexpr! 'RBOOL(imemo_type_p((VALUE)NUM2SIZET(_ptr), NUM2UINT(type)))'
end
def rb_iseq_only_optparam_p(iseq)
_iseq = iseq.to_i
Primitive.cstmt! %{
extern bool rb_iseq_only_optparam_p(const rb_iseq_t *iseq);
return RBOOL(rb_iseq_only_optparam_p((rb_iseq_t *)NUM2SIZET(_iseq)));
}
end
def rb_iseq_only_kwparam_p(iseq)
_iseq = iseq.to_i
Primitive.cstmt! %{
extern bool rb_iseq_only_kwparam_p(const rb_iseq_t *iseq);
return RBOOL(rb_iseq_only_kwparam_p((rb_iseq_t *)NUM2SIZET(_iseq)));
}
end
def rb_obj_frozen_p(obj)
Primitive.cexpr! 'rb_obj_frozen_p(obj)'
end
def rb_intern(str)
Primitive.cexpr! 'SIZET2NUM((size_t)rb_intern(RSTRING_PTR(str)))'
end
def rb_method_entry_at(klass, mid)
me_addr = Primitive.cexpr! 'SIZET2NUM((size_t)rb_method_entry_at(klass, (ID)NUM2SIZET(mid)))'
me_addr == 0 ? nil : rb_method_entry_t.new(me_addr)
end
def rb_shape_get_next(shape, obj, id)
_shape = shape.to_i
shape_addr = Primitive.cexpr! 'SIZET2NUM((size_t)rb_shape_get_next((rb_shape_t *)NUM2SIZET(_shape), obj, (ID)NUM2SIZET(id)))'
rb_shape_t.new(shape_addr)
end
def rb_shape_id(shape)
_shape = shape.to_i
Primitive.cexpr! 'SIZET2NUM((size_t)rb_shape_id((rb_shape_t *)NUM2SIZET(_shape)))'
end
def rb_class_attached_object(klass)
Primitive.cexpr! 'rb_class_attached_object(klass)'
end
def rb_singleton_class(obj)
Primitive.cexpr! 'rb_singleton_class(obj)'
end
def rb_aliased_callable_method_entry(cme)
_cme = cme.to_i
cme_addr = Primitive.cstmt! %{
extern const rb_callable_method_entry_t * rb_aliased_callable_method_entry(const rb_callable_method_entry_t *me);
return SIZET2NUM((size_t)rb_aliased_callable_method_entry((const rb_callable_method_entry_t *)NUM2SIZET(_cme)));
}
rb_callable_method_entry_t.new(cme_addr)
end
def rb_yjit_get_proc_ptr(proc_addr)
proc_t_addr = Primitive.cstmt! %{
extern rb_proc_t * rjit_get_proc_ptr(VALUE procv);
return SIZET2NUM((size_t)rjit_get_proc_ptr((VALUE)NUM2SIZET(proc_addr)));
}
rb_proc_t.new(proc_t_addr)
end
def rb_shape_get_shape_by_id(shape_id)
_shape_id = shape_id.to_i
shape_addr = Primitive.cexpr! 'SIZET2NUM((VALUE)rb_shape_get_shape_by_id((shape_id_t)NUM2UINT(_shape_id)))'
rb_shape_t.new(shape_addr)
end
def rb_iseq_check(iseq)
_iseq_addr = iseq.to_i
iseq_addr = Primitive.cexpr! 'SIZET2NUM((VALUE)rb_iseq_check((rb_iseq_t *)NUM2SIZET(_iseq_addr)))'
rb_iseq_t.new(iseq_addr)
end
def rb_iseq_path(iseq)
_iseq_addr = iseq.to_i
Primitive.cexpr! 'rb_iseq_path((rb_iseq_t *)NUM2SIZET(_iseq_addr))'
end
def vm_ci_argc(ci)
_ci_addr = ci.to_i
Primitive.cexpr! 'UINT2NUM(vm_ci_argc((CALL_INFO)NUM2SIZET(_ci_addr)))'
end
def vm_ci_flag(ci)
_ci_addr = ci.to_i
Primitive.cexpr! 'UINT2NUM(vm_ci_flag((CALL_INFO)NUM2SIZET(_ci_addr)))'
end
def vm_ci_kwarg(ci)
_ci_addr = ci.to_i
kwarg_addr = Primitive.cexpr! 'SIZET2NUM((size_t)vm_ci_kwarg((CALL_INFO)NUM2SIZET(_ci_addr)))'
kwarg_addr == 0 ? nil : rb_callinfo_kwarg.new(kwarg_addr)
end
def vm_ci_mid(ci)
_ci_addr = ci.to_i
Primitive.cexpr! 'SIZET2NUM((size_t)vm_ci_mid((CALL_INFO)NUM2SIZET(_ci_addr)))'
end
def rjit_opts
addr = Primitive.cexpr! 'SIZET2NUM((VALUE)&rb_rjit_opts)'
rb_rjit_options.new(addr)
end
def rjit_cancel_all(reason)
Primitive.cstmt! %{
rb_rjit_cancel_all(RSTRING_PTR(reason));
return Qnil;
}
end
# Convert an encoded VM pointer to an insn BIN.
def rb_vm_insn_decode(encoded)
# Using rb_vm_insn_addr2opcode to return trace_ insns
Primitive.cexpr! 'INT2NUM(rb_vm_insn_addr2opcode((void *)NUM2SIZET(encoded)))'
end
# Convert Integer VALUE to an actual Ruby object
def to_ruby(value)
Primitive.cexpr! '(VALUE)NUM2SIZET(value)'
end
def HAVE_LIBCAPSTONE
Primitive.cstmt! %{
#ifdef HAVE_LIBCAPSTONE
return Qtrue;
#else
return Qfalse;
#endif
}
end
def rjit_exit_traces
Primitive.cexpr! 'rjit_exit_traces()'
end
def rb_vm_ep_local_ep(ep)
_ep = ep.to_i
lep_addr = Primitive.cexpr! 'SIZET2NUM((size_t)rb_vm_ep_local_ep((const VALUE *)NUM2SIZET(_ep)))'
C.VALUE.new(lep_addr)
end
def rb_hash_keys(hash)
Primitive.cexpr! 'rb_hash_keys(hash)'
end
def rb_hash_stlike_lookup(hash, key)
Primitive.cstmt! %{
VALUE result = Qnil;
rb_hash_stlike_lookup(hash, key, &result);
return result;
}
end
def rb_obj_class(obj)
Primitive.cexpr! 'rb_obj_class(obj)'
end
def rb_sym2id(sym)
Primitive.cexpr! 'SIZET2NUM((size_t)rb_sym2id(sym))'
end
def rb_callable_method_entry_or_negative(klass, mid)
cme_addr = Primitive.cexpr! 'SIZET2NUM((size_t)rb_callable_method_entry_or_negative(klass, (ID)NUM2SIZET(mid)))'
return nil if cme_addr == 0
rb_callable_method_entry_t.new(cme_addr)
end
def rb_method_basic_definition_p(klass, mid)
Primitive.cexpr! 'RBOOL(rb_method_basic_definition_p(klass, (ID)NUM2SIZET(mid)))'
end
def UNDEFINED_METHOD_ENTRY_P(cme)
_cme_addr = cme.to_i
Primitive.cexpr! 'RBOOL(UNDEFINED_METHOD_ENTRY_P((const rb_callable_method_entry_t *)NUM2SIZET(_cme_addr)))'
end
def RCLASS_ORIGIN(klass)
Primitive.cexpr! 'RCLASS_ORIGIN(klass)'
end
def RCLASS_SINGLETON_P(klass)
Primitive.cexpr! 'RCLASS_SINGLETON_P(klass)'
end
end
#
# Utilities: Not used by RJIT, but useful for debugging
#
class << C
# Convert insn BINs to encoded VM pointers.
def rb_vm_insn_encode(bin)
Primitive.cexpr! 'SIZET2NUM((VALUE)rb_vm_get_insns_address_table()[NUM2INT(bin)])'
end
# Convert RubyVM::InstructionSequence to C.rb_iseq_t.
def rb_iseqw_to_iseq(iseqw)
iseq_addr = Primitive.cexpr! 'SIZET2NUM((VALUE)rb_iseqw_to_iseq(iseqw))'
rb_iseq_t.new(iseq_addr)
end
end
### RJIT bindgen begin ###
C::UNLIMITED_ARGUMENTS = Primitive.cexpr! %q{ LONG2NUM(UNLIMITED_ARGUMENTS) }
C::VM_ENV_DATA_INDEX_ME_CREF = Primitive.cexpr! %q{ LONG2NUM(VM_ENV_DATA_INDEX_ME_CREF) }
C::VM_ENV_DATA_INDEX_SPECVAL = Primitive.cexpr! %q{ LONG2NUM(VM_ENV_DATA_INDEX_SPECVAL) }
C::ARRAY_REDEFINED_OP_FLAG = Primitive.cexpr! %q{ SIZET2NUM(ARRAY_REDEFINED_OP_FLAG) }
C::BOP_AND = Primitive.cexpr! %q{ SIZET2NUM(BOP_AND) }
C::BOP_AREF = Primitive.cexpr! %q{ SIZET2NUM(BOP_AREF) }
C::BOP_EQ = Primitive.cexpr! %q{ SIZET2NUM(BOP_EQ) }
C::BOP_EQQ = Primitive.cexpr! %q{ SIZET2NUM(BOP_EQQ) }
C::BOP_FREEZE = Primitive.cexpr! %q{ SIZET2NUM(BOP_FREEZE) }
C::BOP_GE = Primitive.cexpr! %q{ SIZET2NUM(BOP_GE) }
C::BOP_GT = Primitive.cexpr! %q{ SIZET2NUM(BOP_GT) }
C::BOP_LE = Primitive.cexpr! %q{ SIZET2NUM(BOP_LE) }
C::BOP_LT = Primitive.cexpr! %q{ SIZET2NUM(BOP_LT) }
C::BOP_MINUS = Primitive.cexpr! %q{ SIZET2NUM(BOP_MINUS) }
C::BOP_MOD = Primitive.cexpr! %q{ SIZET2NUM(BOP_MOD) }
C::BOP_OR = Primitive.cexpr! %q{ SIZET2NUM(BOP_OR) }
C::BOP_PLUS = Primitive.cexpr! %q{ SIZET2NUM(BOP_PLUS) }
C::BUILTIN_ATTR_LEAF = Primitive.cexpr! %q{ SIZET2NUM(BUILTIN_ATTR_LEAF) }
C::HASH_REDEFINED_OP_FLAG = Primitive.cexpr! %q{ SIZET2NUM(HASH_REDEFINED_OP_FLAG) }
C::INTEGER_REDEFINED_OP_FLAG = Primitive.cexpr! %q{ SIZET2NUM(INTEGER_REDEFINED_OP_FLAG) }
C::INVALID_SHAPE_ID = Primitive.cexpr! %q{ SIZET2NUM(INVALID_SHAPE_ID) }
C::METHOD_VISI_PRIVATE = Primitive.cexpr! %q{ SIZET2NUM(METHOD_VISI_PRIVATE) }
C::METHOD_VISI_PROTECTED = Primitive.cexpr! %q{ SIZET2NUM(METHOD_VISI_PROTECTED) }
C::METHOD_VISI_PUBLIC = Primitive.cexpr! %q{ SIZET2NUM(METHOD_VISI_PUBLIC) }
C::METHOD_VISI_UNDEF = Primitive.cexpr! %q{ SIZET2NUM(METHOD_VISI_UNDEF) }
C::OBJ_TOO_COMPLEX_SHAPE_ID = Primitive.cexpr! %q{ SIZET2NUM(OBJ_TOO_COMPLEX_SHAPE_ID) }
C::OPTIMIZED_METHOD_TYPE_BLOCK_CALL = Primitive.cexpr! %q{ SIZET2NUM(OPTIMIZED_METHOD_TYPE_BLOCK_CALL) }
C::OPTIMIZED_METHOD_TYPE_CALL = Primitive.cexpr! %q{ SIZET2NUM(OPTIMIZED_METHOD_TYPE_CALL) }
C::OPTIMIZED_METHOD_TYPE_SEND = Primitive.cexpr! %q{ SIZET2NUM(OPTIMIZED_METHOD_TYPE_SEND) }
C::OPTIMIZED_METHOD_TYPE_STRUCT_AREF = Primitive.cexpr! %q{ SIZET2NUM(OPTIMIZED_METHOD_TYPE_STRUCT_AREF) }
C::OPTIMIZED_METHOD_TYPE_STRUCT_ASET = Primitive.cexpr! %q{ SIZET2NUM(OPTIMIZED_METHOD_TYPE_STRUCT_ASET) }
C::RARRAY_EMBED_FLAG = Primitive.cexpr! %q{ SIZET2NUM(RARRAY_EMBED_FLAG) }
C::RARRAY_EMBED_LEN_MASK = Primitive.cexpr! %q{ SIZET2NUM(RARRAY_EMBED_LEN_MASK) }
C::RARRAY_EMBED_LEN_SHIFT = Primitive.cexpr! %q{ SIZET2NUM(RARRAY_EMBED_LEN_SHIFT) }
C::RHASH_PASS_AS_KEYWORDS = Primitive.cexpr! %q{ SIZET2NUM(RHASH_PASS_AS_KEYWORDS) }
C::RMODULE_IS_REFINEMENT = Primitive.cexpr! %q{ SIZET2NUM(RMODULE_IS_REFINEMENT) }
C::ROBJECT_EMBED = Primitive.cexpr! %q{ SIZET2NUM(ROBJECT_EMBED) }
C::RSTRUCT_EMBED_LEN_MASK = Primitive.cexpr! %q{ SIZET2NUM(RSTRUCT_EMBED_LEN_MASK) }
C::RUBY_ENCODING_MASK = Primitive.cexpr! %q{ SIZET2NUM(RUBY_ENCODING_MASK) }
C::RUBY_EVENT_CLASS = Primitive.cexpr! %q{ SIZET2NUM(RUBY_EVENT_CLASS) }
C::RUBY_EVENT_C_CALL = Primitive.cexpr! %q{ SIZET2NUM(RUBY_EVENT_C_CALL) }
C::RUBY_EVENT_C_RETURN = Primitive.cexpr! %q{ SIZET2NUM(RUBY_EVENT_C_RETURN) }
C::RUBY_FIXNUM_FLAG = Primitive.cexpr! %q{ SIZET2NUM(RUBY_FIXNUM_FLAG) }
C::RUBY_FLONUM_FLAG = Primitive.cexpr! %q{ SIZET2NUM(RUBY_FLONUM_FLAG) }
C::RUBY_FLONUM_MASK = Primitive.cexpr! %q{ SIZET2NUM(RUBY_FLONUM_MASK) }
C::RUBY_FL_FREEZE = Primitive.cexpr! %q{ SIZET2NUM(RUBY_FL_FREEZE) }
C::RUBY_IMMEDIATE_MASK = Primitive.cexpr! %q{ SIZET2NUM(RUBY_IMMEDIATE_MASK) }
C::RUBY_SPECIAL_SHIFT = Primitive.cexpr! %q{ SIZET2NUM(RUBY_SPECIAL_SHIFT) }
C::RUBY_SYMBOL_FLAG = Primitive.cexpr! %q{ SIZET2NUM(RUBY_SYMBOL_FLAG) }
C::RUBY_T_ARRAY = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_ARRAY) }
C::RUBY_T_CLASS = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_CLASS) }
C::RUBY_T_HASH = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_HASH) }
C::RUBY_T_ICLASS = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_ICLASS) }
C::RUBY_T_MASK = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_MASK) }
C::RUBY_T_MODULE = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_MODULE) }
C::RUBY_T_OBJECT = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_OBJECT) }
C::RUBY_T_STRING = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_STRING) }
C::RUBY_T_SYMBOL = Primitive.cexpr! %q{ SIZET2NUM(RUBY_T_SYMBOL) }
C::SHAPE_FLAG_SHIFT = Primitive.cexpr! %q{ SIZET2NUM(SHAPE_FLAG_SHIFT) }
C::SHAPE_FROZEN = Primitive.cexpr! %q{ SIZET2NUM(SHAPE_FROZEN) }
C::SHAPE_ID_NUM_BITS = Primitive.cexpr! %q{ SIZET2NUM(SHAPE_ID_NUM_BITS) }
C::SHAPE_IVAR = Primitive.cexpr! %q{ SIZET2NUM(SHAPE_IVAR) }
C::SHAPE_MASK = Primitive.cexpr! %q{ SIZET2NUM(SHAPE_MASK) }
C::SHAPE_ROOT = Primitive.cexpr! %q{ SIZET2NUM(SHAPE_ROOT) }
C::STRING_REDEFINED_OP_FLAG = Primitive.cexpr! %q{ SIZET2NUM(STRING_REDEFINED_OP_FLAG) }
C::T_OBJECT = Primitive.cexpr! %q{ SIZET2NUM(T_OBJECT) }
C::VM_BLOCK_HANDLER_NONE = Primitive.cexpr! %q{ SIZET2NUM(VM_BLOCK_HANDLER_NONE) }
C::VM_CALL_ARGS_BLOCKARG = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_ARGS_BLOCKARG) }
C::VM_CALL_ARGS_SPLAT = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_ARGS_SPLAT) }
C::VM_CALL_FCALL = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_FCALL) }
C::VM_CALL_KWARG = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_KWARG) }
C::VM_CALL_KW_SPLAT = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_KW_SPLAT) }
C::VM_CALL_KW_SPLAT_MUT = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_KW_SPLAT_MUT) }
C::VM_CALL_KW_SPLAT_bit = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_KW_SPLAT_bit) }
C::VM_CALL_OPT_SEND = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_OPT_SEND) }
C::VM_CALL_TAILCALL = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_TAILCALL) }
C::VM_CALL_TAILCALL_bit = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_TAILCALL_bit) }
C::VM_CALL_ZSUPER = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_ZSUPER) }
C::VM_ENV_DATA_INDEX_FLAGS = Primitive.cexpr! %q{ SIZET2NUM(VM_ENV_DATA_INDEX_FLAGS) }
C::VM_ENV_DATA_SIZE = Primitive.cexpr! %q{ SIZET2NUM(VM_ENV_DATA_SIZE) }
C::VM_ENV_FLAG_LOCAL = Primitive.cexpr! %q{ SIZET2NUM(VM_ENV_FLAG_LOCAL) }
C::VM_ENV_FLAG_WB_REQUIRED = Primitive.cexpr! %q{ SIZET2NUM(VM_ENV_FLAG_WB_REQUIRED) }
C::VM_FRAME_FLAG_BMETHOD = Primitive.cexpr! %q{ SIZET2NUM(VM_FRAME_FLAG_BMETHOD) }
C::VM_FRAME_FLAG_CFRAME = Primitive.cexpr! %q{ SIZET2NUM(VM_FRAME_FLAG_CFRAME) }
C::VM_FRAME_FLAG_CFRAME_KW = Primitive.cexpr! %q{ SIZET2NUM(VM_FRAME_FLAG_CFRAME_KW) }
C::VM_FRAME_FLAG_LAMBDA = Primitive.cexpr! %q{ SIZET2NUM(VM_FRAME_FLAG_LAMBDA) }
C::VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM = Primitive.cexpr! %q{ SIZET2NUM(VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM) }
C::VM_FRAME_MAGIC_BLOCK = Primitive.cexpr! %q{ SIZET2NUM(VM_FRAME_MAGIC_BLOCK) }
C::VM_FRAME_MAGIC_CFUNC = Primitive.cexpr! %q{ SIZET2NUM(VM_FRAME_MAGIC_CFUNC) }
C::VM_FRAME_MAGIC_METHOD = Primitive.cexpr! %q{ SIZET2NUM(VM_FRAME_MAGIC_METHOD) }
C::VM_METHOD_TYPE_ALIAS = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_ALIAS) }
C::VM_METHOD_TYPE_ATTRSET = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_ATTRSET) }
C::VM_METHOD_TYPE_BMETHOD = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_BMETHOD) }
C::VM_METHOD_TYPE_CFUNC = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_CFUNC) }
C::VM_METHOD_TYPE_ISEQ = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_ISEQ) }
C::VM_METHOD_TYPE_IVAR = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_IVAR) }
C::VM_METHOD_TYPE_MISSING = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_MISSING) }
C::VM_METHOD_TYPE_NOTIMPLEMENTED = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_NOTIMPLEMENTED) }
C::VM_METHOD_TYPE_OPTIMIZED = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_OPTIMIZED) }
C::VM_METHOD_TYPE_REFINED = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_REFINED) }
C::VM_METHOD_TYPE_UNDEF = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_UNDEF) }
C::VM_METHOD_TYPE_ZSUPER = Primitive.cexpr! %q{ SIZET2NUM(VM_METHOD_TYPE_ZSUPER) }
C::VM_SPECIAL_OBJECT_VMCORE = Primitive.cexpr! %q{ SIZET2NUM(VM_SPECIAL_OBJECT_VMCORE) }
def C.block_type_iseq = Primitive.cexpr!(%q{ SIZET2NUM(block_type_iseq) })
def C.idRespond_to_missing = Primitive.cexpr!(%q{ SIZET2NUM(idRespond_to_missing) })
def C.imemo_callinfo = Primitive.cexpr!(%q{ SIZET2NUM(imemo_callinfo) })
def C.imemo_iseq = Primitive.cexpr!(%q{ SIZET2NUM(imemo_iseq) })
def C.rb_block_param_proxy = Primitive.cexpr!(%q{ SIZET2NUM(rb_block_param_proxy) })
def C.rb_cArray = Primitive.cexpr!(%q{ SIZET2NUM(rb_cArray) })
def C.rb_cFalseClass = Primitive.cexpr!(%q{ SIZET2NUM(rb_cFalseClass) })
def C.rb_cFloat = Primitive.cexpr!(%q{ SIZET2NUM(rb_cFloat) })
def C.rb_cInteger = Primitive.cexpr!(%q{ SIZET2NUM(rb_cInteger) })
def C.rb_cNilClass = Primitive.cexpr!(%q{ SIZET2NUM(rb_cNilClass) })
def C.rb_cString = Primitive.cexpr!(%q{ SIZET2NUM(rb_cString) })
def C.rb_cSymbol = Primitive.cexpr!(%q{ SIZET2NUM(rb_cSymbol) })
def C.rb_cTrueClass = Primitive.cexpr!(%q{ SIZET2NUM(rb_cTrueClass) })
def C.rb_mRubyVMFrozenCore = Primitive.cexpr!(%q{ SIZET2NUM(rb_mRubyVMFrozenCore) })
def C.rb_rjit_global_events = Primitive.cexpr!(%q{ SIZET2NUM(rb_rjit_global_events) })
def C.rb_vm_insns_count = Primitive.cexpr!(%q{ SIZET2NUM(rb_vm_insns_count) })
def C.rb_ary_clear
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_clear) }
end
def C.rb_ary_dup
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_dup) }
end
def C.rb_ary_entry_internal
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_entry_internal) }
end
def C.rb_ary_push
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_push) }
end
def C.rb_ary_resurrect
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_resurrect) }
end
def C.rb_ary_store
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_store) }
end
def C.rb_ary_tmp_new_from_values
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_tmp_new_from_values) }
end
def C.rb_ary_unshift_m
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ary_unshift_m) }
end
def C.rb_backref_get
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_backref_get) }
end
def C.rb_ec_ary_new_from_values
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ec_ary_new_from_values) }
end
def C.rb_ec_str_resurrect
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ec_str_resurrect) }
end
def C.rb_ensure_iv_list_size
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ensure_iv_list_size) }
end
def C.rb_fix_aref
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_fix_aref) }
end
def C.rb_fix_div_fix
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_fix_div_fix) }
end
def C.rb_fix_mod_fix
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_fix_mod_fix) }
end
def C.rb_fix_mul_fix
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_fix_mul_fix) }
end
def C.rb_gc_writebarrier
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_gc_writebarrier) }
end
def C.rb_get_symbol_id
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_get_symbol_id) }
end
def C.rb_gvar_get
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_gvar_get) }
end
def C.rb_hash_aref
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_hash_aref) }
end
def C.rb_hash_aset
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_hash_aset) }
end
def C.rb_hash_bulk_insert
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_hash_bulk_insert) }
end
def C.rb_hash_new
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_hash_new) }
end
def C.rb_hash_new_with_size
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_hash_new_with_size) }
end
def C.rb_hash_resurrect
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_hash_resurrect) }
end
def C.rb_ivar_defined
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ivar_defined) }
end
def C.rb_ivar_get
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_ivar_get) }
end
def C.rb_obj_as_string_result
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_obj_as_string_result) }
end
def C.rb_obj_is_kind_of
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_obj_is_kind_of) }
end
def C.rb_range_new
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_range_new) }
end
def C.rb_reg_last_match
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_reg_last_match) }
end
def C.rb_reg_match_last
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_reg_match_last) }
end
def C.rb_reg_match_post
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_reg_match_post) }
end
def C.rb_reg_match_pre
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_reg_match_pre) }
end
def C.rb_reg_new_ary
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_reg_new_ary) }
end
def C.rb_reg_nth_match
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_reg_nth_match) }
end
def C.rb_rjit_branch_stub_hit
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_rjit_branch_stub_hit) }
end
def C.rb_rjit_entry_stub_hit
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_rjit_entry_stub_hit) }
end
def C.rb_str_buf_append
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_str_buf_append) }
end
def C.rb_str_bytesize
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_str_bytesize) }
end
def C.rb_str_concat_literals
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_str_concat_literals) }
end
def C.rb_str_dup
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_str_dup) }
end
def C.rb_str_eql_internal
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_str_eql_internal) }
end
def C.rb_str_getbyte
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_str_getbyte) }
end
def C.rb_str_intern
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_str_intern) }
end
def C.rb_sym_to_proc
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_sym_to_proc) }
end
def C.rb_vm_bh_to_procval
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_bh_to_procval) }
end
def C.rb_vm_concat_array
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_concat_array) }
end
def C.rb_vm_defined
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_defined) }
end
def C.rb_vm_get_ev_const
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_get_ev_const) }
end
def C.rb_vm_getclassvariable
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_getclassvariable) }
end
def C.rb_vm_ic_hit_p
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_ic_hit_p) }
end
def C.rb_vm_opt_newarray_hash
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_opt_newarray_hash) }
end
def C.rb_vm_opt_newarray_max
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_opt_newarray_max) }
end
def C.rb_vm_opt_newarray_min
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_opt_newarray_min) }
end
def C.rb_vm_set_ivar_id
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_set_ivar_id) }
end
def C.rb_vm_setclassvariable
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_setclassvariable) }
end
def C.rb_vm_setinstancevariable
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_setinstancevariable) }
end
def C.rb_vm_splat_array
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_splat_array) }
end
def C.rb_vm_throw
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_throw) }
end
def C.rb_vm_yield_with_cfunc
Primitive.cexpr! %q{ SIZET2NUM((size_t)rb_vm_yield_with_cfunc) }
end
def C.rjit_build_kwhash
Primitive.cexpr! %q{ SIZET2NUM((size_t)rjit_build_kwhash) }
end
def C.rjit_full_cfunc_return
Primitive.cexpr! %q{ SIZET2NUM((size_t)rjit_full_cfunc_return) }
end
def C.rjit_optimized_call
Primitive.cexpr! %q{ SIZET2NUM((size_t)rjit_optimized_call) }
end
def C.rjit_rb_ary_subseq_length
Primitive.cexpr! %q{ SIZET2NUM((size_t)rjit_rb_ary_subseq_length) }
end
def C.rjit_record_exit_stack
Primitive.cexpr! %q{ SIZET2NUM((size_t)rjit_record_exit_stack) }
end
def C.rjit_str_neq_internal
Primitive.cexpr! %q{ SIZET2NUM((size_t)rjit_str_neq_internal) }
end
def C.rjit_str_simple_append
Primitive.cexpr! %q{ SIZET2NUM((size_t)rjit_str_simple_append) }
end
def C.CALL_DATA
@CALL_DATA ||= self.rb_call_data
end
def C.IC
@IC ||= self.iseq_inline_constant_cache
end
def C.ID
@ID ||= CType::Immediate.parse("unsigned long")
end
def C.IVC
@IVC ||= self.iseq_inline_iv_cache_entry
end
def C.RArray
@RArray ||= CType::Struct.new(
"RArray", Primitive.cexpr!("SIZEOF(struct RArray)"),
basic: [self.RBasic, Primitive.cexpr!("OFFSETOF((*((struct RArray *)NULL)), basic)")],
as: [CType::Union.new(
"", Primitive.cexpr!("SIZEOF(((struct RArray *)NULL)->as)"),
heap: CType::Struct.new(
"", Primitive.cexpr!("SIZEOF(((struct RArray *)NULL)->as.heap)"),
len: [CType::Immediate.parse("long"), Primitive.cexpr!("OFFSETOF(((struct RArray *)NULL)->as.heap, len)")],
aux: [CType::Union.new(
"", Primitive.cexpr!("SIZEOF(((struct RArray *)NULL)->as.heap.aux)"),
capa: CType::Immediate.parse("long"),
shared_root: self.VALUE,
), Primitive.cexpr!("OFFSETOF(((struct RArray *)NULL)->as.heap, aux)")],
ptr: [CType::Pointer.new { self.VALUE }, Primitive.cexpr!("OFFSETOF(((struct RArray *)NULL)->as.heap, ptr)")],
),
ary: CType::Array.new { self.VALUE },
), Primitive.cexpr!("OFFSETOF((*((struct RArray *)NULL)), as)")],
)
end
def C.RB_BUILTIN
@RB_BUILTIN ||= self.rb_builtin_function
end
def C.RBasic
@RBasic ||= CType::Struct.new(
"RBasic", Primitive.cexpr!("SIZEOF(struct RBasic)"),
flags: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct RBasic *)NULL)), flags)")],
klass: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct RBasic *)NULL)), klass)")],
)
end
def C.RObject
@RObject ||= CType::Struct.new(
"RObject", Primitive.cexpr!("SIZEOF(struct RObject)"),
basic: [self.RBasic, Primitive.cexpr!("OFFSETOF((*((struct RObject *)NULL)), basic)")],
as: [CType::Union.new(
"", Primitive.cexpr!("SIZEOF(((struct RObject *)NULL)->as)"),
heap: CType::Struct.new(
"", Primitive.cexpr!("SIZEOF(((struct RObject *)NULL)->as.heap)"),
ivptr: [CType::Pointer.new { self.VALUE }, Primitive.cexpr!("OFFSETOF(((struct RObject *)NULL)->as.heap, ivptr)")],
iv_index_tbl: [CType::Pointer.new { self.rb_id_table }, Primitive.cexpr!("OFFSETOF(((struct RObject *)NULL)->as.heap, iv_index_tbl)")],
),
ary: CType::Array.new { self.VALUE },
), Primitive.cexpr!("OFFSETOF((*((struct RObject *)NULL)), as)")],
)
end
def C.RString
@RString ||= CType::Struct.new(
"RString", Primitive.cexpr!("SIZEOF(struct RString)"),
basic: [self.RBasic, Primitive.cexpr!("OFFSETOF((*((struct RString *)NULL)), basic)")],
len: [CType::Immediate.parse("long"), Primitive.cexpr!("OFFSETOF((*((struct RString *)NULL)), len)")],
as: [CType::Union.new(
"", Primitive.cexpr!("SIZEOF(((struct RString *)NULL)->as)"),
heap: CType::Struct.new(
"", Primitive.cexpr!("SIZEOF(((struct RString *)NULL)->as.heap)"),
ptr: [CType::Pointer.new { CType::Immediate.parse("char") }, Primitive.cexpr!("OFFSETOF(((struct RString *)NULL)->as.heap, ptr)")],
aux: [CType::Union.new(
"", Primitive.cexpr!("SIZEOF(((struct RString *)NULL)->as.heap.aux)"),
capa: CType::Immediate.parse("long"),
shared: self.VALUE,
), Primitive.cexpr!("OFFSETOF(((struct RString *)NULL)->as.heap, aux)")],
),
embed: CType::Struct.new(
"", Primitive.cexpr!("SIZEOF(((struct RString *)NULL)->as.embed)"),
ary: [CType::Array.new { CType::Immediate.parse("char") }, Primitive.cexpr!("OFFSETOF(((struct RString *)NULL)->as.embed, ary)")],
),
), Primitive.cexpr!("OFFSETOF((*((struct RString *)NULL)), as)")],
)
end
def C.RStruct
@RStruct ||= CType::Struct.new(
"RStruct", Primitive.cexpr!("SIZEOF(struct RStruct)"),
basic: [self.RBasic, Primitive.cexpr!("OFFSETOF((*((struct RStruct *)NULL)), basic)")],
as: [CType::Union.new(
"", Primitive.cexpr!("SIZEOF(((struct RStruct *)NULL)->as)"),
heap: CType::Struct.new(
"", Primitive.cexpr!("SIZEOF(((struct RStruct *)NULL)->as.heap)"),
len: [CType::Immediate.parse("long"), Primitive.cexpr!("OFFSETOF(((struct RStruct *)NULL)->as.heap, len)")],
ptr: [CType::Pointer.new { self.VALUE }, Primitive.cexpr!("OFFSETOF(((struct RStruct *)NULL)->as.heap, ptr)")],
),
ary: CType::Array.new { self.VALUE },
), Primitive.cexpr!("OFFSETOF((*((struct RStruct *)NULL)), as)")],
)
end
def C.attr_index_t
@attr_index_t ||= CType::Immediate.parse("uint32_t")
end
def C.iseq_inline_constant_cache
@iseq_inline_constant_cache ||= CType::Struct.new(
"iseq_inline_constant_cache", Primitive.cexpr!("SIZEOF(struct iseq_inline_constant_cache)"),
entry: [CType::Pointer.new { self.iseq_inline_constant_cache_entry }, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_constant_cache *)NULL)), entry)")],
segments: [CType::Pointer.new { self.ID }, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_constant_cache *)NULL)), segments)")],
)
end
def C.iseq_inline_constant_cache_entry
@iseq_inline_constant_cache_entry ||= CType::Struct.new(
"iseq_inline_constant_cache_entry", Primitive.cexpr!("SIZEOF(struct iseq_inline_constant_cache_entry)"),
flags: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_constant_cache_entry *)NULL)), flags)")],
value: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_constant_cache_entry *)NULL)), value)")],
_unused1: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_constant_cache_entry *)NULL)), _unused1)")],
_unused2: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_constant_cache_entry *)NULL)), _unused2)")],
ic_cref: [CType::Pointer.new { self.rb_cref_t }, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_constant_cache_entry *)NULL)), ic_cref)")],
)
end
def C.iseq_inline_iv_cache_entry
@iseq_inline_iv_cache_entry ||= CType::Struct.new(
"iseq_inline_iv_cache_entry", Primitive.cexpr!("SIZEOF(struct iseq_inline_iv_cache_entry)"),
value: [CType::Immediate.parse("uintptr_t"), Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_iv_cache_entry *)NULL)), value)")],
iv_set_name: [self.ID, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_iv_cache_entry *)NULL)), iv_set_name)")],
)
end
def C.iseq_inline_storage_entry
@iseq_inline_storage_entry ||= CType::Union.new(
"iseq_inline_storage_entry", Primitive.cexpr!("SIZEOF(union iseq_inline_storage_entry)"),
once: CType::Struct.new(
"", Primitive.cexpr!("SIZEOF(((union iseq_inline_storage_entry *)NULL)->once)"),
running_thread: [CType::Pointer.new { self.rb_thread_struct }, Primitive.cexpr!("OFFSETOF(((union iseq_inline_storage_entry *)NULL)->once, running_thread)")],
value: [self.VALUE, Primitive.cexpr!("OFFSETOF(((union iseq_inline_storage_entry *)NULL)->once, value)")],
),
ic_cache: self.iseq_inline_constant_cache,
iv_cache: self.iseq_inline_iv_cache_entry,
)
end
def C.method_optimized_type
@method_optimized_type ||= CType::Immediate.parse("int")
end
def C.rb_block
@rb_block ||= CType::Struct.new(
"rb_block", Primitive.cexpr!("SIZEOF(struct rb_block)"),
as: [CType::Union.new(
"", Primitive.cexpr!("SIZEOF(((struct rb_block *)NULL)->as)"),
captured: self.rb_captured_block,
symbol: self.VALUE,
proc: self.VALUE,
), Primitive.cexpr!("OFFSETOF((*((struct rb_block *)NULL)), as)")],
type: [self.rb_block_type, Primitive.cexpr!("OFFSETOF((*((struct rb_block *)NULL)), type)")],
)
end
def C.rb_block_type
@rb_block_type ||= CType::Immediate.parse("int")
end
def C.rb_builtin_function
@rb_builtin_function ||= CType::Struct.new(
"rb_builtin_function", Primitive.cexpr!("SIZEOF(struct rb_builtin_function)"),
func_ptr: [CType::Immediate.parse("void *"), Primitive.cexpr!("OFFSETOF((*((struct rb_builtin_function *)NULL)), func_ptr)")],
argc: [CType::Immediate.parse("int"), Primitive.cexpr!("OFFSETOF((*((struct rb_builtin_function *)NULL)), argc)")],
index: [CType::Immediate.parse("int"), Primitive.cexpr!("OFFSETOF((*((struct rb_builtin_function *)NULL)), index)")],
name: [CType::Pointer.new { CType::Immediate.parse("char") }, Primitive.cexpr!("OFFSETOF((*((struct rb_builtin_function *)NULL)), name)")],
)
end
def C.rb_call_data
@rb_call_data ||= CType::Struct.new(
"rb_call_data", Primitive.cexpr!("SIZEOF(struct rb_call_data)"),
ci: [CType::Pointer.new { self.rb_callinfo }, Primitive.cexpr!("OFFSETOF((*((struct rb_call_data *)NULL)), ci)")],
cc: [CType::Pointer.new { self.rb_callcache }, Primitive.cexpr!("OFFSETOF((*((struct rb_call_data *)NULL)), cc)")],
)
end
def C.rb_callable_method_entry_struct
@rb_callable_method_entry_struct ||= CType::Struct.new(
"rb_callable_method_entry_struct", Primitive.cexpr!("SIZEOF(struct rb_callable_method_entry_struct)"),
flags: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), flags)")],
defined_class: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), defined_class)"), true],
def: [CType::Pointer.new { self.rb_method_definition_struct }, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), def)")],
called_id: [self.ID, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), called_id)")],
owner: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), owner)")],
)
end
def C.rb_callable_method_entry_t
@rb_callable_method_entry_t ||= CType::Struct.new(
"rb_callable_method_entry_struct", Primitive.cexpr!("SIZEOF(struct rb_callable_method_entry_struct)"),
flags: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), flags)")],
defined_class: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), defined_class)"), true],
def: [CType::Pointer.new { self.rb_method_definition_struct }, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), def)")],
called_id: [self.ID, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), called_id)")],
owner: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callable_method_entry_struct *)NULL)), owner)")],
)
end
def C.rb_callcache
@rb_callcache ||= CType::Struct.new(
"rb_callcache", Primitive.cexpr!("SIZEOF(struct rb_callcache)"),
flags: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callcache *)NULL)), flags)")],
klass: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callcache *)NULL)), klass)")],
cme_: [CType::Pointer.new { self.rb_callable_method_entry_struct }, Primitive.cexpr!("OFFSETOF((*((struct rb_callcache *)NULL)), cme_)")],
call_: [self.vm_call_handler, Primitive.cexpr!("OFFSETOF((*((struct rb_callcache *)NULL)), call_)")],
aux_: [CType::Union.new(
"", Primitive.cexpr!("SIZEOF(((struct rb_callcache *)NULL)->aux_)"),
attr: CType::Struct.new(
"", Primitive.cexpr!("SIZEOF(((struct rb_callcache *)NULL)->aux_.attr)"),
value: [CType::Immediate.parse("uintptr_t"), Primitive.cexpr!("OFFSETOF(((struct rb_callcache *)NULL)->aux_.attr, value)")],
),
method_missing_reason: self.method_missing_reason,
v: self.VALUE,
bf: CType::Pointer.new { self.rb_builtin_function },
), Primitive.cexpr!("OFFSETOF((*((struct rb_callcache *)NULL)), aux_)")],
)
end
def C.rb_callinfo
@rb_callinfo ||= CType::Struct.new(
"rb_callinfo", Primitive.cexpr!("SIZEOF(struct rb_callinfo)"),
flags: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callinfo *)NULL)), flags)")],
kwarg: [CType::Pointer.new { self.rb_callinfo_kwarg }, Primitive.cexpr!("OFFSETOF((*((struct rb_callinfo *)NULL)), kwarg)")],
mid: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callinfo *)NULL)), mid)")],
flag: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callinfo *)NULL)), flag)")],
argc: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_callinfo *)NULL)), argc)")],
)
end
def C.rb_callinfo_kwarg
@rb_callinfo_kwarg ||= CType::Struct.new(
"rb_callinfo_kwarg", Primitive.cexpr!("SIZEOF(struct rb_callinfo_kwarg)"),
keyword_len: [CType::Immediate.parse("int"), Primitive.cexpr!("OFFSETOF((*((struct rb_callinfo_kwarg *)NULL)), keyword_len)")],
references: [CType::Immediate.parse("int"), Primitive.cexpr!("OFFSETOF((*((struct rb_callinfo_kwarg *)NULL)), references)")],
keywords: [CType::Immediate.parse("void *"), Primitive.cexpr!("OFFSETOF((*((struct rb_callinfo_kwarg *)NULL)), keywords)")],
)
end
def C.rb_captured_block
@rb_captured_block ||= CType::Struct.new(
"rb_captured_block", Primitive.cexpr!("SIZEOF(struct rb_captured_block)"),
self: [self.VALUE, Primitive.cexpr!("OFFSETOF((*((struct rb_captured_block *)NULL)), self)")],
ep: [CType::Pointer.new { self.VALUE }, Primitive.cexpr!("OFFSETOF((*((struct rb_captured_block *)NULL)), ep)")],