@@ -283,6 +283,7 @@ pub fn init() -> Annotations {
283283 builtin_funcs. insert ( rb_jit_ary_at_end as * mut c_void , FnProperties { inline : inline_ary_at_end, return_type : types:: BoolExact , ..Default :: default ( ) } ) ;
284284
285285 // RubyVM::ZJIT directive methods
286+ assert ! ( builtin_funcs. insert( rb_zjit_induce_compile_failure as * mut c_void, FnProperties { inline: inline_induce_compile_failure, ..Default :: default ( ) } ) . is_none( ) ) ;
286287 assert ! ( builtin_funcs. insert( rb_zjit_induce_side_exit as * mut c_void, FnProperties { inline: inline_induce_side_exit, ..Default :: default ( ) } ) . is_none( ) ) ;
287288
288289 Annotations {
@@ -291,6 +292,15 @@ pub fn init() -> Annotations {
291292 }
292293}
293294
295+ // The compiler/linker can give two identical functions the same address, so we do this dance
296+ // to make sure the function's address is different from rb_zjit_induce_side_exit
297+ pub static mut NIL : VALUE = Qnil ;
298+ #[ unsafe( no_mangle) ]
299+ pub extern "C" fn rb_zjit_induce_compile_failure ( _ec : EcPtr , _ruby_self : VALUE ) -> VALUE {
300+ std:: hint:: black_box ( & raw const NIL ) ;
301+ unsafe { NIL }
302+ }
303+
294304#[ unsafe( no_mangle) ]
295305pub extern "C" fn rb_zjit_induce_side_exit ( _ec : EcPtr , _ruby_self : VALUE ) -> VALUE {
296306 Qnil
@@ -953,6 +963,12 @@ fn inline_ary_at_end(fun: &mut hir::Function, block: hir::BlockId, _recv: hir::I
953963 Some ( result)
954964}
955965
966+ /// For `RubyVM::ZJIT.induce_compile_failure!`
967+ fn inline_induce_compile_failure ( fun : & mut hir:: Function , block : hir:: BlockId , _recv : hir:: InsnId , _args : & [ hir:: InsnId ] , _state : hir:: InsnId ) -> Option < hir:: InsnId > {
968+ fun. fail_to_compile_at_the_end = true ;
969+ Some ( fun. push_insn ( block, hir:: Insn :: Const { val : hir:: Const :: Value ( Qnil ) } ) )
970+ }
971+
956972/// For `RubyVM::ZJIT.induce_side_exit!`
957973fn inline_induce_side_exit ( fun : & mut hir:: Function , block : hir:: BlockId , _recv : hir:: InsnId , _args : & [ hir:: InsnId ] , state : hir:: InsnId ) -> Option < hir:: InsnId > {
958974 Some ( fun. push_insn ( block, hir:: Insn :: SideExit { reason : hir:: SideExitReason :: DirectiveInduced , state } ) )
0 commit comments