@@ -43,51 +43,51 @@ use rb_sys::{
4343} ;
4444
4545struct InternedSymbols {
46- to_s_id : ID ,
47- local_variables_id : ID ,
48- local_variable_get_id : ID ,
49- instance_method_id : ID ,
50- parameters_id : ID ,
51- class_id : ID ,
52- to_a_id : ID ,
53- begin_id : ID ,
54- end_id : ID ,
55- to_i_id : ID ,
56- nsec_id : ID ,
57- source_id : ID ,
58- options_id : ID ,
59- members_id : ID ,
60- values_id : ID ,
61- to_h_id : ID ,
62- instance_variables_id : ID ,
63- instance_variable_get_id : ID ,
64- set_const_id : ID ,
65- open_struct_const_id : ID ,
46+ to_s : ID ,
47+ local_variables : ID ,
48+ local_variable_get : ID ,
49+ instance_method : ID ,
50+ parameters : ID ,
51+ class : ID ,
52+ to_a : ID ,
53+ begin : ID ,
54+ end : ID ,
55+ to_i : ID ,
56+ nsec : ID ,
57+ source : ID ,
58+ options : ID ,
59+ members : ID ,
60+ values : ID ,
61+ to_h : ID ,
62+ instance_variables : ID ,
63+ instance_variable_get : ID ,
64+ set_const : ID ,
65+ open_struct_const : ID ,
6666}
6767
6868impl InternedSymbols {
6969 unsafe fn new ( ) -> InternedSymbols {
7070 InternedSymbols {
71- to_s_id : rb_intern ! ( "to_s" ) ,
72- local_variables_id : rb_intern ! ( "local_variables" ) ,
73- local_variable_get_id : rb_intern ! ( "local_variable_get" ) ,
74- instance_method_id : rb_intern ! ( "instance_method" ) ,
75- parameters_id : rb_intern ! ( "parameters" ) ,
76- class_id : rb_intern ! ( "class" ) ,
77- to_a_id : rb_intern ! ( "to_a" ) ,
78- begin_id : rb_intern ! ( "begin" ) ,
79- end_id : rb_intern ! ( "end" ) ,
80- to_i_id : rb_intern ! ( "to_i" ) ,
81- nsec_id : rb_intern ! ( "nsec" ) ,
82- source_id : rb_intern ! ( "source" ) ,
83- options_id : rb_intern ! ( "options" ) ,
84- members_id : rb_intern ! ( "members" ) ,
85- values_id : rb_intern ! ( "values" ) ,
86- to_h_id : rb_intern ! ( "to_h" ) ,
87- instance_variables_id : rb_intern ! ( "instance_variables" ) ,
88- instance_variable_get_id : rb_intern ! ( "instance_variable_get" ) ,
89- set_const_id : rb_intern ! ( "Set" ) ,
90- open_struct_const_id : rb_intern ! ( "OpenStruct" ) ,
71+ to_s : rb_intern ! ( "to_s" ) ,
72+ local_variables : rb_intern ! ( "local_variables" ) ,
73+ local_variable_get : rb_intern ! ( "local_variable_get" ) ,
74+ instance_method : rb_intern ! ( "instance_method" ) ,
75+ parameters : rb_intern ! ( "parameters" ) ,
76+ class : rb_intern ! ( "class" ) ,
77+ to_a : rb_intern ! ( "to_a" ) ,
78+ begin : rb_intern ! ( "begin" ) ,
79+ end : rb_intern ! ( "end" ) ,
80+ to_i : rb_intern ! ( "to_i" ) ,
81+ nsec : rb_intern ! ( "nsec" ) ,
82+ source : rb_intern ! ( "source" ) ,
83+ options : rb_intern ! ( "options" ) ,
84+ members : rb_intern ! ( "members" ) ,
85+ values : rb_intern ! ( "values" ) ,
86+ to_h : rb_intern ! ( "to_h" ) ,
87+ instance_variables : rb_intern ! ( "instance_variables" ) ,
88+ instance_variable_get : rb_intern ! ( "instance_variable_get" ) ,
89+ set_const : rb_intern ! ( "Set" ) ,
90+ open_struct_const : rb_intern ! ( "OpenStruct" ) ,
9191 }
9292 }
9393}
@@ -301,7 +301,7 @@ unsafe fn value_to_string(recorder: &Recorder, val: VALUE) -> Option<String> {
301301 let slice = std:: slice:: from_raw_parts ( ptr as * const u8 , len) ;
302302 return Some ( String :: from_utf8_lossy ( slice) . to_string ( ) ) ;
303303 }
304- let str_val = rb_funcall ( val, recorder. id . to_s_id , 0 ) ;
304+ let str_val = rb_funcall ( val, recorder. id . to_s , 0 ) ;
305305 let ptr = RSTRING_PTR ( str_val) ;
306306 let len = RSTRING_LEN ( str_val) as usize ;
307307 let slice = std:: slice:: from_raw_parts ( ptr as * const u8 , len) ;
@@ -321,7 +321,7 @@ unsafe fn value_to_string_safe(recorder: &Recorder, val: VALUE) -> Option<String
321321 return Some ( String :: from_utf8_lossy ( slice) . to_string ( ) ) ;
322322 }
323323 let mut state: c_int = 0 ;
324- let data = ( val, recorder. id . to_s_id ) ;
324+ let data = ( val, recorder. id . to_s ) ;
325325 let str_val = rb_protect ( Some ( call_to_s) , & data as * const _ as VALUE , & mut state) ;
326326 if state != 0 {
327327 return None ;
@@ -400,7 +400,7 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize) -> ValueRe
400400 } ;
401401 }
402402 if RB_TYPE_P ( val, rb_sys:: ruby_value_type:: RUBY_T_HASH ) {
403- let pairs = rb_funcall ( val, recorder. id . to_a_id , 0 ) ;
403+ let pairs = rb_funcall ( val, recorder. id . to_a , 0 ) ;
404404 let len = RARRAY_LEN ( pairs) as usize ;
405405 let ptr = RARRAY_CONST_PTR ( pairs) ;
406406 let mut elements = Vec :: with_capacity ( len) ;
@@ -428,8 +428,8 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize) -> ValueRe
428428 } ;
429429 }
430430 if rb_obj_is_kind_of ( val, rb_cRange) != 0 {
431- let begin_val = rb_funcall ( val, recorder. id . begin_id , 0 ) ;
432- let end_val = rb_funcall ( val, recorder. id . end_id , 0 ) ;
431+ let begin_val = rb_funcall ( val, recorder. id . begin , 0 ) ;
432+ let end_val = rb_funcall ( val, recorder. id . end , 0 ) ;
433433 return struct_value (
434434 recorder,
435435 "Range" ,
@@ -439,12 +439,12 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize) -> ValueRe
439439 ) ;
440440 }
441441 if NIL_P ( recorder. set_class ) {
442- if rb_const_defined ( rb_cObject, recorder. id . set_const_id ) != 0 {
443- recorder. set_class = rb_const_get ( rb_cObject, recorder. id . set_const_id ) ;
442+ if rb_const_defined ( rb_cObject, recorder. id . set_const ) != 0 {
443+ recorder. set_class = rb_const_get ( rb_cObject, recorder. id . set_const ) ;
444444 }
445445 }
446446 if !NIL_P ( recorder. set_class ) && rb_obj_is_kind_of ( val, recorder. set_class ) != 0 {
447- let arr = rb_funcall ( val, recorder. id . to_a_id , 0 ) ;
447+ let arr = rb_funcall ( val, recorder. id . to_a , 0 ) ;
448448 if RB_TYPE_P ( arr, rb_sys:: ruby_value_type:: RUBY_T_ARRAY ) {
449449 let len = RARRAY_LEN ( arr) as usize ;
450450 let ptr = RARRAY_CONST_PTR ( arr) ;
@@ -462,13 +462,13 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize) -> ValueRe
462462 }
463463 }
464464 if rb_obj_is_kind_of ( val, rb_cTime) != 0 {
465- let sec = rb_funcall ( val, recorder. id . to_i_id , 0 ) ;
466- let nsec = rb_funcall ( val, recorder. id . nsec_id , 0 ) ;
465+ let sec = rb_funcall ( val, recorder. id . to_i , 0 ) ;
466+ let nsec = rb_funcall ( val, recorder. id . nsec , 0 ) ;
467467 return struct_value ( recorder, "Time" , & [ "sec" , "nsec" ] , & [ sec, nsec] , depth) ;
468468 }
469469 if rb_obj_is_kind_of ( val, rb_cRegexp) != 0 {
470- let src = rb_funcall ( val, recorder. id . source_id , 0 ) ;
471- let opts = rb_funcall ( val, recorder. id . options_id , 0 ) ;
470+ let src = rb_funcall ( val, recorder. id . source , 0 ) ;
471+ let opts = rb_funcall ( val, recorder. id . options , 0 ) ;
472472 return struct_value (
473473 recorder,
474474 "Regexp" ,
@@ -480,8 +480,8 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize) -> ValueRe
480480 if rb_obj_is_kind_of ( val, rb_cStruct) != 0 {
481481 let class_name =
482482 cstr_to_string ( rb_obj_classname ( val) ) . unwrap_or_else ( || "Struct" . to_string ( ) ) ;
483- let members = rb_funcall ( val, recorder. id . members_id , 0 ) ;
484- let values = rb_funcall ( val, recorder. id . values_id , 0 ) ;
483+ let members = rb_funcall ( val, recorder. id . members , 0 ) ;
484+ let values = rb_funcall ( val, recorder. id . values , 0 ) ;
485485 if !RB_TYPE_P ( members, rb_sys:: ruby_value_type:: RUBY_T_ARRAY )
486486 || !RB_TYPE_P ( values, rb_sys:: ruby_value_type:: RUBY_T_ARRAY )
487487 {
@@ -506,18 +506,18 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize) -> ValueRe
506506 return struct_value ( recorder, & class_name, & names, & vals, depth) ;
507507 }
508508 if NIL_P ( recorder. open_struct_class ) {
509- if rb_const_defined ( rb_cObject, recorder. id . open_struct_const_id ) != 0 {
510- recorder. open_struct_class = rb_const_get ( rb_cObject, recorder. id . open_struct_const_id ) ;
509+ if rb_const_defined ( rb_cObject, recorder. id . open_struct_const ) != 0 {
510+ recorder. open_struct_class = rb_const_get ( rb_cObject, recorder. id . open_struct_const ) ;
511511 }
512512 }
513513 if !NIL_P ( recorder. open_struct_class ) && rb_obj_is_kind_of ( val, recorder. open_struct_class ) != 0
514514 {
515- let h = rb_funcall ( val, recorder. id . to_h_id , 0 ) ;
515+ let h = rb_funcall ( val, recorder. id . to_h , 0 ) ;
516516 return to_value ( recorder, h, depth - 1 ) ;
517517 }
518518 let class_name = cstr_to_string ( rb_obj_classname ( val) ) . unwrap_or_else ( || "Object" . to_string ( ) ) ;
519519 // generic object
520- let ivars = rb_funcall ( val, recorder. id . instance_variables_id , 0 ) ;
520+ let ivars = rb_funcall ( val, recorder. id . instance_variables , 0 ) ;
521521 if !RB_TYPE_P ( ivars, rb_sys:: ruby_value_type:: RUBY_T_ARRAY ) {
522522 let text = value_to_string ( recorder, val) . unwrap_or_default ( ) ;
523523 let type_id =
@@ -534,7 +534,7 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize) -> ValueRe
534534 let cstr = rb_id2name ( id) ;
535535 let name = CStr :: from_ptr ( cstr) . to_str ( ) . unwrap_or ( "?" ) ;
536536 names. push ( name) ;
537- let value = rb_funcall ( val, recorder. id . instance_variable_get_id , 1 , sym) ;
537+ let value = rb_funcall ( val, recorder. id . instance_variable_get , 1 , sym) ;
538538 vals. push ( value) ;
539539 }
540540 if !names. is_empty ( ) {
@@ -546,7 +546,7 @@ unsafe fn to_value(recorder: &mut Recorder, val: VALUE, depth: usize) -> ValueRe
546546}
547547
548548unsafe fn record_variables ( recorder : & mut Recorder , binding : VALUE ) -> Vec < FullValueRecord > {
549- let vars = rb_funcall ( binding, recorder. id . local_variables_id , 0 ) ;
549+ let vars = rb_funcall ( binding, recorder. id . local_variables , 0 ) ;
550550 if !RB_TYPE_P ( vars, rb_sys:: ruby_value_type:: RUBY_T_ARRAY ) {
551551 return Vec :: new ( ) ;
552552 }
@@ -557,7 +557,7 @@ unsafe fn record_variables(recorder: &mut Recorder, binding: VALUE) -> Vec<FullV
557557 let sym = * ptr. add ( i) ;
558558 let id = rb_sym2id ( sym) ;
559559 let name = CStr :: from_ptr ( rb_id2name ( id) ) . to_str ( ) . unwrap_or ( "" ) ;
560- let value = rb_funcall ( binding, recorder. id . local_variable_get_id , 1 , sym) ;
560+ let value = rb_funcall ( binding, recorder. id . local_variable_get , 1 , sym) ;
561561 let val_rec = to_value ( recorder, value, 10 ) ;
562562 TraceWriter :: register_variable_with_full_value (
563563 & mut * recorder. tracer ,
@@ -583,8 +583,8 @@ unsafe fn collect_parameter_values(
583583 if rb_method_boundp ( defined_class, mid, 0 ) == 0 {
584584 return Vec :: new ( ) ;
585585 }
586- let method_obj = rb_funcall ( defined_class, recorder. id . instance_method_id , 1 , method_sym) ;
587- let params_ary = rb_funcall ( method_obj, recorder. id . parameters_id , 0 ) ;
586+ let method_obj = rb_funcall ( defined_class, recorder. id . instance_method , 1 , method_sym) ;
587+ let params_ary = rb_funcall ( method_obj, recorder. id . parameters , 0 ) ;
588588 if !RB_TYPE_P ( params_ary, rb_sys:: ruby_value_type:: RUBY_T_ARRAY ) {
589589 return Vec :: new ( ) ;
590590 }
@@ -607,7 +607,7 @@ unsafe fn collect_parameter_values(
607607 continue ;
608608 }
609609 let name = CStr :: from_ptr ( name_c) . to_str ( ) . unwrap_or ( "" ) . to_string ( ) ;
610- let value = rb_funcall ( binding, recorder. id . local_variable_get_id , 1 , name_sym) ;
610+ let value = rb_funcall ( binding, recorder. id . local_variable_get , 1 , name_sym) ;
611611 let val_rec = to_value ( recorder, value, 10 ) ;
612612 result. push ( ( name, val_rec) ) ;
613613 }
@@ -810,7 +810,7 @@ unsafe extern "C" fn event_hook_raw(data: VALUE, arg: *mut rb_trace_arg_t) {
810810 let self_val = rb_tracearg_self ( arg) ;
811811 let mid_sym = rb_tracearg_callee_id ( arg) ;
812812 let mid = rb_sym2id ( mid_sym) ;
813- let defined_class = rb_funcall ( self_val, recorder. id . class_id , 0 ) ;
813+ let defined_class = rb_funcall ( self_val, recorder. id . class , 0 ) ;
814814
815815 let param_vals = if NIL_P ( binding) {
816816 Vec :: new ( )
0 commit comments