Commit Graph

2466 Commits

Author SHA1 Message Date
Neil Brown
b830b27066 Added a couple more settings to CompState to set the locations of the (C and occam) header files (but not made them available via the command-line, just yet) 2009-04-01 14:34:13 +00:00
Neil Brown
e9730bfe1e Got the C++ backend working again, on the cgtests at least 2009-04-01 15:25:18 +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
bea4dcfd80 Took out some C garbage, which gets around 200 more tests passing 2009-03-31 18:02:39 +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
33ca2fe253 Made sure that user types are resolved when fixing array constructor types 2009-03-31 16:19:18 +00:00
Neil Brown
2edf5cc43d Fixed constant folding to resolve any user types involved
Due to awkward module dependencies, some functions had to be moved around to accommodate this change.  Two from Types have gone to EvalLiterals, and two to CompState.  Everything still compiles just as before though.
2009-03-31 16:11:00 +00:00
Neil Brown
91ce2fe960 Fixed generation of actuals that are ActualExpression (ExprVariable {}) 2009-03-31 16:08:37 +00:00
Neil Brown
3566c6206f Fixed retyping non-packed records into arrays 2009-03-31 16:08:24 +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
334d22acd8 Corrected a try, so that we don't mistake a CHAN type for a CHAN TYPE type 2009-03-31 11:50:24 +00:00
Neil Brown
dbc3b97343 Changed the lexing and parsing of PRAGMAs again, to allow unknown pragmas
With my previous change to PRAGMAs, unknown pragmas would fatally fail in the lexer, so that an unknown pragma would always stop compilation, which is not good.  I've changed it more towards Adam's suggestion of re-lexing and re-parsing the pragma from the parser, so we now gracefully ignore unknown pragmas again.  The lexer is a bit messy, though.
2009-03-31 11:08:53 +00:00
Neil Brown
edc336de7a Fixed a bug when generating some no-arg PROCs 2009-03-31 10:50:52 +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
4d2cdc0a9d Altered the backend passes to use all the new VariableSizes mechanisms rather than the old stuff
This is quite a big patch, as it reworks a large pass.  The three backend passes dealing with sizes stuff have now been merged into one (because the traversal order is important).

Instead of generating sizes arrays by blindly appending "_sizes", we now create nonces and store them in the csArraySizes map in CompState, which is a bit less hacky.

Added to that, we also generate constant-size arrays (e.g. for [8]) -- which are needed in case we pass the array to a PROC that has a flexible dimension -- at the top of the whole program, and use that array for every variable with that size (so if foo and bar have the same size, we use the same sizes array from the top of the program).
2009-03-31 10:22:34 +00:00
Neil Brown
a10921d53a Fixed the last few uses of genSizeSuffix in GenerateC to use the new system instead 2009-03-31 09:35:59 +00:00
Neil Brown
f749967af4 Added some cases inside genVariable to handle the VariableSizes item
For mobile arrays, this uses the ->dimensions member.  For normal arrays, it uses the associated sizes array (by looking it up in CompState).
2009-03-31 09:34:36 +00:00
Neil Brown
298ba6465a Removed genSizeSuffix and turned most uses of it into calls to genDynamicDim 2009-03-31 09:29:55 +00:00
Neil Brown
b8daebfbc3 Made genDynamicDim a top-level function, and change its implementation to use VariableSizes rather than C-specific stuff 2009-03-31 09:28:45 +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
c46346ffa2 Changed the occam parser to parse SIZE followed by a variable into the new VariableSizes item 2009-03-30 15:33:36 +00:00
Neil Brown
3876c1b6e9 Added support for VariableSizes to the ShowCode module 2009-03-30 15:33:10 +00:00
Neil Brown
c1c73f9186 Added constant-folding support for VariableSizes 2009-03-30 15:32:38 +00:00
Neil Brown
1144975abc Added support for VariableSizes to the Types module, including a helper function: specificDimSize 2009-03-30 15:30:46 +00:00
Neil Brown
904d19a6a5 Added a new VariableSizes constructor to Variable that will supplant SizeVariable and AllSizesVariable 2009-03-30 15:28:38 +00:00
Neil Brown
b86ffbbf3b Added two new items to CompState, which will help to replace the _sizes suffix 2009-03-30 15:13:56 +00:00
Neil Brown
676bbe34d4 Added a few missing lines in the constant folding 2009-03-27 21:40:14 +00:00
Neil Brown
ecc42f704d Fixed all the nasty hacks from earlier relating to running processes in parallel 2009-03-27 21:35:28 +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
5316bc379f Fixed some things to do with the build system (extra headers, include paths) 2009-03-27 19:54:05 +00:00
Neil Brown
55ba56cbae Fixed the build system for the rangetest 2009-03-27 19:38:08 +00:00
Neil Brown
0ca5bb17d7 A collection of nasty hacks to get Tock's replicated PARs working, and to stop memory leaking
All the changes in this patch should be undone as soon as possible (building the list of workspaces, and how we sort out the enrollment counts -- that should be done by pulling up PAR replicator counts outside the whole PAR), but for now, it works.
2009-03-27 17:26:37 +00:00
Neil Brown
f0a64cb33f Added some Tock support functions for allocating and freeing workspaces
It turns out that we weren't freeing workspaces, and neither was CCSP, and hence in long-running programs we were leaking memory at a crazy rate.  This fix works, but really this stuff should be in CCSP (Currently, it doesn't seem to have a ProcFree function...)
2009-03-27 17:25:09 +00:00
Neil Brown
2237d15247 Various fixes in the C backend to get oak working 2009-03-27 16:29:06 +00:00
Neil Brown
dbf0b90601 Fixed array sizes for external procs to have one extra formal per dimension, rather than passing the whole array in a single formal (this is now how it should work!) 2009-03-27 16:28:23 +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
63cb30802e Fixed the type inference for CLAIMs 2009-03-27 16:24:01 +00:00
Neil Brown
7764b4caf8 Added some debug messages during usage checking, and stopped checking PROCs with one argument for alias issues 2009-03-27 12:02:52 +00:00
Neil Brown
363ef6a9bc Made sure that user types are resolved when type-checking for occam 2009-03-27 09:44:05 +00:00
Neil Brown
574694d078 Fixed some stuff on external PROCs (the adding of sizes parameters) 2009-03-26 23:58:08 +00:00
Neil Brown
6e66cf7521 Added a command-line option to change how much stack the unknown functions are given 2009-03-26 22:49:38 +00:00
Neil Brown
eb99480484 Finished off the support for external C functions 2009-03-26 22:37:28 +00:00
Neil Brown
95d7144c7b Added the ability to specify linker flags separately from C compilation flags 2009-03-26 22:36:13 +00:00
Neil Brown
09093cff12 Added the ability to print out HTML-highlighted lexed occam
This falls a bit outside the compiler's remit, but it will be the same code to print out the lexed occam without highlighting, which I plan to use for doing libraries with Tock in a bit.
2009-03-26 22:34:34 +00:00
Neil Brown
733293745e Added a work-around for generating infinity and NaN in the C backend 2009-03-26 18:39:23 +00:00