@@ -4244,6 +4244,36 @@ recording::function::replay_into (replayer *r)
42444244 m_string_attributes));
42454245}
42464246
4247+ /* Implementation of recording::memento::make_debug_string for
4248+ setting a personality function. */
4249+
4250+ recording::string *
4251+ recording::memento_of_set_personality_function::make_debug_string ()
4252+ {
4253+ return string::from_printf (m_ctxt,
4254+ " %s" ,
4255+ m_personality_function->get_debug_string ());
4256+ }
4257+
4258+ /* Implementation of recording::memento::write_reproducer for setting the personality function. */
4259+
4260+ void
4261+ recording::memento_of_set_personality_function::write_reproducer (reproducer &r)
4262+ {
4263+ r.write (" gcc_jit_function_set_personality_function (%s,\n "
4264+ " %s);\n " ,
4265+ r.get_identifier (m_function),
4266+ r.get_identifier (m_personality_function));
4267+ }
4268+
4269+ void
4270+ recording::function::set_personality_function (function *function)
4271+ {
4272+ recording::memento_of_set_personality_function *result =
4273+ new memento_of_set_personality_function (m_ctxt, this , function);
4274+ m_ctxt->record (result);
4275+ }
4276+
42474277/* Create a recording::local instance and add it to
42484278 the functions's context's list of mementos, and to the function's
42494279 list of locals.
@@ -4386,6 +4416,13 @@ recording::function::validate ()
43864416 /* Iteratively walk the graph of blocks, marking their "m_is_reachable"
43874417 flag, starting at the initial block. */
43884418 auto_vec<block *> worklist (m_blocks.length ());
4419+ int j;
4420+ block *func_block;
4421+ /* Push the blocks used in try/catch because they're not successors of
4422+ other blocks. */
4423+ FOR_EACH_VEC_ELT (m_blocks, j, func_block)
4424+ if (func_block->m_is_reachable )
4425+ worklist.safe_push (func_block);
43894426 worklist.safe_push (m_blocks[0 ]);
43904427 while (worklist.length () > 0 )
43914428 {
@@ -4581,6 +4618,27 @@ recording::block::add_eval (recording::location *loc,
45814618 return result;
45824619}
45834620
4621+ /* The implementation of class gcc::jit::recording::block. */
4622+
4623+ /* Create a recording::try_catch instance and add it to
4624+ the block's context's list of mementos, and to the block's
4625+ list of statements.
4626+ Implements the heart of gcc_jit_block_add_try_catch. */
4627+
4628+ recording::statement *
4629+ recording::block::add_try_catch (location *loc,
4630+ block *try_block,
4631+ block *catch_block,
4632+ bool is_finally)
4633+ {
4634+ statement *result = new try_catch (this , loc, try_block, catch_block, is_finally);
4635+ try_block->m_is_reachable = true ;
4636+ catch_block->m_is_reachable = true ;
4637+ m_ctxt->record (result);
4638+ m_statements.safe_push (result);
4639+ return result;
4640+ }
4641+
45844642/* Create a recording::assignment instance and add it to
45854643 the block's context's list of mementos, and to the block's
45864644 list of statements.
@@ -6997,6 +7055,17 @@ recording::statement::write_to_dump (dump &d)
69977055 m_loc = d.make_location ();
69987056}
69997057
7058+ /* The implementation of class gcc::jit::recording::memento_of_set_personality_function. */
7059+
7060+ /* Implementation of pure virtual hook recording::memento::replay_into
7061+ for recording::memento_of_set_personality_function. */
7062+
7063+ void
7064+ recording::memento_of_set_personality_function::replay_into (replayer *r)
7065+ {
7066+ m_function->playback_function ()->set_personality_function (m_personality_function->playback_function ());
7067+ }
7068+
70007069/* The implementation of class gcc::jit::recording::eval. */
70017070
70027071/* Implementation of pure virtual hook recording::memento::replay_into
@@ -7035,6 +7104,59 @@ recording::eval::write_reproducer (reproducer &r)
70357104 r.get_identifier_as_rvalue (m_rvalue));
70367105}
70377106
7107+ /* The implementation of class gcc::jit::recording::try_catch. */
7108+
7109+ /* Implementation of pure virtual hook recording::memento::replay_into
7110+ for recording::try_catch. */
7111+
7112+ void
7113+ recording::try_catch::replay_into (replayer *r)
7114+ {
7115+ playback_block (get_block ())
7116+ ->add_try_catch (playback_location (r),
7117+ m_try_block->playback_block (),
7118+ m_catch_block->playback_block (),
7119+ m_is_finally);
7120+ }
7121+
7122+ /* Implementation of recording::memento::make_debug_string for
7123+ an eval statement. */
7124+
7125+ recording::string *
7126+ recording::try_catch::make_debug_string ()
7127+ {
7128+ if (m_is_finally)
7129+ return string::from_printf (m_ctxt,
7130+ " try { %s } finally { %s };" ,
7131+ m_try_block->get_debug_string (),
7132+ m_catch_block->get_debug_string ());
7133+ else
7134+ return string::from_printf (m_ctxt,
7135+ " try { %s } catch { %s };" ,
7136+ m_try_block->get_debug_string (),
7137+ m_catch_block->get_debug_string ());
7138+ }
7139+
7140+ /* Implementation of recording::memento::write_reproducer for
7141+ eval statements. */
7142+
7143+ void
7144+ recording::try_catch::write_reproducer (reproducer &r)
7145+ {
7146+ const char *func_name = " gcc_jit_block_add_try_catch" ;
7147+ if (m_is_finally)
7148+ func_name = " gcc_jit_block_add_try_finally" ;
7149+ r.write (" %s (%s, /*gcc_jit_block *block */\n "
7150+ " %s, /* gcc_jit_location *loc */\n "
7151+ " %s, /* gcc_jit_block *try_block */\n "
7152+ " %s); /* gcc_jit_block *catch_block */\n " ,
7153+ func_name,
7154+ r.get_identifier (get_block ()),
7155+ r.get_identifier (get_loc ()),
7156+ r.get_identifier (m_try_block),
7157+ r.get_identifier (m_catch_block));
7158+ }
7159+
70387160/* The implementation of class gcc::jit::recording::assignment. */
70397161
70407162/* Implementation of pure virtual hook recording::memento::replay_into
0 commit comments