@@ -65,9 +65,11 @@ impl JITState {
6565 }
6666}
6767
68- /// CRuby API to compile a given ISEQ
68+ /// CRuby API to compile a given ISEQ.
69+ /// If jit_exception is true, compile JIT code for handling exceptions.
70+ /// See jit_compile_exception() for details.
6971#[ unsafe( no_mangle) ]
70- pub extern "C" fn rb_zjit_iseq_gen_entry_point ( iseq : IseqPtr , _ec : EcPtr ) -> * const u8 {
72+ pub extern "C" fn rb_zjit_iseq_gen_entry_point ( iseq : IseqPtr , jit_exception : bool ) -> * const u8 {
7173 // Do not test the JIT code in HIR tests
7274 if cfg ! ( test) {
7375 return std:: ptr:: null ( ) ;
@@ -77,11 +79,12 @@ pub extern "C" fn rb_zjit_iseq_gen_entry_point(iseq: IseqPtr, _ec: EcPtr) -> *co
7779 // with_vm_lock() does nothing if the program doesn't use Ractors.
7880 with_vm_lock ( src_loc ! ( ) , || {
7981 let cb = ZJITState :: get_code_block ( ) ;
80- let mut code_ptr = with_time_stat ( compile_time_ns, || gen_iseq_entry_point ( cb, iseq) ) ;
82+ let mut code_ptr = with_time_stat ( compile_time_ns, || gen_iseq_entry_point ( cb, iseq, jit_exception ) ) ;
8183
8284 if let Err ( err) = & code_ptr {
83- // Assert that the ISEQ compiles if RubyVM::ZJIT.assert_compiles is enabled
84- if ZJITState :: assert_compiles_enabled ( ) {
85+ // Assert that the ISEQ compiles if RubyVM::ZJIT.assert_compiles is enabled.
86+ // We assert only `jit_exception: false` cases until we support exception handlers.
87+ if ZJITState :: assert_compiles_enabled ( ) && !jit_exception {
8588 let iseq_location = iseq_get_location ( iseq, 0 ) ;
8689 panic ! ( "Failed to compile: {iseq_location}" ) ;
8790 }
@@ -102,7 +105,12 @@ pub extern "C" fn rb_zjit_iseq_gen_entry_point(iseq: IseqPtr, _ec: EcPtr) -> *co
102105}
103106
104107/// Compile an entry point for a given ISEQ
105- fn gen_iseq_entry_point ( cb : & mut CodeBlock , iseq : IseqPtr ) -> Result < CodePtr , CompileError > {
108+ fn gen_iseq_entry_point ( cb : & mut CodeBlock , iseq : IseqPtr , jit_exception : bool ) -> Result < CodePtr , CompileError > {
109+ // We don't support exception handlers yet
110+ if jit_exception {
111+ return Err ( CompileError :: ExceptionHandler ) ;
112+ }
113+
106114 // Compile ISEQ into High-level IR
107115 let function = compile_iseq ( iseq) . inspect_err ( |_| {
108116 incr_counter ! ( failed_iseq_count) ;
0 commit comments