1 2014-12-10 David Malcolm <dmalcolm@redhat.com>
3 * docs/cp/index.rst: New file.
4 * docs/cp/intro/index.rst: New file.
5 * docs/cp/intro/tutorial01.rst: New file.
6 * docs/cp/intro/tutorial02.rst: New file.
7 * docs/cp/intro/tutorial03.rst: New file.
8 * docs/cp/intro/tutorial04.rst: New file.
9 * docs/cp/topics/contexts.rst: New file.
10 * docs/cp/topics/expressions.rst: New file.
11 * docs/cp/topics/functions.rst: New file.
12 * docs/cp/topics/index.rst: New file.
13 * docs/cp/topics/locations.rst: New file.
14 * docs/cp/topics/objects.rst: New file.
15 * docs/cp/topics/results.rst: New file.
16 * docs/cp/topics/types.rst: New file.
17 * docs/examples/tut01-hello-world.cc: New file.
18 * docs/examples/tut02-square.c: Fix missing newline in output.
19 * docs/examples/tut02-square.cc: New file.
20 * docs/examples/tut03-sum-of-squares.cc: New file.
21 * docs/examples/tut04-toyvm/toyvm.cc: New file.
22 * docs/index.rst: Move summary to above the table of contents.
23 Add text about the C vs C++ APIs.
24 * docs/topics/contexts.rst: Fix a typo.
26 * docs/_build/texinfo/libgccjit.texi: Regenerate.
27 * docs/_build/texinfo/factorial1.png: New file.
28 * docs/_build/texinfo/sum-of-squares1.png: New file.
30 2014-12-09 David Malcolm <dmalcolm@redhat.com>
32 * docs/examples/tut04-toyvm/toyvm.c (toyvm_function_compile): Move
33 logic for determine "funcname" to new function...
34 (get_function_name): ...here, adding logic to skip any leading
35 path from the filename.
36 (toyvm_function_parse): Use the filename for fn_filename, rather
37 than "name", so that the debugger can locate the source .toy
39 (toyvm_function_parse): Don't fclose a NULL FILE *.
41 2014-12-09 David Malcolm <dmalcolm@redhat.com>
44 * docs/internals/index.rst (Running under valgrind): New
46 (docs/_build/texinfo/libgccjit.texi): Regenerate.
48 2014-12-09 David Malcolm <dmalcolm@redhat.com>
51 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o.
52 * jit-common.h (gcc::jit::tempdir): New forward decl.
53 * jit-playback.c: Include jit-tempdir.h.
54 (gcc::jit::playback::context::context): Initialize m_tempdir.
55 (gcc::jit::playback::context::~context): Move tempdir
56 cleanup to new file jit-tempdir.c
57 (make_tempdir_path_template): Move to new file jit-tempdir.c.
58 (gcc::jit::playback::context::compile): Move tempdir creation
59 to new tempdir object in new file jit-tempdir.c.
60 (gcc::jit::playback::context::make_fake_args): Get path from
61 tempdir object rather than from member data.
62 (gcc::jit::playback::context::convert_to_dso): Likewise.
63 (gcc::jit::playback::context::dlopen_built_dso): Likewise.
64 (gcc::jit::playback::context::dump_generated_code): Likewise.
65 (gcc::jit::playback::context::get_path_c_file): New function.
66 (gcc::jit::playback::context::get_path_s_file): New function.
67 (gcc::jit::playback::context::get_path_so_file): New function.
68 * jit-playback.h (gcc::jit::playback::context::get_path_c_file):
70 (gcc::jit::playback::context::get_path_s_file): New function.
71 (gcc::jit::playback::context::get_path_so_file): New function.
72 (gcc::jit::playback::context): Move fields "m_path_template",
73 "m_path_tempdir", "m_path_c_file", "m_path_s_file",
74 "m_path_so_file" to new jit::tempdir class; add field "m_tempdir".
75 * jit-tempdir.c: New file.
76 * jit-tempdir.h: New file.
78 2014-12-09 David Malcolm <dmalcolm@redhat.com>
80 * jit-playback.c (gcc::jit::playback::context::compile): Acquire the
81 mutex here, immediately before using toplev, and release it here, on
82 each exit path after acquisition.
83 (jit_mutex): Move this variable here, from jit-recording.c.
84 (gcc::jit::playback::context::acquire_mutex): New function, based on
85 code in jit-recording.c.
86 (gcc::jit::playback::context::release_mutex): Likewise.
87 * jit-playback.h (gcc::jit::playback::context::acquire_mutex): New
89 (gcc::jit::playback::context::release_mutex): New function.
90 * jit-recording.c (jit_mutex): Move this variable to jit-playback.c.
91 (gcc::jit::recording::context::compile): Move mutex-handling from
92 here into jit-playback.c's gcc::jit::playback::context::compile.
93 * notes.txt: Update to show the new locations of ACQUIRE_MUTEX
96 2014-12-09 David Malcolm <dmalcolm@redhat.com>
98 * jit-playback.c (gcc::jit::playback::context::compile): Move the
100 (gcc::jit::playback::context::dlopen_built_dso): ...this new
102 * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
105 2014-12-09 David Malcolm <dmalcolm@redhat.com>
108 * docs/topics/contexts.rst (Debugging): Add description of
109 gcc_jit_context_enable_dump.
110 * docs/_build/texinfo/libgccjit.texi: Regenerate.
111 * jit-playback.c: Include context.h.
112 (class auto_argvec): New class.
113 (auto_argvec::~auto_argvec): New function.
114 (gcc::jit::playback::context::compile): Convert fake_args to be
115 an auto_argvec, so that it can contain dynamically-allocated
116 strings. Construct a vec of all requested dumps, and pass it to
117 make_fake_args. Extract requested dumps between the calls to
118 toplev::main and toplev::finalize.
119 (gcc::jit::playback::context::make_fake_args): Convert param
120 "argvec" to be a vec <char *>, and gain a "requested_dumps"
121 param. Convert to dynamically-allocated arg strings by converting
122 ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
123 for args that are already a copy. Add args for all requested dumps.
124 (gcc::jit::playback::context::extract_any_requested_dumps): New
126 (gcc::jit::playback::context::read_dump_file): New function.
127 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
128 Convert param "argvec" to be a vec <char *>, and gain a
129 "requested_dumps" param.
130 (gcc::jit::playback::context::extract_any_requested_dumps): New
132 (gcc::jit::playback::context::read_dump_file): New function.
133 * jit-recording.c (gcc::jit::recording::context::enable_dump): New
135 (gcc::jit::recording::context::get_all_requested_dumps): New
137 * jit-recording.h (gcc::jit::recording::requested_dump): New
139 (gcc::jit::recording::context::enable_dump): New function.
140 (gcc::jit::recording::context::get_all_requested_dumps): New
142 (gcc::jit::recording::context::m_requested_dumps): New field.
143 * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
144 * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
145 * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
147 2014-12-08 David Malcolm <dmalcolm@redhat.com>
149 * libgccjit++.h: Indent the forward declarations of the classes to
150 show the inheritance hierarchy.
152 2014-12-08 David Malcolm <dmalcolm@redhat.com>
154 * notes.txt: Show the beginning and ending of
155 recording::context::compile vs playback::context::compile. Show
156 the creation and unlinking of the tempdir. Show toplev::finalize.
157 Move "RELEASE MUTEX" to the correct location. Show
158 gcc_jit_result_release, and indicate where the
159 dlopen/dlsym/dlclose occur.
161 2014-12-01 David Malcolm <dmalcolm@redhat.com>
163 * docs/examples/tut02-square.c (main): Release the context
164 earlier, to show that this is possible. Update error-handling
165 to avoid a double-release of the context, and to avoid
166 releasing a NULL result.
167 * docs/intro/tutorial02.rst: Discuss gcc_jit_context_release.
168 * docs/topics/functions.rst (GCC_JIT_FUNCTION_EXPORTED): Emphasize
169 * docs/topics/results.rst (gcc_jit_result): Mention that this
170 controls the lifetimes of machine code functions.
171 (gcc_jit_result_get_code): Spell out the requirements for this
172 to succeed, and the lifetime of the result.
173 (gcc_jit_result_release): Mention that this invalidates any code
174 that was obtained from the result.
175 * docs/_build/texinfo/libgccjit.texi: Regenerate.
177 2014-12-01 David Malcolm <dmalcolm@redhat.com>
180 * docs/intro/tutorial02.rst: Spell out lifetime of generated code.
181 Add description of error-handling, taken in part from...
182 * docs/topics/contexts.rst (Error-handling): Expand, and move some
183 content to tutorial02.rst.
184 * docs/_build/texinfo/libgccjit.texi: Regenerate.
186 2014-12-01 David Malcolm <dmalcolm@redhat.com>
189 * docs/topics/types.rst (Standard types) Add new enum values to
190 the table of enum gcc_jit_types: GCC_JIT_TYPE_COMPLEX_FLOAT,
191 GCC_JIT_TYPE_COMPLEX_DOUBLE, GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
192 Widen the left-hand column so that
193 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE will fit.
194 * docs/_build/texinfo/libgccjit.texi: Regenerate.
196 * jit-builtins.c: Include stringpool.h and jit-playback.h.
197 Move everything out of the gcc::jit::recording namespace into
199 (struct builtin_data): Add fields "fnclass", "attr", and
201 (DEF_BUILTIN): Update macro so populate the new fields.
202 (builtins_manager::builtins_manager): Update for move out of
203 recording namespace. Initialize the m_attributes array.
204 (builtins_manager::get_builtin_function): Likewise.
205 (builtins_manager::get_builtin_function_by_id): New function.
206 (builtins_manager::make_builtin_function): Update for move out of
207 recording namespace. Add fix for PR jit/64020 by detecting
208 specific builtin ids and having them ensure that builtins for
209 other ids are created as necessary.
210 (builtins_manager::get_type): Update for move out of recording
212 (builtins_manager::make_type): Likewise. Add some missing
214 (builtins_manager::make_primitive_type): Update for move out of
215 recording namespace. Implement the three BT_COMPLEX_ cases and
217 (builtins_manager::make_fn_type): Update for move out of recording
219 (builtins_manager::make_ptr_type): Likewise.
220 (builtins_manager::finish_playback): New function.
221 (builtins_manager::get_class): New function.
222 (builtins_manager::implicit_p): New function.
223 (builtins_manager::get_attrs_tree): Two new functions.
224 (builtins_manager::make_attrs_tree): New function.
226 * jit-builtins.h: Move everything out of the gcc::jit::recording
227 namespace into just gcc::jit.
228 (enum built_in_attribute): New.
229 (builtins_manager::builtins_manager): Update decl for namespace
231 (builtins_manager::get_builtin_function): Likewise.
232 (builtins_manager::get_class): New.
233 (builtins_manager::implicit_p): New.
234 (builtins_manager::get_attrs_tree): Two new functions.
235 (builtins_manager::make_attrs_tree): New function.
236 (builtins_manager::finish_playback): New.
237 (builtins_manager::get_builtin_function_by_id): New.
238 (builtins_manager::make_builtin_function): Update decl for
240 (builtins_manager::get_type): Likewise.
241 (builtins_manager::make_type): Likewise.
242 (builtins_manager::make_primitive_type): Likewise.
243 (builtins_manager::make_fn_type): Likewise.
244 (builtins_manager::make_ptr_type): Likewise.
245 (builtins_manager): Likewise for fields. Add new field
248 * jit-common.h (NUM_GCC_JIT_TYPES): Update.
249 (builtins_manager): Update forward decl to reflect namespace
252 * jit-playback.c: Include attribs.h and jit-builtins.h.
253 (gcc::jit::playback::context::get_tree_node_for_type): Add cases
254 for the new COMPLEX_ types.
255 (gcc::jit::playback::context::new_function): If creating a
256 builtin, set the DECL_BUILT_IN_CLASS and attributes on the fndecl,
257 and call set_builtin_decl.
258 (gcc::jit::playback::context::replay): If we have a
259 builtins_manager, call its finish_playback method when we're done.
262 (gcc::jit::playback::context::get_builtins_manager): New function.
265 (gcc::jit::recording::context::get_builtins_manager): New function.
266 (gcc::jit::recording::get_builtin_function): Use
267 get_builtins_manager, in case we're a child context.
268 (gcc::jit::recording::memento_of_get_type::dereference): Add the
270 (gcc::jit::recording::memento_of_get_type::is_int): Likewise.
271 (gcc::jit::recording::memento_of_get_type::is_float): Likewise.
272 (gcc::jit::recording::memento_of_get_type::is_bool): Likewise.
273 (get_type_strings): Likewise.
276 (gcc::jit::recording::context::get_builtins_manager): New.
278 * libgccjit.h (enum gcc_jit_types): Add
279 GCC_JIT_TYPE_COMPLEX_FLOAT, GCC_JIT_TYPE_COMPLEX_DOUBLE,
280 GCC_JIT_TYPE_COMPLEX_LONG_DOUBLE.
282 2014-12-01 David Malcolm <dmalcolm@redhat.com>
285 (gcc::jit::recording::builtins_manager::get_builtin_function):
286 Check for NULL return from make_builtin_function.
287 (gcc::jit::recording::builtins_manager::make_builtin_function):
288 Check for NULL return from get_type.
290 2014-12-01 David Malcolm <dmalcolm@redhat.com>
292 * jit-playback.c (gcc::jit::playback::context::compile): Move DSO
293 creation code into...
294 (gcc::jit::playback::context::convert_to_dso): New function.
295 * jit-playback.h (gcc::jit::playback::context::convert_to_dso):
298 2014-12-01 David Malcolm <dmalcolm@redhat.com>
300 * jit-playback.c (gcc::jit::playback::context::compile): Use an
301 auto_vec<const char *> rather than a const char *[20] for the
302 top-level argv, and move the logic to build it to...
303 (gcc::jit::playback::context::make_fake_args): New function.
304 * jit-playback.h (gcc::jit::playback::context::make_fake_args):
307 2014-12-01 David Malcolm <dmalcolm@redhat.com>
309 * Make-lang.in (jit_OBJS): Add jit/jit-result.o.
310 * jit-playback.c: Include new header jit-result.h.
311 (gcc::jit::result::result): Move to new file jit-result.c.
312 (gcc::jit::result::~result): Likewise.
313 (gcc::jit::playback::result): Likewise.
314 * jit-recording.h (class gcc::jit::result): Move to new
316 * jit-result.c: New file, to contain...
317 (gcc::jit::result::result): Move here from jit-playback.c,
318 removing erroneous "playback" namespace from comment.
319 (gcc::jit::result::~result): Likewise.
320 (gcc::jit::playback::result): Likewise.
321 * jit-result.h: New file, to contain...
322 (class gcc::jit::result): Move from jit-recording.h.
323 * libgccjit.c: Include jit-result.h.
324 (gcc_jit_result_get_code): Update comment to reflect move
326 (gcc_jit_result_release): Likewise.
328 2014-12-01 David Malcolm <dmalcolm@redhat.com>
331 * docs/examples/tut04-toyvm/toyvm.c
332 (toyvm_compiled_function): New typedef.
333 (toyvm_compiled_func) Rename to...
334 (toyvm_compiled_code) ...this.
335 (struct toyvm_compiled_function): New struct.
336 (toyvm_function_compile): Return a toyvm_compiled_function *
337 rather than a toyvm_compiled_func, so that the caller can fully
338 clean things up. Free "funcname".
339 (test_script): Update for change to toyvm_function_compile.
340 Clean up the toyvm_compiled_function.
342 (docs/intro/tutorial04.rst): Update to reflect the above changes,
343 and to better spell out the lifetime of the compiled code.
345 2014-12-01 David Malcolm <dmalcolm@redhat.com>
349 (gcc::jit::recording::builtins_manager::make_fn_type): Call the
350 context's new_function_type method, rather than directly creating
351 a function_type instance.
353 (gcc::jit::recording::context::new_function_type): New method,
354 adapted from part of...
355 (gcc::jit::recording::context::new_function_ptr_type): ...this.
356 Update to call new_function_type.
358 (gcc::jit::recording::context::new_function_type): New method.
360 2014-12-01 David Malcolm <dmalcolm@redhat.com>
363 * jit-playback.c: Ensure that ctxt_progname is non-NULL.
365 2014-11-19 David Malcolm <dmalcolm@redhat.com>
368 * jit-playback.c (gcc::jit::playback::compound_type::set_fields):
369 Convert param from const vec<playback::field *> & to
370 const auto_vec<playback::field *> *.
371 (gcc::jit::playback::context::new_function_type): Convert param
372 "param_types" from vec<type *> * to const auto_vec<type *> *.
373 (gcc::jit::playback::context::new_function): Convert param
374 "params" from vec<param *> * to const auto_vec<param *> *.
375 (gcc::jit::playback::context::build_call): Convert param "args"
376 from vec<rvalue *> to const auto_vec<rvalue *> *.
377 (gcc::jit::playback::context::new_call): Likewise.
378 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
379 (wrapper_finalizer): New function.
380 (gcc::jit::playback::wrapper::operator new): Call the finalizer
381 variant of ggc_internal_cleared_alloc, supplying
383 (gcc::jit::playback::function::finalizer): New.
384 (gcc::jit::playback::block::finalizer): New.
385 (gcc::jit::playback::source_file::finalizer): New.
386 (gcc::jit::playback::source_line::finalizer): New.
389 (gcc::jit::playback::context::new_function_type): Convert param
390 "param_types" from vec<type *> * to const auto_vec<type *> *.
391 (gcc::jit::playback::context::new_function): Convert param
392 "params" from vec<param *> * to const auto_vec<param *> *.
393 (gcc::jit::playback::context::new_call): Convert param
394 "args" from vec<rvalue *> to const auto_vec<rvalue *> *.
395 (gcc::jit::playback::context::new_call_through_ptr): Likewise.
396 (gcc::jit::playback::context::build_call): Likewise.
397 (gcc::jit::playback::context): Convert fields "m_functions",
398 "m_source_files", "m_cached_locations" from vec to auto_vec.
399 (gcc::jit::playback::wrapper::finalizer): New virtual function.
400 (gcc::jit::playback::compound_type::set_fields): Convert param fro
401 const vec<playback::field *> & to
402 const auto_vec<playback::field *> *.
403 (gcc::jit::playback::function::finalizer): New.
404 (gcc::jit::playback::block::finalizer): New.
405 (gcc::jit::playback::source_file::finalizer): New.
406 (gcc::jit::playback::source_line::finalizer): New.
409 (gcc::jit::recording::function_type::replay_into): Convert local
410 from a vec into an auto_vec.
411 (gcc::jit::recording::fields::replay_into): Likewise.
412 (gcc::jit::recording::function::replay_into): Likewise.
413 (gcc::jit::recording::call::replay_into): Likewise.
414 (gcc::jit::recording::call_through_ptr::replay_into): Likewise.
416 * jit-recording.h (gcc::jit::recording::context): Convert fields
417 "m_mementos", "m_compound_types", "m_functions" from vec<> to
419 (gcc::jit::recording::function_type::get_param_types): Convert
420 return type from vec<type *> to const vec<type *> &.
421 (gcc::jit::recording::function_type): Convert field
422 "m_param_types" from a vec<> to an auto_vec<>.
423 (gcc::jit::recording::fields): Likewise for field "m_fields".
424 (gcc::jit::recording::function::get_params): Convert return type
425 from vec <param *> to const vec<param *> &.
426 (gcc::jit::recording::function): Convert fields "m_params",
427 "m_locals", "m_blocks" from vec<> to auto_vec<>.
428 (gcc::jit::recording::block): Likewise for field "m_statements".
430 (gcc::jit::recording::call): Likewise for field "m_args".
431 (gcc::jit::recording::call_through_ptr): Likewise.
433 2014-11-19 David Malcolm <dmalcolm@redhat.com>
436 * jit-recording.c (recording::function::validate): Convert
437 "worklist" from vec<> to autovec<> to fix a leak.
439 2014-11-11 David Malcolm <dmalcolm@redhat.com>
441 * ChangeLog.jit: New.
445 * config-lang.in: New.
446 * docs/Makefile: New.
447 * docs/_build/texinfo/Makefile: New.
448 * docs/_build/texinfo/factorial.png: New.
449 * docs/_build/texinfo/libgccjit.texi: New.
450 * docs/_build/texinfo/sum-of-squares.png: New.
452 * docs/examples/tut01-hello-world.c: New.
453 * docs/examples/tut02-square.c: New.
454 * docs/examples/tut03-sum-of-squares.c: New.
455 * docs/examples/tut04-toyvm/Makefile: New.
456 * docs/examples/tut04-toyvm/factorial.toy: New.
457 * docs/examples/tut04-toyvm/fibonacci.toy: New.
458 * docs/examples/tut04-toyvm/toyvm.c: New.
459 * docs/index.rst: New.
460 * docs/internals/index.rst: New.
461 * docs/intro/factorial.png: New.
462 * docs/intro/index.rst: New.
463 * docs/intro/sum-of-squares.png: New.
464 * docs/intro/tutorial01.rst: New.
465 * docs/intro/tutorial02.rst: New.
466 * docs/intro/tutorial03.rst: New.
467 * docs/intro/tutorial04.rst: New.
468 * docs/topics/contexts.rst: New.
469 * docs/topics/expressions.rst: New.
470 * docs/topics/functions.rst: New.
471 * docs/topics/index.rst: New.
472 * docs/topics/locations.rst: New.
473 * docs/topics/objects.rst: New.
474 * docs/topics/results.rst: New.
475 * docs/topics/types.rst: New.
476 * dummy-frontend.c: New.
477 * jit-builtins.c: New.
478 * jit-builtins.h: New.
480 * jit-playback.c: New.
481 * jit-playback.h: New.
482 * jit-recording.c: New.
483 * jit-recording.h: New.
484 * libgccjit++.h: New.
487 * libgccjit.map: New.
490 2013-07-26 David Malcolm <dmalcolm@redhat.com>
494 Copyright (C) 2013-2014 Free Software Foundation, Inc.
496 Copying and distribution of this file, with or without modification,
497 are permitted in any medium without royalty provided the copyright
498 notice and this notice are preserved.