class CODE_FILE |
---|
**** | This class controls C code generated by the compiler. For incremental compilation, files are built in memory as FSTRs and then conditionally written out only if their signature differs from what already exists. There is one file per Sather class, although as an optimization these could be combined for classes that have the same checking modes. |
attr bnd_iter_creates:FLIST{AM_BND_CREATE_EXPR}; |
---|
**** | decls have to be emitted for these |
attr bnd_rout_creates:FLIST{AM_BND_CREATE_EXPR}; |
---|
**** | decls have to be emitted for these |
attr chk_arith:BOOL; |
---|
attr chk_assert:BOOL; |
---|
attr chk_bounds:BOOL; |
---|
attr chk_invariant:BOOL; |
---|
attr chk_post:BOOL; |
---|
attr chk_pre:BOOL; |
---|
attr chk_return:BOOL; |
---|
attr chk_void:BOOL; |
---|
attr chk_when:BOOL; |
---|
attr decs:FSET{SIG}; |
---|
**** | declarations have to be emitted for these signatures. |
attr do_not_merge:BOOL; |
---|
**** | True if should remain separate file |
attr externs:FSET{STR}; |
---|
**** | Decls have to be emitted for these external calls |
attr globals:FSET{AM_GLOBAL_EXPR}; |
---|
**** | declarations have to be emitted for these global const or shareds |
attr is_c_code:BOOL; |
---|
**** | Header info for the flags below will only be emitted if it is a C file |
attr iters:FSET{SIG}; |
---|
**** | These iters are used by this file |
attr layouts:FSET{$LAYOUT}; |
---|
**** | typedefs have to be emitted for these layouts |
attr name:STR; |
---|
attr unboxes:FSET{TUP{SIG,SIG}}; |
---|
**** | decls have to be emitted for these functions which unbox types on dispatching |
attr bnd_iter_creates:FLIST{AM_BND_CREATE_EXPR}; |
---|
**** | decls have to be emitted for these |
attr bnd_rout_creates:FLIST{AM_BND_CREATE_EXPR}; |
---|
**** | decls have to be emitted for these |
attr chk_arith:BOOL; |
---|
attr chk_assert:BOOL; |
---|
attr chk_bounds:BOOL; |
---|
attr chk_invariant:BOOL; |
---|
attr chk_post:BOOL; |
---|
attr chk_pre:BOOL; |
---|
attr chk_return:BOOL; |
---|
attr chk_void:BOOL; |
---|
attr chk_when:BOOL; |
---|
attr decs:FSET{SIG}; |
---|
**** | declarations have to be emitted for these signatures. |
attr do_not_merge:BOOL; |
---|
**** | True if should remain separate file |
attr externs:FSET{STR}; |
---|
**** | Decls have to be emitted for these external calls |
attr globals:FSET{AM_GLOBAL_EXPR}; |
---|
**** | declarations have to be emitted for these global const or shareds |
attr is_c_code:BOOL; |
---|
**** | Header info for the flags below will only be emitted if it is a C file |
attr iters:FSET{SIG}; |
---|
**** | These iters are used by this file |
attr name:STR; |
---|
attr unboxes:FSET{TUP{SIG,SIG}}; |
---|
**** | decls have to be emitted for these functions which unbox types on dispatching |
shared all,todo:FLIST{SAME}; |
---|
shared cgen:CGEN; |
---|
shared dir:STR; |
---|
shared iter_sigs:FMAP{SIG,AM_ROUT_DEF}; |
---|
shared layout_order:FLIST{$LAYOUT}; |
---|
shared layout_text:FLIST{STR}; |
---|
shared prog:PROG; |
---|
shared thumbprints:FMAP{STR,STR}; |
---|
shared all,todo:FLIST{SAME}; |
---|
shared all,todo:FLIST{SAME}; |
---|
shared cgen:CGEN; |
---|
shared dir:STR; |
---|
shared iter_sigs:FMAP{SIG,AM_ROUT_DEF}; |
---|
shared layout_order:FLIST{$LAYOUT}; |
---|
shared layout_text:FLIST{STR}; |
---|
shared prog:PROG; |
---|
shared thumbprints:FMAP{STR,STR}; |
---|
shared all,todo:FLIST{SAME}; |
---|
create(s:STR):SAME |
---|
**** | Create a new CODE_FILE. |
finalize |
---|
**** | Indicate done with all files. This causes any files which have changed to be written out. |
fix_out_type(e:ARG, s:STR):STR |
---|
good_place_to_split |
---|
header_info:FSTR |
---|
here_is_iter(a:AM_ROUT_DEF) |
---|
merge:STR |
---|
**** | There is a tension between having lots of files to increase parallelism and having few to decrease overhead. In addition, The mechanism used to decide what files routines' definitions should go to must be deterministic and attempt to cluster those routines likely to be changed together (in order to minimize the number of files that must be recompiled.) |
plus(s:$STR) |
---|
**** | Output some code |
plus(s:$STR):SAME |
---|
**** | Output some code |
set_directory(p:PROG,s:STR) |
---|
**** | Set the target directory to be 's'. If it doesn't exist, make it. Otherwise, try to use what's already in it if the signatures match. |
uses_bnd_iter_create(bic:AM_BND_CREATE_EXPR) |
---|
uses_bnd_rout_create(brc:AM_BND_CREATE_EXPR) |
---|
uses_extern(dec:STR) |
---|
uses_global(age:AM_GLOBAL_EXPR) |
---|
uses_iter(s:SIG) |
---|
uses_layout(l:$LAYOUT) |
---|
**** | We could check this with test, but then we have to check it twice (once for test, and insert will test it too.). If the size changes, the element has been added |
uses_sig(s:SIG) |
---|
**** | This also sees to it that all types in the signature are referenced; they don't need to be done separately. |
uses_tp(t:$TP) |
---|
uses_unbox(s,abs:SIG) |
---|
bnd_iter_declarations:STR |
---|
**** | AJ- Generate declarations for bound iter objects |
bnd_rout_declarations:STR |
---|
**** | Generate declarations for bound routine objects |
declaration_for(sig:SIG):STR |
---|
**** | emit ANSI header, and also struct to hold locals if an iter |
generate_layouts |
---|
**** | emit typedefs/structs |
attr layouts:FSET{$LAYOUT}; |
---|
**** | typedefs have to be emitted for these layouts |
attr length:INT; |
---|
**** | private attr text:FSTR; |
attr length:INT; |
---|
**** | private attr text:FSTR; |
mang(ob:$OB):STR |
---|
attr ntext:FSTR; |
---|
attr ntext:FSTR; |
---|
same_options_as(s:SAME):BOOL |
---|
attr text:FLIST{FSTR}; |
---|
attr text:FLIST{FSTR}; |
---|
unbox_dec(s,abs:SIG):STR |
---|