Commit Graph

335 Commits

Author SHA1 Message Date
Neil Brown
e457d82f0c Changed FUNCTIONs and PROCs to have optional bodies, and put all the externals into the AST (without bodies)
This may seem like an odd change, but it simplifies the logic a lot.  I kept having problems with passes not operating on externals (e.g. functions-to-procs, adding array sizes, constant folding in array dimensions) and adding a special case every time to also process the externals was getting silly.

Putting the externals in the AST therefore made sense, but I didn't want to just add dummy bodies as this would cause them to throw up errors (e.g. in the type-checking for functions).  So I turned the bodies into a Maybe type, and that has worked out well.

I also stopped storing the formals in csExternals (since they are now in csNames, and the tree), which streamlined that nicely, and stopped me having to keep them up to date.
2009-04-04 14:56:35 +00:00
Neil Brown
d6ad0ba202 Made the name of record-copying PROCs different for each file that generates them, to avoid clashes at link time 2009-04-03 10:25:55 +00:00
Neil Brown
dbc1b461a4 Made makeNonce use the munged meta-tag, to stop wrapper PROCs from different files having name clashes at link-time 2009-04-02 20:02:11 +00:00
Neil Brown
70789661f1 Got pragma-declared FUNCTIONS to be turned into PROCs and handled properly 2009-04-02 18:13:51 +00:00
Neil Brown
e91c075bcf Fixed up a lot of the failing tests
I changed a little bit of the code, but mainly the tests.  Several of the remaining failures are actually real failures, so I need to dig through the rest carefully.  A lot are failing because the C++ backend is broken.
2009-04-01 11:49:37 +00:00
Neil Brown
56e5b8da8e A mega-patch that gets tocktest compiling again
However, around a quarter of the tests currently fail...
2009-03-31 17:56:56 +00:00
Neil Brown
8ee32f0795 Made sure that record literals are pulled up (perhaps this accidentally lost in the past?) 2009-03-31 16:51:02 +00:00
Neil Brown
2941cbd049 Fixed a problem with record abbreviations being pulled all the way up to the top (which C doesn't like) 2009-03-31 16:50:42 +00:00
Neil Brown
9f5b685c02 Corrected a nasty problem with pulling up free names into arguments
The problem was that the free name could involved in an array dimension (and hence a type) of something in the PROC.  When the name was then replaced in the type, CompState was not updated to have the new type, and instead kept the old type (potentially) all the way through to the backend, where it might be used for checking the bounds of an array index (against the old name taken from CompState, not the replaced name).
2009-03-31 11:51:02 +00:00
Neil Brown
dbf886996a Removed various bits of old code relating to the old sizes mechanism 2009-03-31 10:50:04 +00:00
Neil Brown
e1cd694c27 Added code to pull up any VariableSizes expressions (since they result in an array) 2009-03-31 09:22:59 +00:00
Neil Brown
654dd453f1 Replaced another use of SizeVariable with VariableSizes (via specificDimSize), in SimplifyExprs 2009-03-31 09:22:38 +00:00
Neil Brown
af9ab28718 Replaced a use of SizeVariable with VariableSizes (indirectly) in SimplifyProcs 2009-03-31 09:21:32 +00:00
Neil Brown
72fe41cdc1 Added a couple of missing cases to isExempt (in the abbreviation checking) 2009-03-31 09:20:01 +00:00
Neil Brown
a71e2a8c0a Fixed the pulling up of replication counts to pull up outside PARs 2009-03-27 21:29:30 +00:00
Neil Brown
74e3f61614 Fixed arrays of user data types that are arrays to be flattened into a multidimensional array, rather than an array of arrays 2009-03-27 16:24:15 +00:00
Neil Brown
bd2dfe3d2a Fixed pullUp so that it pulls up PROC parameters again 2009-03-26 18:38:28 +00:00
Neil Brown
ffbf4bed87 Removed a few bits of awkwardness in Unnest 2009-03-26 18:37:16 +00:00
Neil Brown
127a72ad5e Fixed channel arrays in PROC parameters to be pulled up 2009-03-25 18:26:33 +00:00
Neil Brown
45b22472c3 Changed the rest of tock to reflect the changes to the Is constructor 2009-03-24 23:57:24 +00:00
Neil Brown
f73171140c Fixed a subtle bug with conflicting abbreviation modes in the PROCS generated to copy records 2009-03-23 21:08:40 +00:00
Neil Brown
41805aaacf Changed the ChanEnd constructor to only keep information about its shared-ness, not about the whole channel 2009-03-23 18:40:28 +00:00
Neil Brown
228523e7e7 Added the generation of IsDefined checks, and stopped them being applied to derefenced arrays 2009-03-23 15:48:24 +00:00
Neil Brown
be36af4bf0 Added a work-around for resolving user defined types in the CompState 2009-03-22 22:31:49 +00:00
Neil Brown
81ebebe4fe Added a quick work-around in SimplifyAbbrevs for the SYB-Map issue 2009-03-22 00:32:56 +00:00
Neil Brown
f5ce1c8f89 Added the code to mobilise arrays inside protocols 2009-03-20 11:26:54 +00:00
Neil Brown
65875f523f Added mobile cloning rather than using dereferencing to copy mobiles 2009-03-19 16:47:31 +00:00
Neil Brown
2e99bcfc5e Added the mobilisation of process parameters, but I think I need to clone, not dereference 2009-03-19 15:45:49 +00:00
Neil Brown
8abd09758c Fixed the implicit mobility module to mobilise arrays inside channels 2009-03-19 15:23:56 +00:00
Neil Brown
26824883d6 Changed the implicit mobility to only look at mobile variables, and recorded what future use is causing a copy decision 2009-03-19 14:00:59 +00:00
Neil Brown
823592bd1d Added some passes to mobilise non-mobile arrays 2009-02-27 17:12:08 +00:00
Neil Brown
6d112a244e Fixed when names are exempted from abbreviation checking by the PERMITALIASES pragma 2009-02-11 13:15:25 +00:00
Neil Brown
152f5fc252 Changed the abbreviation checking so that it doesn't check nonce names
When we pull up names (which happens before abbreviation checking), we create a lot of nonces with greater scope than the original variables.  When we go to abbreviation check this, we therefore set off lots of false alarms about originally safe code.  So to fix this, the easiest method seems to be turning off checking on all the names introduced by the compiler.
2009-02-11 11:23:39 +00:00
Neil Brown
e37fa37c79 Recoded abbrevCheckPass so that it is much more efficient (now does everything in one pass of the AST) 2009-02-10 13:14:45 +00:00
Neil Brown
9d44e3475c Swapped some uses of listify to fastListify, but the abbreviation checking is still very slow 2009-02-10 12:49:54 +00:00
Neil Brown
bcd670bfd2 Fixed a couple of problems with the usage checking 2009-02-10 12:40:24 +00:00
Neil Brown
cff10e2f28 Added a pass that checks that abbreviations are used properly 2009-02-10 11:32:10 +00:00
Neil Brown
14df1e09b7 Corrected some problems caused by moving the direction specifiers up to the whole array (the array wasn't then being pulled up) 2009-02-10 00:28:45 +00:00
Neil Brown
979eec927a Added a pass that removes replicators with a count of 0, and turns replicators with a count of 1 into non-replicated things (with the appropriate abbreviation) 2009-02-04 11:30:57 +00:00
Neil Brown
359763380e Fixed the test for the transformConstr pass 2009-02-03 12:37:32 +00:00
Neil Brown
502c61b01e Fixed the expansion of array literals to be more like it used to be
All the usual cgtests now compile and run
2009-02-02 23:51:57 +00:00
Neil Brown
bf365ee41a Fixed the pass that turns array constructors into replicated loops so that it handles nested array constructors and inner-procthens properly
cgtest80 now compiles and passes
2009-02-02 18:27:38 +00:00
Neil Brown
96934c871d Changed the transformation of array constructors so that it also pulls out all the specs that were pulled up to be just inside them 2009-02-02 17:36:14 +00:00
Neil Brown
ebf8ae2d83 Added a pull up context just inside the replicators for array constructors 2009-02-02 17:35:46 +00:00
Neil Brown
51acf8abb5 Made sure to change the abbreviation for VAL array things that are now being assigned to via a loop as initialisation 2009-02-02 17:34:44 +00:00
Neil Brown
88d6136dcf Stopped the expansion of inner array literals into subscripted elements
This expansion was causing a big blow-up in the code, as things like:

VAL [2][1]INT as IS [[0,1]]

were getting transformed into:

VAL [2]INT n0 IS [0,1]:
VAL [2]INT n1 IS [0,1]:
VAL [2]INT n2 IS [n0[0], n1[1]]:
VAL [2][1]INT as IS [n2]:

Or something similar -- the inner arrays were pulled up into multiple definitions that were then subscripted, because the first pull-up did this:

VAL [2]INT n2 IS [[0,1][0], [0,1][1]]:

and then the inner arrays got pulled up again, separately.  The change hasn't immediately broken anything, but I haven't fully tested it yet
2009-02-02 17:30:39 +00:00
Neil Brown
40b9a8b76b Fixed the generated PROCs for copying records not having their definition recorded 2009-02-02 17:23:28 +00:00
Neil Brown
460ee36247 Fixed the pulling up of array constructors into initialisers
Previously, this was only pulling up constructors that contained single elements, and not constructors that contained multiple elements
2009-02-02 16:17:00 +00:00
Neil Brown
3458a9197a Adjusted the backends and transformations module to match the new array literal changes 2009-02-01 21:53:17 +00:00
Neil Brown
4f83187549 Fixed up all the tests in light of the new recursive procs 2009-01-29 00:56:32 +00:00