Commit Graph

2327 Commits

Author SHA1 Message Date
Neil Brown
5bf1ffa785 Made the preprocessor correct the path a #USEd file when it finds it on the search path while including it 2009-04-01 18:59:57 +00:00
Neil Brown
91092c17ff Added some missing static specifiers to some occam support functions 2009-04-01 18:59:10 +00:00
Neil Brown
8153cfc659 Added code for full compilation mode to include the relevant C files from occam #USE directives, and link to the relevant object files 2009-04-01 18:32:39 +00:00
Neil Brown
d457b793c0 Added code that allows any external PROCs not beginning with B or C to be handled as normal
This shows that my current scheme is a bit of a hack; if an occam programmer starts a normal PROC with B or C, it will be treated funny during separate compilation.  In future I probably need some new form of #PRAGMA to support separate compilation, different from that used to interface with C.
2009-04-01 17:29:32 +00:00
Neil Brown
7b55c96781 Fixed up the parsing of PRAGMAs to make it a bit simple, and match with other changes to the lexer and parser 2009-04-01 17:26:27 +00:00
Neil Brown
1e538fc592 Fixed ShowCode to print direction specifiers in the right place after variable names, as it's important now that what we spit out for PROC headers is legitimate occam 2009-04-01 17:08:04 +00:00
Neil Brown
4c4fccc1a2 Corrected the lexer (no vertical space after pragmas with the new way of doing them) 2009-04-01 17:07:37 +00:00
Neil Brown
512d05dd36 Removed the redundant warnings from the occam parser (after I put them back into CompState, a long time ago) 2009-04-01 16:56:37 +00:00
Neil Brown
db9b8e9d91 Changed where we generate the .inc file from being in the backend, to being a pass just after type-checking
We need to generate the externals after we've inferred channel directions, but before we do further work (like adding _sizes parameters and so on).
2009-04-01 16:54:07 +00:00
Neil Brown
abce001bab Added a command line option to indicate that there is no main PROC 2009-04-01 15:29:22 +00:00
Neil Brown
219bfd9ce1 Modified the C backend so that it will put the forward declarations into a header file and include that 2009-04-01 14:35:47 +00:00
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