@@ -4244,6 +4244,36 @@ recording::function::replay_into (replayer *r)
4244
4244
m_string_attributes));
4245
4245
}
4246
4246
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
+
4247
4277
/* Create a recording::local instance and add it to
4248
4278
the functions's context's list of mementos, and to the function's
4249
4279
list of locals.
@@ -4386,6 +4416,13 @@ recording::function::validate ()
4386
4416
/* Iteratively walk the graph of blocks, marking their "m_is_reachable"
4387
4417
flag, starting at the initial block. */
4388
4418
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);
4389
4426
worklist.safe_push (m_blocks[0 ]);
4390
4427
while (worklist.length () > 0 )
4391
4428
{
@@ -4581,6 +4618,28 @@ recording::block::add_eval (recording::location *loc,
4581
4618
return result;
4582
4619
}
4583
4620
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
+ // TODO: explain why we set the blocks reachable state.
4636
+ try_block->m_is_reachable = true ;
4637
+ catch_block->m_is_reachable = true ;
4638
+ m_ctxt->record (result);
4639
+ m_statements.safe_push (result);
4640
+ return result;
4641
+ }
4642
+
4584
4643
/* Create a recording::assignment instance and add it to
4585
4644
the block's context's list of mementos, and to the block's
4586
4645
list of statements.
@@ -6997,6 +7056,17 @@ recording::statement::write_to_dump (dump &d)
6997
7056
m_loc = d.make_location ();
6998
7057
}
6999
7058
7059
+ /* The implementation of class gcc::jit::recording::memento_of_set_personality_function. */
7060
+
7061
+ /* Implementation of pure virtual hook recording::memento::replay_into
7062
+ for recording::memento_of_set_personality_function. */
7063
+
7064
+ void
7065
+ recording::memento_of_set_personality_function::replay_into (replayer *r)
7066
+ {
7067
+ m_function->playback_function ()->set_personality_function (m_personality_function->playback_function ());
7068
+ }
7069
+
7000
7070
/* The implementation of class gcc::jit::recording::eval. */
7001
7071
7002
7072
/* Implementation of pure virtual hook recording::memento::replay_into
@@ -7035,6 +7105,59 @@ recording::eval::write_reproducer (reproducer &r)
7035
7105
r.get_identifier_as_rvalue (m_rvalue));
7036
7106
}
7037
7107
7108
+ /* The implementation of class gcc::jit::recording::try_catch. */
7109
+
7110
+ /* Implementation of pure virtual hook recording::memento::replay_into
7111
+ for recording::try_catch. */
7112
+
7113
+ void
7114
+ recording::try_catch::replay_into (replayer *r)
7115
+ {
7116
+ playback_block (get_block ())
7117
+ ->add_try_catch (playback_location (r),
7118
+ m_try_block->playback_block (),
7119
+ m_catch_block->playback_block (),
7120
+ m_is_finally);
7121
+ }
7122
+
7123
+ /* Implementation of recording::memento::make_debug_string for
7124
+ an eval statement. */
7125
+
7126
+ recording::string *
7127
+ recording::try_catch::make_debug_string ()
7128
+ {
7129
+ if (m_is_finally)
7130
+ return string::from_printf (m_ctxt,
7131
+ " try { %s } finally { %s };" ,
7132
+ m_try_block->get_debug_string (),
7133
+ m_catch_block->get_debug_string ());
7134
+ else
7135
+ return string::from_printf (m_ctxt,
7136
+ " try { %s } catch { %s };" ,
7137
+ m_try_block->get_debug_string (),
7138
+ m_catch_block->get_debug_string ());
7139
+ }
7140
+
7141
+ /* Implementation of recording::memento::write_reproducer for
7142
+ eval statements. */
7143
+
7144
+ void
7145
+ recording::try_catch::write_reproducer (reproducer &r)
7146
+ {
7147
+ const char *func_name = " gcc_jit_block_add_try_catch" ;
7148
+ if (m_is_finally)
7149
+ func_name = " gcc_jit_block_add_try_finally" ;
7150
+ r.write (" %s (%s, /*gcc_jit_block *block */\n "
7151
+ " %s, /* gcc_jit_location *loc */\n "
7152
+ " %s, /* gcc_jit_block *try_block */\n "
7153
+ " %s); /* gcc_jit_block *catch_block */\n " ,
7154
+ func_name,
7155
+ r.get_identifier (get_block ()),
7156
+ r.get_identifier (get_loc ()),
7157
+ r.get_identifier (m_try_block),
7158
+ r.get_identifier (m_catch_block));
7159
+ }
7160
+
7038
7161
/* The implementation of class gcc::jit::recording::assignment. */
7039
7162
7040
7163
/* Implementation of pure virtual hook recording::memento::replay_into
0 commit comments