Build 1255:
* Fixes for 32-bit x86 target
* Command line option fixes

Makefile:
* Include 'target' file so target specific settings can be kept out of git archive
* Update command line options

compilestate.l:
* Hardwire path to llvm-ld to work around PATH issue on LSP on 32-bit x86

lib/linux-x86-32/unsafe/ifcgi.l:
* Fix problem where ifcgi imported from 64-bit library directory

lib/linux-x86-32/unsafe/ifcgi.l
* Fix problem where fcgi.o imported from 64-bit library directory

lib/linux-x86-32/unsafe/jit.l:
* Fix LLVM imports

lib/trusted/array.l:
* Fix problem where Generic.Array.Address returned incorrect value on 32-bit target
* Add T[] copy() method
* Add T[] Freeze property

lib/unsafe/exec.l:
* Remove debug output

llvm/llvmimports.l:
* Move to main source directory

llvm/machine.l
* Move to main source directory

ltest/
* Add #C to all C-style syntax tests

main.l:
* Fix problem where same letters used for duplicate options making some options unavailable
* Enable shared standard library only for native libraries

printtermg.l:
* Fix problem where variable scope not valid


Build 1254:
* Fix problem where T ptr Generic.Array<T>.Address returned incorrect address on 32-bit target
* Better error recovery in some cases where one error could cause spurious subsequent errors or fatal exceptions

lib/trusted/array.l:
* Fix problem where Address property calculated incorrectly on 32-bit target
* Implement T[] copy() method from List<T>
* Implement T[] Freeze property from List<T>

lib/trusted/glist.l:
* Add T[] Freeze property, which must return either a copy (for mutable objects) or the object itself (for immutable objects)

lib/trusted/gllist.l
* Implement LinkedList<T> copy() method from List<T>
* Implement LinkedList<T> Freeze property from List<T>

lib/trusted/gslice.l
* Implement Slice<T> Freeze property from List<T>

lib/trusted/gslist.l b/lib/trusted/gslist.l
* Implement SortedList<T> copy() method from List<T>
* Implement SortedList<T> Freeze property from List<T>

lib/trusted/gsmap.l:
* Fix incorrect parentheses in toString()

lib/trusted/gvector.l:
* Implement Vector<T> Freeze property from List<T>

lib/trusted/string.l
* Use red-black tree map for string pool instead of hash map (should waste less memory in case where pool is lightly used and performance should degrade more\
gracefully for pools that would have greatly exceded the hash map's hashtable size)

lib/unsafe/serial.l:
* Import gmap

needcompile.l:
* Avoid throwing/catching exceptions on missing hash or dependancy files (works around problem bootstrapping on x86 32-bit JIT target where exception handlin\
g is fragile)

parsetree.l:
* Fix some common cases where fatal exceptions and/or confusing errors could result from parse trees having undefined types due to previous errors


Build 1253:
* Clean up collection classes
* Documentation updates

Doxyfile
* Make project name more descriptive

compilestate.l:
* When searching for existing methods that might be hidden by a new method definition, search for best match quality rather than first match (FIXME: this doesn't seem like an improvement - really needs to be done in a pass after the methods are defined as otherwise definition order affects whether you get the warning)

lib/trusted/array.l:
* Use Slice<T> instead of ArrayRange<T>

lib/trusted/glist.l:
* Add Slice<T> slice() method and get List<T>[Range<int> r] indexer

lib/trusted/gllist.l:
* Add Slice<T> slice() method and get List<T>[Range<int> r] indexer

lib/trusted/gmap.l:
* Change template parameter names for Dict<K,V> so Doxygen recognises it as same interface as defined in gdict.l

lib/trusted/gslist.l:
* Fix doc comment

lib/trusted/gsort.l
* Fix doc comment

lib/trusted/gvector.l:
* Remove dead code
* Add Slice<T> slice() method and get List<T>[Range<int> r] indexer

lib/trusted/primtype.l:
* Use Range<T> instead of ArrayRange<T>
* Remove RangeIterator<T>

lib/trusted/string.l:
* Remove dead code
* Add Slice<T> slice() method
* Use Range<T> instead of RangeIterator<T>

lib/unsafe/exec.l:
* Fix doc comment

lib/unsafe/klass.l:
* Fix doc comment

lib/unsafe/library.l:
* Fix doc comment

lib/unsafe/libso.l:
* Fix doc comment

lib/unsafe/serial.l:
* Fix doc comments

lib/unsafe/stream.l:
* Fix doc comments


Build 1252:
* Fix incorrect import in Generic.SortedList<T>
* Fix broken constructor in Generic.SortedSet<T>
* Update Doxygen doc comments in library
* Change some operator methods in library to use operator syntax

lib/trusted/gdict.l:
* Fix incorrect iterator return type

lib/trusted/gslist.l:
* Fix broken import

lib/trusted/gsset.l:
* Fix broken constructor

lib/unsafe/serial.l:
* Remove dead code

parsedef.l:
* Fix syntax error throwing abort compile exceptions

parsetype.l:
* Nearer approximation to C function syntax when dumping proc types for Doxygen


Build 1251:
* Make #K syntax default
* Fix problem where template specializations referenced only in method retun type were not instantiated
* Fix problem where compilation aborted with exception if iterator in foreach loop is of undefined type
* Mark non #K syntax files in source and library with #C
* Update copyright dates in source files and library
* Add Pair<K,T> class and make MapPair<K,T> class inherit from it
* Add Dict<K,T> library interface
* Add SortedSet<T> library class based on red-black tree

compilestate.l:
* Throw AbortCompilingThisProjectException rather than System.Eception on encountering template that should have been specialized in an earlier pass (allows MethodDef to show line number of error before aborting compile)

lib/trusted/gmap.l:
* Make MapPair<K,T> inherit from new Pair<K,T> class
* Make MapIterator<K,T> implement Iterator<Pair<K,T>> rather than Iterator<MapPair<K,T>> (required by type compatibility rules for templates)
* Make Map<K,T> implement Dict<K,T> interface
* Rename containsKey method contains
* Use PairKeyIterator<K,T> and PairValueIterator<K,T> instead of corresponding map iterators

lib/trusted/gpair.l:
* Add PairKeyIterator<K,T> and PairValueIterator<K,T> that returns either the keys or the values from an Iterator<Pair<K,T>>

lib/trusted/gsmap.l:
* Rename file from rbtree.l to gsmap.l
* Rename class RBTree<K,V> to SortedMap<K,V>
* Move tree node helper class to end of file.
* Make TreeNode<K,V> inherit from Pair<K,T>
* Rename printHelper to toString
* Add remaining methods required for Dict<K,V>

main.l:
* Reinstate access to WantPrint via new -X command line option so Doxygen docs can be updated

parsedef.l:
* Fix problem where method return values not checked for new template specializations in checkTemplates pass
* Catch AbortCompilingThisMethodException in declareClassSymbols pass and issue error message
* Catch AbortCompilingThisProjectException in declareClassSymbols pass, issue error message and rethrow

parseloop.l:
* Fix problem where compilation aborted with exception if iterator in foreach loop is of undefined type

token.l:
* Make #K syntax default, accept #C as well and #L to indicate C-style syntax


Build 1250:
* Autobox non-Object values in array literals making resulting array type System.Object[] if values are of mixed types
* Start trying to clean up collection classes in library
* Add red black tree associative array Generic.RBTree<K,V>

lib/trusted/gllist.l:
* Rename Generic.RealList<T> class to Generic.ListNode<T>

lib/trusted/gmap.l:
* Rename Generic.RealList<T> class to Generic.ListNode<T>
* Fix incorrect doc comment

lib/trusted/gslist.l:
* Convert to #K syntax
* Rename Generic.RealList<T> class to Generic.ListNode<T>
* Rename Generic.RealSortedList<T> class to Generic.SortedListNode<T>

lib/trusted/list.l:
* Rename Util.RealList class to Util.ListNode

lib/trusted/map.l b/lib/trusted/map.l:
* Rename Util.RealList class to Util.ListNode

lib/trusted/rbtree.l:
* Red black tree implementation of associative array

lib/trusted/string.l:
* Make System.String implement Generic.List<char>

parseexpr.l:
* Autobox non-Object values in array literals making resulting array type System.Object[] if values are of mixed types


Build 1249:
* Change 'end' keyword to 'si' for consistency with other block keyword pairs
* Change 'extends' token to 'isa' (frees up one keyword and is shorter)
* Change 'implements' token to 'do' (frees up one keyword and is shorter)

Various library files, see git diff for details
* Change 'end' to 'si' in library
* Change 'extends' to 'isa' in library
* Change 'implements' to 'do' in library

syntax-k.jay:
* Change 'extends' to 'isa'
* Change 'implements' to 'do'

token.l:
* Change 'end' to 'si'
* Remove 'extends' keyword from #K syntax
* Remove 'implements' keyword from #K syntax


Build 1248:

* Fix problem introduced by block scope changes where @Virtual pragma potentially not applied until after some final calls to method already compiled
* Fix bug where closures could fail to compile
* Additional methods in Filter library class

filter.l:
* Move Filter from Generic to Util namespace
* Rename 'filter' method to 'where'
* Add 'except', 'map', 'apply, 'mapIf' and 'applyIf' methods

lib/trusted/string.l:
* Remove dead code

parsedef.l:
* Eplicitly apply pragmas in method in declare class symbols pass (fixes problem where calls to methods marked @Virtual could still be compiled as final calls)

parseexpr.l:
* Fix bug where compiling closures could result in SEGV due to too short an array passed to LLVM when determining target method parameter types.

parsetree.l:
* Add applyPragmas(CompileState) method, used by MethodDef to apply pragmas in declare class symbols pass, to Statement, BlockStatement and Pragma.


Build 1247:
* Remove debug output

container.l:
* Remove debug output

parsecall.l:
* Remove debug output

parsedef.l:
* Remove debug output

parseexpr.l:
* Remove debug output


Build 1246:
* Support recursion in proc literals
* Fix bug where proc literals defined in static methods were not automatically static
* Fix long standing bug where explicit or implicit use of 'this' in static method could cause either LLVM assertion failure or incorrect code generation

container.l:
* Add setter for IsStatic property

parsecall.l:
* Allow deprocedure on this (i.e. 'this(x,y,z)'), which calls the current method. Required for recursion in literal procedures since they have no name to call through.
* Automatically pass closure state parameters when recursing via 'this()' in a literal procedure
* Make anonymous methods implementing proc literals static if no containing method or if containing method is static

parseexpr.l:
* Do not attempt to capture 'this' value when creating static proc reference

parsetree.l:
* Issue error if makeLoadThis() called with no current method or within a static method

symbol.l:
* Add a protected setter for Kind property


Build 1245:
* Fix problem where closures with parameters caused bounds exceptions
* Fix problem where parameters of undefined type caused bounds exceptions

container.l:
* Fix problem where closures with parameters caused bounds exception

parsedef.l:
* Fix problem where parameters of undefined type caused bounds exceptions


Build 1244:
* Fix problem introduced in 1243 where this value not correctly stored in bound proc object
* Remove debug output

parsedef.l:
* Remove debug output

parseexpr.l:
* Fix problem introduced in 1243 where this value not correctly stored in bound proc object
* Remove debug output


Build 1243:
* Initial implementation of closures, e.g:

void test() is
var i = 123;
var j = 456;
var p = proc() use i, j is
// i and j are readable here:
IO.Std.out.println( "in p, i is + " i + ", j is " + j );
end;

p(); // prints 'in p, i is 123, j is 456'

end

container.l:
* Add IsAnon property that returns true if this Container is an anonymous method
* Add addArgument() method that adds additional arguments to an existing method (used to pass closure state to anonymous methods)
* Add getSymbolCount() method that returns number of symbols currently defined within Container
* Emit null vtable entry for anonymous methods (hack to avoid calling getFunctionGlobal before all arguments for anonymous method are known)

lib/trusted/array.l:
* Fix reversed sense in isEmpty condition

lib/trusted/exception.l:
* ArrayBoundsException now extends BoundsException so catching BoundsException will catch any out of bounds index in arrays and collections

parsecall.l:
* Add initial closure support
* Add hidden arguments to anonymous methods implementing proc literals that will receive stored values from proc object
* Store current values of used variables in proc object when creating proc reference

parsedef.l:
* If when compiling a method, additional parameters are found in the method's container beyond those in the MethodDef then construct new VariableDefs for these parameters and declareSymbols() them before continuing (these are stored values for anonymous methods)

parseexpr.l:
* Support arbitrary list of stored values in proc object rather than just 'this'

syntax-k.jay:
* Add support for proc ... use <identifier-list> syntax, which creates a closure


Build 1242:

* Implement proper block scoping where each {} block in C-style syntax and each keyword delimited block in the regular syntax constitutes a scope.
* In addition make each for and foreach statement a scope

container.l:
* Remove dead code
* Remove debug output when constructing LLVM type for structs

lib/trusted/string.l:
* Fix for statement where variable defined in initializer referenced outside loop

lib/unsafe/stream.l:
* Fix for statement where variable defined in initializer referenced outside loop

parsedef.l:
* Remove debug output

parseexpr.l:
* Fix for statement where variable defined in initializer referenced outside loop

parseloop.l:
* Place foreach statements within their own block scope so their loop variables are not defined outside of the loop
* Place for statements within their own block scope so any variables defined in the init statement are not defined outside of the loop

parsetree.l:
* Remove dead code

symbol.l:
* Remove debug output
* Remove dead code
* Implement block scope by discarding symbol table entries for all variables declared within a block when compilation of that block is complete


Build 1240:
* Add support for range operator ('..')

lib/trusted/array.l:
* Add ArrayRange<T>, which is both an iterator over and a list over a sub-range of an array

lib/trusted/object.l:
* Remove debug output when disposing System.Object

lib/trusted/primtype.l:
* Add RangeIterator<T>, which is an iterator over a range of values
* Add opRange() support to Int and Char, which return RangeIterator<int> and RangeIterator<char>

lib/unsafe/unwind.l:
* Remove reference to __get_unwind_start() (FIXME: this class needs fixing or removing)

parseexpr.l:
* Add '..'/'opRange' operator, which has no built in implementation but which can be overloaded.

parsetree.l:
* Fix operator resolution for array index operator so built-in implementation is tried first and only for array left value and scalar right value. This fixes problem where overloaded index operator in specializations of Generic.Array<T> with non-integer argument type were never matched.
* Remove broken code that attempted to apply built-in array index operator to left values of Generic.Array<T> type (think this is rare enough to just allow corresponding List<T> methods to be called in this case)

syntax-k.jay:
* Add range operator ('..') support

syntax-l.jay:
* Add range operator ('..') support

token.l:
* Add range operator ('..') support


Build 1239:
* Fix problem where vtable slot allocated for structs
* Restore System.Thread support in native executables (still broken on JIT)

container.l:
* When calculating instance field addresses and class LLVM struct type for structs do not include vtable pointer as first element

lib/unsafe/stat.l:
* Call __stat_file2, which expects non-vtable struct layout, to get file mtime and size information
* Include size in struct Stat (FIXME: is int, needs to be long)

lrt-exception.c:
* #define GC_THREADS before including gc.h (fixes crash due to garbage collection in unknown thread for native code executables, still outstanding unexplained SEGV in pthread_mutex_init on JIT)
* Add struct _Stat2 and __stat_file2, which expect non-vtable struct layout
* Remove dead code from old hand-rolled exception handling support
* Remove GC related debug output as new GC root set code seems to have fixed garbage collection issues on JIT

lrt-unwind.c:
* Remove GC related debug output as new GC root set code seems to have fixed garbage collection issues on JIT

parseexpr.l:
* Remove LLVMGetTypeOf into unreferenced variable


Build 1238:

lib/trusted/gc.l:
* Add Roots property that returns a list of registered static variable root regions

lib/trusted/object.l:
* Output debug message when disposing objects to aid diagnosing issue with LSP server where some objects never garbage collected
* Mark System.Object.dispose() @Virtual

lrt-exception.c:
* Call System.Object._dispose() via a thunk that prints a debug message to aid diagnosing issue with LSP server where some objects never garbage collected

lrt-unwind.c:
* Maintain a short list of garbage collection root regions rather than expanding one region. This hopefully fixes a problem where static variables separated by large amounts of address space cause garbage collection to slow or stop due to massive root region.



Build 1237:
* Add 'isa' construct support to K syntax
* Add 'operator' syntax as alternative to standard operator method names (FIXME: operator methods' human names need to reflect this syntax, also operator keyword should precede type for consistency with accessor and indexer syntax)

syntax-k.jay:
* 'isa' support

token.l:
* Transparently convert 'operator' followed by supported operator token into corresponding standard operator name


Build 1236:
* Remove debug output when running static initializers

lib/trusted/gmap:
* add bool containsKey(K key)


Build 1235:

compilestate:
* Only output detailed information about what libraries linked if WantVeryVerbose

jit.cpp:
* Enable DWARF exception handling by default (current LLVM now seems to disable it under JIT by default)
* Remove dead code
* Don't delete function bodies after compilation (doesn't seem to free any memory)
* Run static initializers only for current module after load and not for all modules

lib/linux-x86-64/unsafe/jit.l:
* Link against libLLVM-2.7svn.so instead of individual LLVM shared libraries

lib/trusted/gmap.l:
* toString for map pair now returns 'key=>value'
* toString for map now returns comma separated list of map pairs

lib/unsafe/serial.l:
* Additional constructor for SerialReader that takes a CharStream argument and creates a Reader from it
* Add accessors Classes and Names that return the class and name maps for debugging purposes
* Ensure class and name maps always initialized before lookup so use before initialization gives 'undefined tag' exception rather than null pointer
* Additional constructor for SerialWriter that takes a CharStream argument and creates a Writer from it
* Add flush() and dispose() methods to SerialWriter that flush() and close() associated Writer respectively

lrt-unwind.c:
* Reinstate debug output for static initializers

parsedef.l:
* Output debug message for each static field initialized in addition to message per class

type.l:
* Only print target bits if WantVeryVerbose


Build 1234:
* Link against libLLVM-2.7svn.so instead of individual libraries

Makefile:
* Link lc against libLLVM-2.7svn.so instead of individual libraries

jit.cpp:
* Enable DWARF exception handling by default (current LLVM now seems to disable it under JIT by default)
* Remove dead code
* Don't delete function bodies after compilation (doesn't seem to free any memory)
* Run static initializers only for current module after load and not for all modules

llvm.l:
* Remove dead code


Build 1233:

compilestate:
* Only output detailed information about what libraries linked if WantVeryVerbose

jit.cpp:
* Enable DWARF exception handling by default (current LLVM now seems to disable it under JIT by default)
* Remove dead code
* Don't delete function bodies after compilation (doesn't seem to free any memory)
* Run static initializers only for current module after load and not for all modules

lib/linux-x86-64/unsafe/jit.l:
* Link against libLLVM-2.7svn.so instead of individual LLVM shared libraries

lib/trusted/gmap.l:
* toString for map pair now returns 'key=>value'
* toString for map now returns comma separated list of map pairs

lib/unsafe/serial.l:
* Additional constructor for SerialReader that takes a CharStream argument and creates a Reader from it
* Add accessors Classes and Names that return the class and name maps for debugging purposes
* Ensure class and name maps always initialized before lookup so use before initialization gives 'undefined tag' exception rather than null pointer
* Additional constructor for SerialWriter that takes a CharStream argument and creates a Writer from it
* Add flush() and dispose() methods to SerialWriter that flush() and close() associated Writer respectively

lrt-unwind.c:
* Reinstate debug output for static initializers

parsedef.l:
* Output debug message for each static field initialized in addition to message per class

type.l:
* Only print target bits if WantVeryVerbose


Build 1232:
* Interfaces now all inherit from System.Object, which means:
- Variables of type System.Object are assignable from values of any interface type
- All of System.Object's members are available in values of any interface type
- Values of any interface type can be passed in place of method arguments of System.Object type
- Casts to System.Object do not require a run time check
- isa System.Object(i), where i is of interface type, will always evaluate to true

compilestate.l:
* Make failing to call this or super class init() method as first statement in init() warning optional
* Do not include methods in System.Object within an interfaces 'implements' list
* Do not attempt to emit code setting the initializer for a classes ctable if the errors encountered building the table (avoids LLVM assertion failure due to incorrect ctable array size)

lib/trusted/array.l:
* Implement add( Iterable<T> v ), which adds multiple values to a Bag<T> (in this case throws NotImplementedException since add(V) is not supported for arrays)

lib/trusted/gbag.l:
* Add method add( Iterable<T> v ) to Bag<T>, which adds multiple values

lib/trusted/gllist.l:
* Make fields protected rather than private so Generic.SortedList<T> can access them
* Rename ListException ListBoundsException and derive it from BoundsException for consistency with other container classes
* Implement add( Iterable<T> v ), which adds multiple values to a Bag<T>
* Add Iterator get accessor, which is required by Iterable<T> interface
* Explicitly call toString on values when appending to StringBuffer in toString() (FIXME: may not be required now String + Enum<T> operator defined within Enum<T>)
* toString now returns plain comma separated list for consistency with other container classes

lib/trusted/gmap.l:
* Remove redundant 'extends System.Object'
* Add missing super.init() to avoid warning message

lib/trusted/gset.l:
* Remove redundant 'extends System.Object'
* Add method add( Iterable<T> v ) to Bag<T>, which adds multiple values

lib/trusted/gslist.l:
* New container template class: Generic.SortedList<T>:
- Inherits from Generic.LinkedList<T>
- Implements Generic.List<T> and its super interfaces
- A comparison proc can be passed to constructor to determine sort order, otherwise T.opCompare(T) will be used

lib/trusted/gvector.l:
* Add method add( Iterable<T> v ) to Bag<T>, which adds multiple values

main.l:
* Add warning option -WI/-Wi that enables/disables warning issued when no this or super class init() call as first statement in init() method

parsecall.l:
* Fix this or super class init() call test

parsedef.l:
* Make interfaces with no super interface inherit from System.Object so that System.Object is no ultimate ancestor of all values of class and interface type
* Only warn about no this or super class init() call as first statement in init() method if warning enabled
* Change error message issued on abort compile exception and also print stack trace is very verbose output enabled

parseexpr.l:
* Issue warning for always true 'isa'
* Abort compile of current method on call to undefined method call as preferable unrecoverable LLVM assertion failure

parseident.l:
* Implement access to fields and accessors of non-object can-treat-as-object values (arrays or proc references currently). In particularly this makes make Generic.Iterable<T>.Iterator and Generic.Bag<T>.Length accessors work for values of array type.

parsetree.l:
* Add NoWarnInit option

parsetype.l:
* Make incorrect number of arguments for template class an error rather than a warning

syntax-k.jay:
* Fix for problem with proc literal support in #K syntax


Build 1231:
* Implement proc literals or anonymous methods. In a virtual method these construct a bound method reference and hence have access to instance fields in the containing class. In a static method or initializer they construct a static method reference.

container.l:
* Add BlockStatement property that holds a list of additional statements for a class defintion. Currently used to hold MethodDef statements for anonymous methods

parsecall.l:
* Add ProcLiteral class that represents proc literal

parsedef.l:
* Add accessors to MethodDef that allow ProcLiteral to get return and argument types and to set name
* In ClassDef, run all passes on class Container's BodyStatement so any accumulated anonymous methods are compiled
* Fix warning message if super class init() method not called as first method in init()

parsetype.l:
* Tone down debug output when dump method called without CompileState argument

syntax-k.jay:
* Add rule for proc literals

syntax-l.jay
* Add rule for proc literals


Build 1230:

lib/trusted/array.l:
* call toString() on elements in toString() (previously displayed address because some potential element types could not implement toString())

lib/unsafe/stream.l:
* Implement (no-op) close() and flush() in IO.StringStream

parseexpr.l:
* Set linkage on proc thunks to LinkOnceODR rather than LinkOnceAny
* Cast virtual function pointer to target function type before calling in virtual proc thunks
* Remove debug output

type.l:
* Treat Type.ERROR as int when getting LLVM type instead of throwing an exception (as Type.ERROR is expected after compile errors encountered)


Build 1229:
* Allow root directory of runtime library to be changed via -Rdirectory option
* Bootstrap now builds against development library for all but first stage

Makefile:
* Fix bootstrap to install development library to a temporary directory and then build against it
* Remove explicit /usr from install paths and instead have PREFIX default to /usr, which gives same default install locations but makes PREFIX actually useful for installing to alternative directories
* Make compiler target now always 'lc' irrespective of LC environment variable

compilestate.l:
* Replace static LCACHE_DIR with instance runtime_dir/accessor RuntimeDir so that location of runtime library can be changed per-compile. Default is /usr/lib/lang

lib/trusted/genum.l:
* Include a reversed + operator method that will match String + Enum<T>, so things like 'IO.Std.out.println( "value: " + SomeEnum.VALUE )' now work as expected
* Make opCompare(T b, T c) static, which fixes problem where Enum<T> was not comparible via inequality operators and as a result Sort<Enum<T>> would not compile

llvm.l:
* Implement opEquals and opCompare for LLVM wrapper structs (opEquals now requirement for anything stored in an array)

main.l:
* Allow root directory of runtime library to be changed via -Rdirectory option


Build 1228:
* Change linkage attribute of symbols so:
- If compiler needs to include the same class in more than one module it does not cause a duplicate symbol error at link or dynamic load, which can happen if two independant modules linked against the same library or executable are then loaded together
- Allow back end and linker to discard symbols that not referenced within the module (default, -Ce option disable with -CE)
* Emit symbol for each interface selector offset (will be used to detect interface selector collisions)
* Additional fixes to avoid LLVM assertion failures after compile errors encountered

Makefile:
* Link the library with -CE (export all symbols) so that unreferenced symbols are not discarded

compilestate.l:
* Implement linking bitcode executables against native code L libraries (-CL option, not yet working due to unsatisfied references from linked .so files to bc runtime)
* Set weak or linkonce linkage to symbols depending on whether export compile option set
* Allow duplicate Main class for modules not linked against libraries (this is a hack to allow the LSP example pages on website to include a Main class so same code can be run in a web page or standalone)

container.l
* Set appropriate linkage on all symbols according to export option
* Output symbols for interface selector offsets

main.l:
* Add export (-CE/-Ce) and link native library (-CL/-Cl) options

parsedef.l:
* Set appropriate linkage on all symbols according to export option

parsetree.l:
* Propogate error value in makeLLVMCast rather than attempting a cast that may cause an LLVM assertion failure

symbol.l:
* Set appropriate linkage on all symbols according to export option


Build 1227:
* Clean up built-in operator and operator method resolution to be more consistent and to fix some cases where either type mismatch errors might not be issued or oppotunities to match a method operator for an non-built-in operation might be missed.

lib/unsafe/gproc.l:
* Move to unsafe lib directory as can currently be used to call arbrary address
* Supress compile warnings

lib/unsafe/serial.l:
* Move to unsafe directory as can be used to construct arbitrary objects

parsecall:
* Sanity checks to prevent LLVM assertions after earlier compile errors

parsecond.l:
* Sanity checks to prevent LLVM assertions after earlier compile errors

parseexpr.l:
* Support char literals in array initializers
* Support base 16 char literals
* Clean up operand type checking and method resolution for operators so that:
- Valid built-in operations always matched before any operator methods searched
- Invalid built-in operations result in an error and search stopping
- No matching built-in operation results in both normal and reversed operator method search irrespective of argument types
* Attempt to avoid LLVM assertions after earlier compile errors

parseloop.l:
* Attempt to avoid LLVM assertions after earlier compile errors

parsetree.l:
* Use LLVMInt32Type for error values rather than void to reduce odds of LLVM assertion fails after compile errors

type.l:
* Add additional methods that check Type's TypeKind for specific types


Build 1226:
* Ensure that when opEquals is called for a '=~' operation on object operands that operands are not equal and not null before calling opEquals()
* Enums now behave like other primitive value types:
- Boxable to instance of System.Enum<T>, where T is the enum type, explictly via .box attibute
- Implement standard value type subset of System.Object's protocol, including methods toString(), opEquals(), opCompare(), via transparent rewriting of these calls to static methods in System.Enum<T>

lib/trusted/array.l:
* Remove null check in contains() (redundant now that =~ handles null operands correctly)

lib/trusted/genum.l:
* Implement remainder of System.Enum<T> with same protocol as other primitive types

parsecall.l:
* Check for reference equality and reference inequality where one or more arguments null and return true or false respectively immediately in those cases without calling opEquals for '=~' operator.
* Remove debug output

parsedef.l:
* Remove debug output

parseexpr.l:
* Remove debug output

parsetree.l:
* Revert change that made System.Enum<T> class into a struct. Instead treat enums the same as other value types - boxable to an instance of System.Enum<T> via .box attribute
* Remove debug output


Build 1225:
* Implement boxing enumerations to struct Enum<T> (resulting values not actually useable yet as a bug is causing structs to have a vtable)

container.l:
* Add turnIntoStruct() that unlinks a class from its super class and changes it into a structure (temporary hack for enum boxing as do not have generic structs)

parsedef:
* Create generic box types for enums in checkTemplates pass

parsetree.l:
* Support creating generic box types for enums

type.l:
* Fix Type.equals(Type) for struct and enum arguments


Build 1224:

lib/trusted/array.l:
* Fix contains to use =~ (compare value) rather than == (compare identity)

lib/trusted/serial.l:
* Use explicitly registered mapping from classes to names rather than using class names when serializing (because LSP wants to save page state classes with a consistent name but class names for pages vary across FCGI instances and page loads)
* Remove some debug output

lib/trusted/string.l:
* Add indexOf methods for char and string starting from specified index
* Fix broken comparison in UpperCase

lib/unsafe/stream.l:
* Make IO.File.exists(String) static

parseexpr.l:
* Remove debug output

token.l:
* Add '#linenumber' so LSP can have error message line numbers correct


Build 1223:
* Support serialization of objects containing pointers subject to some restrictions:
- pointer must point at non-pointer, serializable values
- pointer must point to head of a sequence of values of known length
- object must implement _get_PointerLength(int n)
* Make Generic.Vector serializable
* Library updates to improve support for word type

lib/trusted/gvector.l:
* Reorder fields so allocated length is serialized before value pointer
* Implement _get_PointerLength(int n)

lib/trusted/object.l:
* Add _get_PointerLength(int n), which the serializer uses to get the length of the n-th pointer typed field in an object. Objects with pointers that want to be serializable must override this method and return appropriate values.

lib/trusted/primword.l:
* Add fromString(String s) method

lib/trusted/serial.l:
* Add support for serializing word values
* Add support for serializing pointers with help from containing object via _get_PointerLength()
* Serialize arrays directly without having to create a dummy instance first
* Add readType() method that reads a single type table entry

lib/trusted/string.l
* Add parseWord() method
* Remove debug output

lib/unsafe/klass.l:
* Fix vtable slot number used in TypeTable property
* Add IsArray method that returns true if Class represents an array class

lib/unsafe/stream.l
* add print(word) method


Build 1222:
* Implement transparent serialization support for strings and arrays in library
* Fix bug where interface despatch entries in ctable not filled in for classes where parent class implements an interface but class itself doesn't

container.l:
* Emit interface ctable slots even if class does not implement any interfaces directly. Fixes problem where calls through interfaces could branch to bogus addresses

lib/trusted/array.l:
* Allow init to be called even though resulting object is not useable as an array because serializer needs to construct a temporary instance to detemine how to serialize object
* Override System.Object.IsArray with property that always returns true

lib/trusted/object.l:
* Add IsArray property that should return false unless object has elements after it in memory that need to be serialized

lib/trusted/serial.l:
* Change signature of fromSerial to return an Object, so it has the option of constructing a new object if the one passed in from the serializer is not suitable for some reason
* Support serializing arrays

lib/trusted/string.l:
* Support serializing strings (FIXME: serialized StringBuffers become Strings when read)


Build 1221:
* Emit additional type table entry for arrays for element type

compilestate.l:
* Mark Containers representing specialization of System.Array<T> as IsArray

container.l:
* Add IsArray property
* Emit additional type table entry for element type for classes that are a specialization of System.Array<T> as IsArray

parseexpr.l:
* add method makeGetConstArrayDataPointer that gets a constant pointer to start of array data given constant array pointer and index (used to determine offset of array data when emitting type table for array classes)


Build 1220:
* Implement transparent object serialization for objects that contain only serializable values (i.e. scalars or other objects)

Makefile:
* Build and install native object code version of runtime (lrt-llvm-<version>.o)

container.l:
* Add CallAsFinal property that == IsFinal if class is not an interface or false if it is
* Emit per field type information in class tables

lib.l:
* Include serialization code in shared library

lib/trusted/object.l
* Use same type numbers as compiler
* Update methods that reference type table to reflect changed vtable slot
* Fix problem where Class property referenced wrong vtable slot

serial.l:
* Add register(Class) method that registers a class using it's class name as it's tag (FIXME: won't work for classes with spaces in the name - i.e. Proc<>)
* Implement transparent serialization by walking field type tables to determine serialization action for each field unless class is marked as implements Serial, in which case explicit toSerial or fromSerial methods are called.

lib/unsafe/walk.l:
* Fix to use updated type table format (untested)

parseexpr.l:
* Change makeInstance so it can also calculate constant field offsets (used by type table generation to keep bitcode pointer size independant)
* Change references to IsFinal to CallAsFinal when deciding whether to call virtual methods dynamically or statically

parsetree.l:
* Fix incorrect landing pad generation for finally clauses (wrong argument type to llvm.eh.selector caused landing pads to have no action, which caused the runtime to issue a warning)


Build 1219:
* Add simple serialization support to library (not transparent - requires explicit support from serializable classes to write to/read from serialization stream)
* Fix class<type> construct
* Make Class object for a given class unique by including a static Class object for each class in the class's module referenced from a slot in the vtable where previously various ways of creating a Class all created a new instance of Class on each call (FIXME: need to fix System.Library to use same mechanism to locate newly loaded classes)

container.l:
* Fix naming of per interface id global variables to include prefix '__interface_' before decorated name
* Add getClassGlobal method that returns address of static Class instance for a given Container, creating the LLVM global variable if it doesn't exist in the current module
* Remove dead code
* Place a reference to class's static Class object in ctable in emitTables() (in currently unused type table slot to avoid breaking existing code)

lib/trusted/serial.l:
* Clean up code

main.l:
* Remove debug output

parsedef.l:
* Create static Class instance for each class compiled

parseexpr.l:
* Fix class<type> construct (FIXME: use of '<'/'>' in this syntax is not consistent with other constructs involving types)
* Remove debug output


Build 1218:
* Warn and always return false for 'isa' for type where no runtime type information available
* Clean up after implementing 'isa' and runtime interface type checks

container.l:
* Remove debug output

lrt-unwind.c:
* Remove debug output

parsecall.l:
* Remove debug output

parsedef.l:
* Remove debug output

parseexpr.l:
* Remove debug output

parseexpr.l:
* Warn and always return false for 'isa' for type where no runtime type information available
* Remove debug output

symbol.l:
* Remove debug output


Build 1217:
* Complete runtime type checking of casts to interfaces
* Implement 'isa' construct that performs runtime type testing against class and interface types

container.l:
* Uncomment code that forceably overrides Object._implements() with current class's __implements_ method when class tables are being output

parseexpr.l:
* Add class IsA that implements the 'isa' construct
* Move methods for emitting code for testing if an object is a paricular class or subclass of that class and for testing if an object implements a particular interface out of Cast and into Expression
* Remove runtime check warning now as cast checks are working again

syntax-l.jay:
* add isa construct (isa some_type(x) for example: isa List<String>({"test"}) == true)

token.l:
* add 'isa' keyword


Build 1216:
* Progress towards run time type checking for interfaces

container.l:
* Split getting LLVM function type for __implements_ function out of getImplementsFunction into getImplementsFunctionType
* Fix linkage for per interface global variable (initialize it to null and set with link-once-any linkage so we get exactly one copy in the program)
* Forceably override Object._implements() with right __implements_ function for class in emitClassTables (commented out until re-bootstrapped)
* remove dead code

lib/trusted/gvector.l:
* Don't wrap toString result in '[Vector' and ']'

lib/trusted/object.l:
* mark _dispose() as @Virtual (FIXME: @Virtual may not be neccessary)
* add _implements() method and mark as @Virtual (FIXME: @Virtual may not be neccessary)

parseexpr.l:
* warn and mark unsafe if non-object is cast to an object (although cast is run time checked the check itself is not safe if the source type is not object since it dereferences an untrusted pointer)
* add makeInterfaceCastCheck that emits code that calls an object's __implements_ method to determine if it implements a given interface and either returns a boolean or throws a cast exception
* add makeObjectCastCheck that emits code that determines if an object is an instance of a specific class and either returns a boolean or throws a cast exception
* if a cast requires a runtime check emit either an implemented interface or class instance test (previously only class instance tests were supported)

syntax-k.jay:
* support pragmas within block statements

type.l:
* add isInterface() method that returns true if a type is an interface


Build 1215:
* Work towards run time type checking for interfaces
* Small additions to library

container.l:
* add getImplementsFunction, which refers to a function for a class that takes an interface global variable and returns true if that class implements the interface
* add getInterfaceGlobal, that returns the address of the global variable for an interface (which is just used as a handle to uniquely identify the interface)
* use updated Generic.Sort<T> to sort interfaces prior to selector coloring

lib/trusted/gsort.l:
* add a new class, Generic.Sort<T>, that can override sort order via a supplied element compare proc reference (defaults to T.opCompare(T))

lib/trusted/object.l
* add opEquals and opCompare methods

lib/trusted/primlong.l:
* add fromString method

lib/trusted/primtype.l:
* add fromString methods (having same name for this across types makes it more useful in templates than String.parseXXXX()).

lib/trusted/string.l:
* support parsing and formatting longs

lib/unsafe/stream.l:
* additional constructor for IOException without os_error parameter
* add print methods that print chars, ints and longs directly

parsecall.l:
* fix problem where creating proc reference could cause compile time SEGV in some cases

parsedef.l:
* emit a function for each class that takes an interface global variable and returns true if that class implements the interface

parsetree.l:
* relax array subscript LLVM value type check to test for any integer type rather than only 32-bit integer

symbol.l:
* fix incorrect ordering in Quality.opCompare that caused less specific overloads to be preferred when creating proc references


Build 1214:
* Limited support for searching box classes when creating proc references (currently only works if left value is a (non-type) expression or a type identifier, which is enough for the library template classes' needs)

Makefile:
* Fix install path for lang.so

compilestate.l:
* Fix link path for dummy.o

lib/trusted/gproc.l:
* Fix compile error

parsecall.l:
* Add check around suspicious code that checks isClass on method call left value to determine if static rather than method.IsStatic
* Search left value box type for proc method if left value is not a class
* Remove bogus isObject/CanTreatAsObject test when creating proc references
* Simplify logic when compiling proc reference creation
* Improve error reporting when compiling proc reference creation

parseexpr.l:
* add isType() method

parseident.l:
* implement isType() method that returns true if identifier is a type variable (and hence has no value)


Build 1213:
* Fix comparison orderings in opCompare throughout library

Makefile:
* run jay with -v to create y.output

lib/trusted/primlong.l:
* remove from bits specific directories as no bits dependant code
* fix opCompare order

lib/trusted/primword.l:
* remove from bits specific directories as no bits dependant code
* fix opCompare order

lib/trusted/primtype.l:
* fix opCompare orders

lib/trusted/string.l
* fix opCompare order

parseexpr.l:
* change names for proc thunks to better match their purposes

parsetype.l:
* add missing call to clear()


Build 1212:
* Support references to virtual methods:
- can be used to call a virtual method as if it were static
- can refer to any virtual method with correct signature
- take an additional initial parameter that is the object to invoke the virtual method on
- the actual method called is resolved at call time depending on the type of the first argument

A reference to a virtual method is created if:
- proc ref first argument is a class
- left value of requested method is assignable to that class
- a method is found that matches the proc ref type with the first argument type removed and this method is a strictly better overload match than any method found by regular static or bound method search (for example void proc(Test,int)(Test.test) would match test() in class Test { void test(int) { } })

* Change syntax of proc reference creation to include return type. This fixes a problem where it was not possible to resolve types of proc references early enough in compilation in some circumstances.
* Fix problem where redefining a static method in a subclass caused an exception (FIXME: currently this is allowed although the resulting semantics are not defined. Should determine if behaviour is reasonable and issue a warning or an error as appropriate.

container.l:
* Support return type for proc reference creation expression
* Use supplied return type to make sure concrete version of Proc<P> exists in checkTemplates() (Not previously possible as return type was not known until compile pass. Fixes 'wrong pass should have been done earlier' errors)
* Check if method is static before attempting to get its address when building class tables (fixes an exception due to address not valid if static method redefined in subclass)
* Support creating unbound references to virtual methods
* Remove debug output

parseexpr.l:
* Support creating unbound references to virtual methods including required thunks
* Remove debug output

syntax-k.jay:
* Include return type in proc ref creation syntax

syntax-l.jay:
* Include return type in proc ref creation syntax


Build 1211:
* Update JIT library to work with current LLVM
* More Makefile fixes

Makefile:
* Only set defaults values for LLVM_CC and LLVM_CXX if not already set
* Create safe directory before install if it doesn't already exist
* Remove '-N' option from dependancy generation command line
* Add rules for building parsers from grammars

jit.cpp:
* Switch from ModuleProvider (removed from LLVM) to getLazyBitcodeModule

llvmc.cpp:
* Remove unreferenced include of llvm/Support/Streams (removed from LLVM)

compilestate:
* Make dependancies referencing library directory reference ./lib


Build 1210-1:
* Remove debug output

Makefile:
* Only set defaults values for LLVM_CC and LLVM_CXX if not already set

parseexpr.l:
* Remove debug output


Build 1210:
* Fix problem in 1209 where virtual method calls broken
* Add 'bootstrap' target to Makefile that bootstraps compiler and sanity checks result

Makefile:
* Add 'bootstrap' target that that bootstraps the compiler three times (/bin/lc -compile-1-> ./lc1 -compile-2-> ./lc2 -compile-3-> ./lc3)and checks that the last two resulting executables (./lc2 and ./lc3) are identical

parseexpr.l:
* Fix problem where wrong this parameter passed to makeCrowbarCall resulting in generated virtual method calls jumping through hyperspace


Build 1209:
* Restore support for proc references (previously disabled on LLVM back end)
* Support compile shared libraries via bitcode object files, which enables global optimization within the shared library

Makefile:
* Compile and install L shared library (relies on changes to llvm-ld to support '-shared' option)
* Default to -w (no standard library) when building but allow overriding via LFLAGS

compilestate.l:
* Additional linker options when compiling native PIC executable with bitcode object files (FIXME: not all needed now added '-shared' support to llvm-ld)
* Recognise '.so' as a valid object file extension
* Add missing relocate option to llc command line when compiling to native object code (fixes problem where object files not position independant despite -CP option)

container.l:
* separate out code for getting LLVM function type for a given L method into a separate method (Container.getLLVMFunctionType())

jit.cpp:
* prototype mechanism for freeing global variables after modules loaded and compiled in attempt to determine what is leaking when loading LLVM modules (not enabled)

lib/trusted/gproc.l:
* change types of opaque members (thunk address, bound object reference, target method address) from word to char ptr to simplify (reduce number of casts required) proc reference creation and call bitcode.

parsecall.l:
* create proc references support
* call through proc references support

parseexpr.l:
* separate out code that gets a function pointer from an object's vtable into a separate method
* separate out code that casts all arguments to matching LLVM types and calls a function into a separate method
* call through proc reference support
* support creating thunks required to call through a proc reference to a given method
* call through proc references support
* create proc references support

parseident.l:
* fix references to compileLoad to add (null) return type parameter required by proc reference support


Build 1208:
* Implement compiling to native object files, which trades code quality for compile speed. Builds where only a subset of source files changed get a speed up plus enabling parallel backend via -jN regains its benefit as native code generation parallelized. Build times for compiler itself back down to around 11 seconds as with old back end (although total amount of code compiled is somewhat lower as old back end is gone)

Makefile:
* Allow lc compiler and compile flags be overridden via environment variables LC and LFLAGS

compilestate.l:
* Support compiling to bitcode or native object files
* Split WantNative into WantNativeExecutable and WantNativeObjectFiles
* Use either gcc or llvm-ld as linker depending on WantNativeObjectFiles option
* Compile bitcode to assembler and assemble to native object file if WantNativeObjectFiles option set
* Reenable WantPIC option (untested)

main.l:
* Rename -N/-n option that selects native or bitcode executable to -CN/-Cn
* Add -CB/-Cb option that selects native or bitcode object files (FIXME: really need to sort this option names out)

needcompile.l:
* Use CompileState .getObjectFileName to determine object file name for class, which knows whether file should end in ".bc" or ".o"

parsedef.l:
* Call CompileState.writeOrAssembleBitcode to write out and, optionally, compile to assembler and assemble to native object file


Build 1207:
* Support building compiler and library to .zip file for install on another machine via unzip

Makefile:
* Build runtime bitcode file
* Support install to arbitrary prefix
* Fix inconsistencies in library directories for various installed files
* Support install to a .zip file by installing to directory in /tmp and then zipping the result
* Preserve dates on installed files and don't overwrite existing files if newer
* Add 'clean' target
* Include $(MODEL) on C/C++ compiler command lines in case we're cross compiling
* Build and install fcgi.o

common/exception.c:
* Move into main source directory

compilestate.l:
* Bodge make dependancy file generation so library appears in current directory (fixes problem where dependancy generation sees installed library but we want it to see changes in the as-yet-uninstalled ./lib source directory. FIXME: need a clean solution for this)
index 928e9bd..a36bec4 100644
* Search current directory first when searching for source files
* Make library directory search order more consistent

jit.cpp:
* Rename some variables for style consistency with rest of codebase
* Disable optimization by default, enable by calling __JIT_enable_opt() before loading any modules
* Delete bitcode for functions after they're compiled

lib/amd64/*:
* remove as no longer referenced

lib/linux-x86-64/unsafe/jit.l:
* fix path for import of jit.o (FIXME: need a cleaner way to implement imports of .o files - should search either library or source path)

lib/trusted/string.l:
* implement System.StringBuffer System.String.replace(char replace, char with);

lib/x86/*:
* remove as no longer referenced

parseexpr.l:
* mark String literal objects as constant

parsetree.l:
* mark C string literals as constant


Build 1206:

Makefile:
* Generate dependancies from source (so lc works better with make)
* Add 'install' target
* Build C/C++ object files in working directory and only copy to install directory on 'make install'
* Fix library build
* Install library by copying rather than having a symbolic link to the source directory

compilestate.l:
* Add WantPrintDeps option that generates a dependancy file from set of files visited

jit.cpp:
* Rename lli.cpp (originally derived from LLVM lli.cpp) to jit.cpp as that's what it's used for
* No longer use Linker to link loaded modules as it doesn't seem to be required, instead store a list of loaded modules and search this list when searching for functions by name

main.l
* Remove unused -D/-d options that used to generated debug information
* Add -D option that generates dependancies (FIXME: consider changing to -M to match GCC)


Build 1205:

Makefile:
* build JIT wrapper jit.o

lib/unsafe/stream.l:
* add exists static method and Exists property

lli.cpp:
* delete builder and linked modules after use (FIXME: still seems to consume a huge amount of memory for tiny amounts of loaded bitcode)

compilestate.l:
* search lib/<target-id>/unsafe before lib/unsafe to allow target specific unsafe libraries


Build 1204:

* Implement 32-bit x86 support

compilestate.l:
* add RuntimeFunction.GET_L_EXECPTION that calls __get_l_exception to extract the L Exception object reference from a struct _Unwind_Exception_L
* add Want64BitTarget option
* replace Machine.NAME with CompileState.TargetISA (last vestiges of Gen.Machine now gone)
* add String TargetID property that returns a triple: OS name-target ISA name-pointer bits
* search LIBRARY_DIR / TargetID for target specific libraries

exception.l:
* work around undiagnosed SEGV in _Unwind_Backtrace on 32-bit x86 by simply not populating backtrace on non-64-bit system

llvm/lrt/Makefile b/llvm/lrt/Makefile:
* make install directory and paths to C and C++ compilers configurable via environment

llvm/lrt/unwind.c:
* use malloc and free rather than GC_malloc to allocate _Unwind_Exception_L structures
* nest _Unwind_Exception structure inside _Unwind_Exception_L rather than trying to copy its layout
* implement __get_l_exception, that extracts the L Exception object reference from a struct _Unwind_Exception_L so bitcode does not need to know its layout
* remove some debug output when creating _Unwind_Exception_L structures
* remove a load of unused code from personality function as we always want our landing pads called irrespective of exception type

llvm/machine.l:
* remove more unused code (FIXME: this file can go now)

main.l:
* disable GC on startup while debugging 32-bit target
* fix option parsing problem for options where value or sub-option in following command line argument
* add -m32 and -m64 command line options

parseexpr.l:
* remove use of broken Type.Size property when compiling casts
* throw quieter exception on encountering parse tree node with no type assigned as this happens often after errors and backtrace is distracting (FIXME: should fix underlying problem here)

parsetree.l:
* use __get_l_exception to get L Exception object reference from _Unwind_Exception in landing pads
* remove redundant references to broken Type.Size property

type.l:
* return either 32-bit or 64-bit integer LLVM.Type for Type.WORD depending on Want64BitTarget (FIXME: it would be nice if we could emit 32-bit/64-bit agnostic bitcode - so far this is the only place that's conditional on word size)


Build 1203:
* Implement runtime cast checks
* Only validate modules once after all methods compiled
* Only validate modules and functions if no errors have occurred yet

compilestate.l:
* add support for RuntimeFunction.THROW_CAST, which calls System.CastException.throwCast()
* remove unused WantProfile option
* add WantCastCheck option

trusted/exception.l:
* add System.CastException.throwCast(), which is called when invalid casts are detected

lib/unsafe/stream.l:
* fix missing System qualifier on String type that broke build

main.l:
* enable WantCastCheck option by default
* remove redundant -A/-a option
* add -CC/-Cc options that enable/disable cast checks

parsedef.l:
* don't warn for missing static methods in libraries (FIXME: 0 was a bad choice of address for static methods as it's not possible to determine if the method is present in a library)
* only verify modules after class is completely compiled and only if no errors occurred (should be slightly faster and avoid some spurious errors from LLVM after compiling classes that contain errors)
* only verify functions if no compile errors have yet occurred

parseexpr.l:
* add checks to casts where required to ensure value is reference to object of compatible class (FIXME: should move the throw call to the method end)

parsetree.l:
* add NoCastCheck pragma
* remove NoProfile pragma


Build 1202:
* Fix a problem where array bounds checks could generate invalid LLVM bitcode
* More null check fixes

compilestate.l:
* revert SEGV handler support

stream.l:
* implement IO.Writer.toString() to display IO.CharStream it's writing to

parsecall.l:
* if left value of a MethodCall is super or explicit this, do not supply left value to compleLoad (avoids a redundant null check in this case)

parseexpr.l:
* move null check when attempting to get array size before GEP rather than relying on null check in makeLoadIndirect (fixes problem where operations on null arrays did not result in a null pointer exception because tested address had one word offset applied)
* handle call through super class with null from (FIXME: code for call through super with non-null from should be removed)
* add null check before proc call

parsetree.l:
* add unreachable statement after array bounds check (fixes problem where bounds checks could cause LLVM assertion failure)
* add explicit null check on array subscript if array bounds check not enabled (fixes problem where array subscript with null pointer check enabled but bounds check disabled could fault instead of throwing null pointer exception)


Build 1201:
* combine duplicate runtime exception throws into single call where possible

common/exception.c:
* change __segv_handler to call System.MemoryException.throwME() on SEGV signal (untested)

compilestate.l:
* store outermost throw null and throw bounds basic blocks in CompileState

* write out address of static functions as zero when writing library hash files
* call __install_segv_handler in __entry_point
* used modified name for llvm-ld as L version forces relinkable executables, which breaks llvm-gcc if it tries to use our linker

container.l:
* do not allocate vtable slots for static functions
* do not include addresses of static functions in class hashes (since they're now always zero)
* issue warning if attempting to override static function with virtual or vice versa

lib/trusted/exception.l:
* add static void MemoryException.throwME() that runtime uses to create and throw an exception on SEGV signal

llvm.l:
* add toString() method to struct BasicBlock so it can be stored in a Generic.Vector
* support adding basic blocks that are output at the end of the IRBlock (used to put exception throw code out-of-line)

parseexpr.l:
* add explicit null check before calls through non-this
* remove redundant null check on this (as null checks on calls should ensure that this is never null)

diff --git a/parsetree.l b/parsetree.l
* merge multiple ArrayBoundsException and NullPointerException throws into single function call per exception type per exception handler block, which reduces the bloat from explicit null + bounds checks and should mean the branches default to predicted not taken (at least in non-optimized code)
* move test for WantNullCheck option into addNullCheck so it applies to all null checks and not just ones resulting from makeLoadIndirect()
* remove now redundant null check in addStoreIndirect()
* remove debug output in ErrorValue
* add staticError that prints an error message and sets the errors occurred flag (FIXME: buildClassTables needs to be able to issue errors including source file name and line number)
* remove redundant null check flag from addStoreIndirect in assignment (FIXME: not sure addStoreIndirect needs this flag at all)

symbol.l:
* debug output if Symbol.Address called on symbol with no valid address


Build 1200:

* Fix problem where incorrect object size stored in ctable causing Class.create() to construct corrupt objects

Makefile:
* Don't link against pre-linked standard library (avoids problems where changing library classes can result in a compiler that can't create executables)

compilestate.l:
* Only link in dummy.o (stubs for unimplemented runtime functions) if WantLinkLibraries set

container.l:
* Store LLVM constant expression for object size in ctable size slot rather than Container.Size since this value is not correct (fixes problem where Class.create() caused memory corruption due to incorrect size of constructed objects)

lib/trusted/object.l:
* Check this is not null in _dispose (FIXME: this works around an as yet undiagnosed problem where the GC calls Object._dispose() on null objects)

llvm.l:
* Add LLVMConstTypeSizeIndirectPointer(Type) that returns a type's size as a constant pointer to that type. This is required for storing object size in ctable where we want to avoid casting a potentially 64bit pointer through a 32bit integer and back (there's no chance of information loss in this particulara case but the cast is not implemented by the LLVM code generator)

parsedef.l:
* Work around a problem where occasionally no hashes appear to be stored for a class in a library even though the class itself is present


Build 1199:
* return zero from main()

common/exception.c:
* return zero from main()

compilestate.l:
* attempt to set --export-dynamic linker option to make executables relinkable (FIXME: doesn't work - currently bodged in llvm-ld instead)

lib/unsafe/library:
* add static methods to locate a class searching all libraries (which is only behaviour supported right now anyway)

parsetree.l:
* honour WantNullCheck option
* check value is pointer before issuing null check (fixes crash if null check emitted for error value)

symbol.l:
* set DLLExport linkage on static variables to make executables relinkable (FIXME: may not be required)


Build 1198:
* Fix null check issue and enable null checks by default
* Fix option parsing issues

main.l:
* fix problem where sub options in following program argument caused options to be mis-parsed (FIXME: this escaped undetected for a long time because type checking on arithmetic operations is incomplete)

parseexpr.l:
* change null check on instance variable loads to check this pointer for null not the address of the instance variable


Build 1197:
* Support compilation directly to native code (-N option)
* implement null pointer checks
* reinstate array bounds checks

Makefile:
* use -N native output option rather than compiling to bitcode and then running lcc and g++

compilestate.l:
* add RuntimeFunctions THROW_NULL and THROW_BOUNDS
* add WantNullCheck flag
* add OptimizeLevel option, which currently just disables optimization if set to zero and enables it otherwise
* add WantNative flag
* add WantForceLink flag
* add WantOneFile flag, which compiles all bitcode into single module rather than one module per class
* don't link if no code generated and output file exists unless WantForceLink flag is set
* remove WantPIC flag
* remove WantRedZone flag (FIXME: may want to revert this as LLVM has an equivalent function attribute)

lib/trusted/exception.l
* add static NullPointerException.throwNPE() method, which is used to construct and throw an exception on failed null pointer checks
* add static ArrayBoundsException.throwBounds() method, which is used to construct and throw an exception on failed array bounds checks

main.l
* default to OptimizeLevel = 1
* add C option that enables/disables runtime checks
.. -CA/-Ca enables/disables array bounds checks
.. -CN/-Cn enables/disables null pointer checks
* add f flag that forces link even if no classes compiled
* change L option to l for consistency with other compilers
* change l option to s
* remove P option
* change S option to T
* add S option that compiles into a single module rather than multiple modules followed by link
* add W/w option that enables/disables the standard library
* add N/n option that enables/disables native code executable
* remove obsolete code generation options

needcompile.l
* support single module compile

parseexpr.l:
* remove dead code
* null check on dynamic method call

parseident.l:
* remove a redundant null check

parseloop:
* remove dead code

parsetree.l:
* switch from using llvm.eh.selector.i64 to llvm.eh.selector
* null check on store as well as load
* remove dead code
* add NoNullCheck pragma
* use invoke instead of call for array bounds check fail if active exception handler

parsetry.l:
* use 32 bit local for current exception type rather than 64 bit
* use pointer rather than 64 bit integer for exception value when calling LLVM llvm.eh.exception and llvm.eh.selector (should make code 32/64 bit agnostic, untested)


Build 1196

* Add llvm.l source file, which was missing from repository


Build 1195:
* Fix problem where classes always compiled even if .bc object file current with respect to source (due to struct size issue causing garbage results for IO.Stat)

Known problems:
* structs are treated as if they have a vtable pointer both when allocated and when computing field addresses (which is consistent but breaks interfacing with C or other code that doesn't expect the additional pointer sized hole at the start of the struct)

common/exception.c
* work around struct size issue in __stat_file

lib/unsafe/library.l:
* drop .so support
* implement .bc support

needcompile.l:
* fix problem where object file existence and date check used '.o' file extension instead of '.bc'

parsedef.l:
* output a __get_ctable function for every class that can be used by System.Library to locate dynamically loaded classes

parseexpr.l:
* remove debug output

type.l
* remove debug output


Build 1194:

Reenable shared library support:
* Support creating a library .bc file plus .lh library hash file
* Support static linking against a library .bc file as defined in corresponding .lh library hash file
* Support dynamic linking against a library .bc file as defined in corresponding .lh library hash file
* Initial changes to LLVM lli to support dynamic loading and linking of bitcode files

Makefile:
* build lc using library in lang.bc

compilestate.l:
* add WantLinkLibrarys property. If true will link library bitcode into output executable bitcode, otherwise required library bitcode must be linked at runtime when executable is loaded.
* change library hash file extension from ".ll" to ".lh" to avoid name clash with LLVM assembler files
* remove debug output
* change shared library file extension from ".so" to ".bc"
* don't link in runtime if building a library
* add WantLinkLibraries property that, if true, statically links in referenced .bc libraries

string.l:
* don't allocate excessively long StringBuffers for results of String.split(char)

llvm/lrt/unwind.c:
* remove debug output

main.l:
* remove debug output
* add a new command line option -U/-u, which enables/disables static linking against bc libraries, default is -U
* change library hash file extension from ".ll" to ".lh" to avoid name clash with LLVM assembler files

parsedef.l:
* alter code emitted for static init functions to check if function has already been run and return immediately in that case.
* issue warning if class hash differs between current source and stored library hash (FIXME: not clear why this is failing for some library classes even though all stored method offsets appear to match)
* remove redundant call to state.addLinkFile which broke static library linking


Build 1193:
* Fix GC roots for JIT

generator.l:
* remove file

intermediate.l:
* remove file

llvm/lrt/unwind.c:
* when a GC root is added, expand existing GC root region to include it rather than adding a new region (fixes problem where roots not correct because static variables not contiguous within a class under JIT)

mblock.l:
* remove file

mflow:
* remove file

mframe:
* remove file

mtree:
* remove file

parsedef.l
* call __add_root for each static variable rather than __add_roots for range (fixes problem where roots not correct because static variables not contiguous within a class under JIT)


Build 1192:
* Remove old back end
* Implement exception backtraces (not yet useful as backtrace_symbols() doesn't resolve function addresses to symbols for some reason)
* Build fixes to enable compiler to run under JIT (FIXME: requires GC be disabled so presumably static variable roots still not correct)

Makefile:
* build llvmc.cpp as shared library for compiler to link against when run under JIT
* build optimized and non-optimized bitcode executables

compilestate.l:
* remove references to old back end
* return __alloc_object_finalize as runtime function for finalizable object allocation (fixes problem where finalizers not run on garbage collected objects)
* store value of enum members as constant LLVM.Value rather than integer (allows removing reference to old back end constant folding code)

container.l:
* remove references to old back end
* if a symbol has no valid address but has a constant LLVM.Value then use that value as the symbol's hash when calculating hash over container's members

lci.sh:
* script to run compiler bitcode executable under JIT

lib/trusted/exception.l:
* backtrace support using C library functions backtrace() and backtrace_symbols()

lib/unsafe/stream.l:
* make open mode constants public

llvm/llvmimports.l
* remove redundant reference to LLVMBitWriter library (FIXME: this whole source file is now redundant)

llvm/lrt/unwind.c
* remove debug output

llvm/machine.l
* remove references to old back end

llvmc.cpp:
* add LLVMGetConstValue(LLVMValueRef) that gets the value of it's argument, which must be a constant integer

main.l:
* remove references to old back end

mbitset.l:
* remove references to old back end

parsecall.l:
* remove references to old back end

parsecond.l:
* remove references to old back end

parsedef.l:
* remove references to old back end
* store value of enum members as constant LLVM.Value rather than integer (allows removing reference to old back end constant folding code)
* sanity test to check all static variables have GC roots added
* store value of constants as as constant LLVM.Value rather than integer (allows removing reference to old back end constant folding code)

parseexpr.l:
* remove references to old back end

parseident.l:
* remove references to old back end
* store value of constants as as constant LLVM.Value rather than integer (allows removing reference to old back end constant folding code)

parseloop.l:
* remove references to old back end

parsepackage.l:
* remove references to old back end

parsetree.l:
* remove references to old back end
* keep reference to a dummy IRBlock used when compiling expressions that are expected to be constant
* fix for problem where pragmas not applied correctly (untested)

parsetry.l:
* remove references to old back end

parsetype.l:
* remove references to old back end

symbol.l:
* allow get Address property for symbols with no valid address, with warning message, for debugging purposes


Build 1191
* Reenable garbage collection in lc
* Remove debug output

lib/trusted/gvector.l:
* remove debug output

llvm/lrt/throw.cpp:
* remove debug output

main.l
* do not disable garbage collection on compiler start

parsedef.l:
* remove debug output

parseexpr.l:
* remove debug output

parseident.l:
* remove debug output

parseloop.l:
* remove debug output

parsepackage.l:
* remove debug output

parsetree.l:
* remove debug output

parsetry.l:
* remove debug output

symbol.l:

Build 1190:
More LLVM fixes:
* now bootstraps with LLVM back end (statically compiled with llc)
* remove unused dependancy on LLVM JIT
* allow import of .bc files (same as importing .o)
* fixes for Boehm GC

compilestate.l:
* remove references to unused LLVM JIT
* recognize ".bc" as an object file extension when importing

container.l:
* fix interface offset calculation for LLVM
* emit a call to GC_add_roots() in __static_init for classes with at least one static variable

lib/trusted/exit:
* debug output (mostly commented out)

lib/trusted/gvector.l:
* treat all vectors as having reference elements (FIXME: T.isreference is currently broken)
* handle printing vectors with null elements
* debug output

lib/trusted/string.l
* debug output
* disable Freeze

llvm/lrt/unwind.c
* debug output
* work torwards exception backtraces
* return cleanly if version < 0 in handleLsda since this function must be called to be JIT'd before any exception is thrown

main.l
* initialize garbage collector on startup (FIXME: probably not needed)
* disable garbage collection on startup (FIXME: may no longer be needed)

parsedef.l
* emit call to debug output at start of __static_init for each class with static variables
* emit call to __add_roots for each class with static variables (FIXME: is this done, incorrectly, only for classes with static initializers?)
* debug output for interface calls

parsepackage.l
* debug output

parsetree.l
* avoid using static variable in newline() (FIXME: no longer needed)

symbol.l
* set LLVM Values for first and last static variables in class via Container.hasStatic()

Build 1189:
More LLVM exception handling fixes

parsetree.l:
* store unwind struct pointer in ExceptionDescriptor as well as L exception object
* rename ExceptionDescriptor fields for clarity

parsetry.l:
* when jumping to outer exception handler due to unhandled exception within function, propogate unwind struct pointer as well as exception type and L exception object (fixes problem where return with active exception handler returns garbage)

Build 1188:
More LLVM exception handling fixes

parsetry.l:
* fix rethrow/return test after outermost exception handler (untested)
* forward current exception type and L exception object to outer handler on unhandled exception (FIXME: this won't work if the exception is a return - need to forward the original unwind exception struct as well here)
* change names of locals used to hold in flight exceptions to make purpose clearer
* push L exception object onto exception descriptor stack not unwind struct pointer (FIXME: really need both - see above)
* store 'caught' flag in exception type on entry to try body so default handler action is to run finally block and swallow exception rather than propogating an empty exception

Build 1187:
LLVM exception handling fixes

compilestate.l:
* add InBottomExceptionHandler propery

throw.cpp:
* print address of thrown exception for debug purposes

unwind.c:
* allocate additional word after end of _Unwind_Exception structure to store pointer to L exception object
* wrap debug output in macro so it can be suppressed conditionally

parsetree.l
* declare __l_personality as vaarg (FIXME: probably no required)
* reinstate dummy type info arg to LLVM eh selector intrinsic
* store 'exception not yet caught' flag in .eh_type on entering catch landing pad
* fix offset used to obtain L exception from unwind exception structure

parsetry.l
* fix broken catch vtable test
* store caught exception in catch block parameter variable
* store 'exception caught' flag in .eh_type on leaving catch block (FIXME: flag value is wrong here)
* test .eh_type before entering catches block to ensure flag is 'uncaught exception' (FIXME: is this needed?)
* rethrow uncaught exceptions with _Unwind_RaiseException()

parsetype:
* don't throw exception if trying to display a type with no dump() method

Build 1186-8:
More LLVM fixes

lib.l
* don't import library.l as uses a proc reference that currently breaks LLVM code generation

compiler.l
* don't use Library class as uses a proc reference that currently breaks LLVM code generation

parsedef.l
* remove debug output
* force initializer for static variables (FIXME: ugly)

parseexpr.l
* fix problem where !~ compiled to null LLVM.Value causing seg fault at compile time
* return dummy value for proc calls allowing code using them to compile (to broken code)

parseloop.l
* fix foreach statements where type of loop variable is not inferred

parsetree.l
* fix problem where assigning to array accessor caused LLVM assert failure

parsetry.l
* fix problem where multiple catches for try statement caused seg fault

Build 1186-7:

Fix LLVM support for static variables including initialization of static variables on program start

compilestate.l
* run System.Startup.run1(main_object) on startup (which will give us exception catch all and on exit handling, once exception handling is working)

container.l
* add HasStatic property, which is true if the class has any static initializers

parsedef.l
* if a class has any static initializers then emit a function that runs them and append it to the global llvm.global_ctors array so the initializers run before a module loads (FIXME: need to do topographical sort of initializer dependancies and order them accordingly otherwise no guarentee that dependent initializers not initialized in wrong order)

parsetree.l
* make some standard Type values publically accessible

symbol.l
* if a symbol's LLVM static global value is referenced then mark its owner as needing static initialization
* if a symbol's LLVM static global value is referenced whilst compiling its owning class then generate a null initializer for it (fixes LLVM error if static variables referenced)

Build 1186-6
more LLVM fixes

compilestate.l
* don't link against pthread as llvm-ld places broken -load directive in lli script referencing static libpthread.a (FIXME)

parsecall.l
* remove dead code

parseexpr.l
* fix LoadTemporary to load an LLVM.Value (optionally indirect) rather than an ITree

parseloop.l
* fix foreach statement LLVM support
* no longer issue special case code for foreach over an array, instead just let elements() auto box to Generic.Array

Build 1186-5:
more LLVM fixes. Get linking and entry point working (entry point now calls Main.init() directly - really needs to call library start up)

Build 1186-4:
more LLVM backend work - linker command line and entry point

Build 1186-3:
continue back end port to LLVM. Mainly exception handling

Build 1186-2:
More progress on LLVM back end

Build 1186-1:
Progress towards LLVM back end

Build 1186:
begin support for LLVM back end

build 1185

mtree.l
* zero rax before call if called method is named 'fprintf' (indicates zero parameters in XMM registers, fixes problem where native.fprintf can crash on Amd64)

parsedef.l
* fold constants in enum initializers (fixes problem where constant expressions not accepted as enum initializers)


build 1184
* fix problem where exception backtraces were sometimes empty
* fix sandboxed compilation

common/exception.c
* additional debug output
* fix problem where exception backtraces were occasionally empty (caused by backtrace info not populated when unwind info located by binary search rather than cached lookup or initial linear search)
* use sigaltstack to setup up alternate 64kB signal stack for SEGV handler
* exit if unable to install SEGV signal handler at program startup

lib/trusted/exit.l
* fix sandboxed mode by adding NoMarkUnsafe pragma

ltest/test83.l
* don't enable GC after null pointer exceptions (no longer required)

main.l
* change copyright date to 2004-2010

mflow.l
* remove debug output

parseexpr.l
* remove debug output


build 1182

* faster temporary live range size calculation

compilestate.l
* reduce maximum inlineable method size to 25 parse tree nodes (otherwise code size increases and no performance benefit)

mflow.l
* reinstate calculate range sizes only if register variables and/or copy coalescing enabled
* simple and fast temporary live range size calculation based only on distance from first to last referencing instruction in method (i.e. linear distance ignoring CFG). Ranges are used when choosing what temporaries to consider spilling and which temporaries to split when live ranges for fixed color temporaries overlap. Exact ranges not needed as worst effect of any inaccuracies are poor descisions resulting in worse code and old accurate range size calculation was very inefficient.


build 1181
* fix bug where inlined overloaded inequalities could miscompile to the reversed version of the operator
* simplify range size calculation in order to test effect on coalescing

common/Makefile
* compile exception.c -O1

common/exception.c
* use non GC pthread functions (FIXME: why?)
* use GC_malloc instead of GC_malloc_ignore_off_page for object allocations if not using GCJ malloc
* don't attempt to trace all deallocations via finalizers

compilestate.l
* increase maximum inlineable method size

intermediate.l
* remove dead code
* sanity check on copied ITree operator number
* set size of LIST ITrees created in transformForInline to zero (prevents non-canonical LIST operator numbers being created here)
* set size of COPY ITree created in transformForInline to original size (prevents size being inconsisted with size encoded in operator here)

lib/trusted/vector.l
* reorder fields for better packing
* switch to gvector style reallocation scheme
* use GC_malloc_ignore_off_page to allocate array of vector values

lib/unsafe/thread.l
* use non GC pthread functions (FIXME: why?)

main.l
* print backtrace on fatal error

mbitset.l
* remove debug code recording largest allocated bitset

mblock.l
* convert setter functions to accessor syntax

mflow.l
* remove dead code
* range size calculation debug code
* try simple but inefficient range size calculation that iterates over live set at each instruction incrementing range sizes for each live temporary
* always calculate range sizes while debugging coalescing bug
* remove debug heap probe
* if range size identical (or not calculated) when splitting temporaries, make split decision based on number of references instead

mtree.l
* comment out unused comparison methods
* debug output names of last inlined methods
* disable GC around getMethod (FIXME: probably pointless)

parseexpr.l
* debug output overloaded inequalities
* fix for issue where inlining could break overloaded inequalities due to overwriting original comparison operator
* debug output for inlined methods

parsetree.l
* remove probeHeap()
* add NoRegVars pragma (FIXME: may be broken - state not restored when compile states popped)


build 1180

* fix null pointer handling problems
* fix bug where exceptions could fail to be caught
* add debug code to investigate contents of heap when compiling

amd64/lrt/lrt0.S
* explicitly set libgc stack bottom on program entry
* add __native_thunk that saves all callee save registers and then calls a native function (prevents problems caused by unwind not restoring registers if native function could throw an exception)

common/exception.c
* exit with error rather than just displaying warning if bad exception descriptor encountered when handling exception
* additional debug output
* fix bug where binary search by instruction address could fail to find associated unwind record causing exception not to be caught
* allow exceptions in native code with warning (they're now safe if native code called via __native_thunk)
* exit with error if SIGSEGV caught within handler
* if an exception is not caught then display uncaught exception with backtrace, if any available rather than a generic message
* allocate runtime exceptions with __alloc_object rather than GC_malloc or calloc (fixes memory corruption after memory exception caused by using memory not scanned by garbage collector to hold exception object)
* in segv handler, if faulting instruction address is null or near null then assume fault caused by call through null and get calling instruction address from stack top instead (fixes problem where some method calls on null objects resulted in exceptions that could not be caught)

lib/trusted/gc.l
* add methods to enable and disable garbage collection

lib/trusted/gvector.l
* enable test that allocates unscanned memory for vectors of non reference values

ltest/test83.l
* allocate large amounts of memory between null pointer references and display of exceptions to expose garbage collection problems

mbitset.l
* debug output

mflow.l
* debug output

parsetree.l
* add debug code to investigate contents of heap

type.l
* remove debug code that forced all 8 byte values to be treated as references by the garbage collector


build 1179

* compile speed improvement

lib/trusted/gvector.l
* do not add additional elements to end of vectors (were previously added to debug memory corruption problem)

lib/trusted/string.l
* do not add additional characters to end of strings (were previously added to debug memory corruption problem)
* comment out debugging code

main.l
* do not set maximum heap size unless explicitly requested via -M

mflow.l
* use faster range size calculation
* only calculate temporary live range sizes if register variables or copy coalescing enabled (calculating range sizes is slow. consequences of not having accurate range sizes are potentially bad split or spill descisions in exchange for approx 10% compile speed increase)
* switch sense of test when deciding which temporary to split if two temporaries requiring the same register are live at the same time (split the longer range since there's a good chance that splitting the shorter range won't help and will cause another register allocation iteration)
* fix bug introduced in previous build that broke -O1 compiliation with null pointer exception


build 1178

amd64/lrt/lrt0.S
* clear memory returned by GC_malloc_atomic

exception.c
* don't define GC_DEBUG
* make use of GC_gcj_malloc compile time dependent on USE_GCJ_MALLOC constant
* use non debug versions of GC_*
* call __alloc_object from __alloc_object_finalize rather than duplicating code
* check for null buffer in findLineNumber
* do not allocate atomic memory for backtrace buffer as may contain pointers (fixes problem where garbage collection between exception and backtrace display can cause memory corruption)

compilestate.l
* remove code used to trace now fixed no output stream bug

lib/trusted/exception.l
* use a pointer to store backtrace info handle rather than word (fixes problem where garbage collection between exception and backtrace display can cause memory corruption)

lib/trusted/gvector.l
* remove redundant 'private' access on fields
* shorted default length
* add memory corruption check code (disabled)
* alternate length extension scheme intended to waste less memory
* do not clear additional elements (allocated memory is already clear)

lib/trusted/string.l
* add memory corruption check code (disabled)
* alternate length extension scheme intended to waste less memory

mflow.l
* alternative faster mechanism to calculate temporary live range sizes (disabled)

parseexpr.l
* fix bug where arrays of non-references allocated as arrays of references


build 1177

* reduce memory use and garbage collector overhead by supplying garbage collector with pointer bitmaps
* migrate runtime to updated unwind record format

amd64/lrt/Makefile
* add version number to exception handling library file name

amd64/lrt/lrt0.S
* call __init_gcj_malloc (in exception.c) on startup that initializes the GCJ interface to Boehm GC

amd64/machine.l
* add constants describing the size and layout of the bitmap style object descriptor used by Boehm GC
* add emitDefLong with word argument to support object descriptor bitmaps, which are full word length

common/exception.c
* use vendor custom type decoration for word argument to __set_pthread_id(word) and set word System.Exception.BacktraceInfo = w
* use GC_gcj_malloc to allocate objects with non-null vtable
* increase FINALIZE_OFFSET to 2 as vtable slot 1 now occupied by object descriptor bitmap
* replace references to GC_malloc_* with GC_MALLOC_* since mixing upper + lower case version can cause crashes due to missing debug information (FIXME: why does this happen? lrt0.S calls these functions without supplying debug info and that doesn't cause the same problems)
* add dummy GC mark function __gcj_mark_proc that prints an error message and returns the stack unchanged (should never be called)

compilestate.l
* a constant for the runtime library version number and append it to all linked runtime files
* remove definition of and references to broken timing method

container.l
* first method slot is now 2 as slot 1 contains object descriptor bitmap
* add field and read accessor word ReferenceBits that holds the object bitmap descriptor
* when building class tables also build either a Boehm GC/GCJ bitmap or length descriptor describing which words in the object are pointers (bitmap if all pointers will fit, otherwise a length covering all words up to and including the last pointer)

lib/trusted/gvector.l
* revert to non atomic GC_malloc for all element types (FIXME: may not be required or else .isreference attribute is returning false for some element type that is actually a pointer)

lib/trusted/string.l
* fix bug that gave garbled results when converting word values to strings

lib/unsafe/classsize.l
* migrate from method start/method end unwind record to method start/method length unwind record

lib/unsafe/method.l
* migrate from method start/method end unwind record to method start/method length unwind record


build 1176

* fix problem where non object reference values reachable only through a Generic.Vector could be prematurely freed by the garbage collector

lib/trusted/gvector.l
* use T.isreference rather than T.isobject to determine whether to allocate atomic memory for vector elements

parseident.l
* add .isreference attribute so container template classes can decided whether to allocate garbage collector scanned memory based on whether their elements could hold references or not

symbol.l
* support .isreference attribute


build 1175

* use less conservative garbage collection settings when allocating memory

amd64/amd64.md
* split array allocation operation into two operations one for arrays of references and one for other values

amd64/lrt/lrt0.S
* split array allocation operation into two operations one for arrays of references and one for other values
* replace GC_malloc with GC_malloc_ignore_off_page for object and arrays of references and GC_malloc_atomic_ignore_off_page for arrays of other values

container.l
* don't check inheritance from System.Object in IsObject - all non-structs/non-interfaces are objects (FIXME: interfaces are always objects to - should check callers and change this)

lib/trusted/gvector.l
* remove test for huge allocations (libgc will warn anyway)
* split allocation into two operations one for vectors of objects and one for other values (FIXME: unsafe - needs to test if any reference not just objects)
* replace GC_malloc with GC_malloc_ignore_off_page for vectors of references and GC_malloc_atomic_ignore_off_page for vectors of other values

parsecall.l
* split array allocation operation into two operations one for arrays of references and one for other values
* replace GC_malloc with GC_malloc_ignore_off_page for arrays of references and GC_malloc_atomic_ignore_off_page for arrays of other values

parseexpr.l
* split array literal allocation operation into two operations one for arrays of references and one for other values

type.l
* add isReference() that returns true for any type that holds a reference to another value


build 1174

* speed up exception handling by caching rip->unwind info mappings and by using binary search rather than linear search on cache misses (reduces time spent handling exceptions when compiling from 25% to practically none)

exception.c
* speed up exception handling by caching rip->unwind info mappings and by using binary search rather than linear search on cache misses (FIXME: code intended to cache expected next stack frame based on current frame not yet working)

compilestate.l
* add some debug code to attempt to determine where compile time is spent

lib/trusted/primtype.l
* add char.isSpace() method

lib/trusted/string.l
* make System.String implement Iterable<char>

syntax-k.jay
syntax-l.jay
* modifications to make yyextract happy


build 1173

* add command line option and pragma to disable array bounds checks

main.l
* add option and pragma to disable array bounds checks
* clean up list of code generation options displayed when compiler is run with no arguments

mflow.l
* don't generate comment instructions for spills, fills, splits, eliminated copies etc unless debug output is enabled
* issue warning if any method in a class is compiled with array bounds checking disabled

parsetree.l
* avoid repeatedly calling Name accessor when matching pragma names
* add NoBoundsCheck pragma
* if CompileState.WantBoundsCheck is false then skip bounds check when generating array subscript code


build 1172
* fix bug where boolean expressions involving constant expressions could fail to compile
* fix bug where spurious BoundsExceptions thrown on amd64 if copy coalescing enabled (compiler now bootstraps with copy coalescing enabled)

Doxyfile
* fix output directory

amd64/amd64.md
* fix rewrite rules that transform branches on constant conditions to empty instructions or unconditional jumps (fixes bug where boolean expressions involving constant expressions could fail to compile)

amd64/machine.l
* reenable red zone support
* fix instruction strings where comment precedes instruction (required to prevent assembler file comment suppression also supressing the following instruction)

compilestate.l
* add WantRedZone compile flag
* add WantStatistics compile flag
* reduce maximum size of method parse tree considered for inlining from 30 nodes to 20
* add field and accessor InLastInlinePass that is used when determining whether to inline a non-leaf method
* add field and accessor CurrentMethodHasIf that is used when determining whether to inline a non-leaf method

container.l
* add field and accessor HasIf that is used when determining whether to inline a non-leaf method
* throw exception if attempting to create a class that is its own super class
* fix error message issued when a method implementing a method in an interface has an incompatible return type

footer.html
header.html
* do not include header.lsi and footer.lsi respectively as Doxygen documentation pages now embedded in a single LSP page rather than each being a separate page

intermediate.l
* add KillAfter accessor that if set to a positive value causes a cannot inline exception after specified number of intermediate code instructions are generated (used to limit size of inlined methods)

lib/trusted/array.l
* fix doc comment to remove '.' that prematurely ended the short description
* fix doc commens to reflect renaming ArrayBoundsException to BoundsException

lib/trusted/glist.l
* additional doc comments

lib/trusted/gmap.l
* remove redundant inheritance from System.Object
* Generic.Map<K,T> implements Generic.Iterable<T>

lib/trusted/gproc.l
* add doc comments
* remove broken constructors

lib/trusted/object.l
* additional doc comments

lib/unsafe/array.l
* remove broken array implementation

lib/unsafe/sqlite3.l
* fix various compile errors (FIXME: worked in the past but needs retesting)

main.l
* use CompileState.WantStatistics compile flag rather than internal field
* add -OZ and -Oz that enable or disable the red zone
* enable copy coalescing and red zone when -O1 selected
* update usage

mflow.l
* suppress indentation, dead instructions, live temporary information and other comments in assembler output if stripping debug information
* change marker for register allocator comments to 'RA'
* remove dead code

mframe.l
* reenable red zone support
* make red zone usage conditional on CompileState.WantRedZone flag
* fix bug where stack pointer needlessly adjusted by zero bytes in case where no locals or spills and red zone disabled
* remove debug output when setting up frame pointer using lea instruction

mtree.l
* add isComment() method (used when suppressing comments in assembler output)

parsecond.l
* set CurrentMethodHasIf if an if statement is encountered in the check inline pass

parsedef.l
* give up on preparing inline version of a method as soon as intermediate representation exceeds a certain number of instructions (currently CompileState.INLINE_MAX * 2 == 40)
* remove debug output when method cannot be inlined

parseexpr.l
* fix error issued when 'super.' construct used in method with no superclass to use human readable class name
* remove code that allowed inlining calls to constructors as a special case
* allow method calls within inlined methods, provided we're on the last inline pass and the inlined method contains at least one if statement (rationale is some small methods that are worth inlining test for an error condition and handle it with an exception throw or method call)

parsetree.l
* if copy coalescing is enabled and pointer size != integer size do not omit cast instruction when subscripting arrays (fixes bug where copy coalescing could cause spurious BoundsExceptions to be thrown. FIXME: cause was garbage in high 32-bits of temporary holding array index due to 64-bit spill + fill of 32-bit value - this is probably the underlying cause for this bug and coalescing merely exposed the problem by either provoking the spill or by removing an intervening move that happened to clear the high half of the register before it was used as an index. Should consider either applying this fix even when coalesing is off or fixing fills to take into account operand size of next use)

type.l
* return undefined type when searching for a method in an undefined type rather than throwing an exception


build 1171
* Reduce memory usage. Compiler will now bootstrap in 200M heap (320M with inlining on), which is around half the heap size required by the previous build
- tokenizer folds all occurances of equal strings in the input into references to a single string
- allocate instance variables using smallest allowable alignment rather than aligning to a machine word irrespective of size
- removed some redundant instance variables and rearranged others to pack better

TODO:
- figure out how to reduce memory footprint of intermediate code
- make folding equal strings in tokenizer optional to avoid any slow down if memory is plentiful

* include information about sizes of non-pointer instance variables in class type tables
* fix a bug where use of user defined operators in template classes could result incorrect operator methods being called

common/exception.c
* improve message issued when exception thrown in foreign code

compilestate.l
* support WantPack option
* add memory usage debug code (disabled, dumps classes and sizes of reachable objects)
* clean up error message for duplicate symbol
* use human readable name in error message for duplicate method

container.
* reduce memory usage by reordering fields to improve packing
* include information about sizes of non-pointer instance variables in class type tables
* if WantPack then allocate instance variables using smallest allowable alignment for size (but round total instance table size up to whole machine word)

intermediate.l
* reduce memory usage by reordering fields to improve packing

lib/trusted/array.l
* remove broken values field
* add methods to support Util.Walk (FIXME: these methods are unsafe and should not be in the trusted version of array.l)

lib/trusted/gmap.l
* reduce memory usage by reordering fields to improve packing

lib/trusted/gvector.l
* remove redundant inheritances from System.Object
* reduce memory usage by reordering fields to improve packing
* add methods to support Util.Walk (FIXME: these methods are unsafe and should not be in the trusted version of gvector.l)

lib/trusted/object.l
* add constants for type table entries
* return char ptr from get TypeTable rather than word pointer
* add methods to support Util.Walk

lib/trusted/string.l
* add Freeze accessor, which looks string up in string pool and either adds it, if not present, or returns existing value if already present (used by compiler to fold all equal strings into single value. FIXME: should probably move this out of this class as introduces a dependancy on Generic.Set<String> + Generic.Map<String,bool>)
* make System.String.copy() method return this for constant string

lib/unsafe/compiler.l
* change NoFinal pragma to Virtual

lib/unsafe/exec.l
* flush stderr after writing fork-failed error message
* vfork rather than fork (FIXME: this appears to work but actually we're performing operations between vfork and exec that are not allowed according to Linux vfork man page)

lib/unsafe/stream.l
* reduce memory usage by reordering fields to improve packing

lib/unsafe/walk.l
* visits all objects reachable from a root object exactly once calling a supplied proc reference for each reachable object

main.l
* rename profiler option from -OP/-Op to -OQ/-Oq
* add pack instance variables option -OP/-Op with default of enabled


build-1170

* fix a problem with building statically linked executables
* fix bug where pragmas might not be applied
* add -OM <heap size> option that limits compiler heap size to <heap size> megabytes
* reinstate throwing NullPointerExceptions on null dereference
* do not output HTTP header on null pointer dereference unless requested via System.Startup.HTTPMode = true

amd64/lrt/Makefile
* copy static exception.o as well as shared exception.so to lib directory (fixes issue where static link could fail)

amd64/lrt/lrt0.S
* remove '$' from symbols
* reinstate SIGSEGV signal handler

common/exception.c
* remove HTTP content type header output on SIGSEGV (intended to aid debugging LSP but library now outputs HTTP header if needed)
* remove unused __static_begin function

compilestate.l
* add WantSharedStandardLibrary flag that links against lang.ll+lang.so+exception.so if set or just exception.o otherwise
* return undefined_type rather than null if attempting to create specialization of an undefined template class (fixes a null pointer exception on references to undefined template classes)

lib/trusted/gc.l
* add accessor static set int GC.MaxHeapSize

lib/trusted/startup.l
* fix HTTP header on uncaught null pointer exception to include correct end-of-line sequence

main.l
* flush stderr before exit (FIXME: should not be required as System.Exit should be calling dispose on IO.Std.err to flush it)
* add WantSharedStandardLibrary flag that links against lang.ll+lang.so+exception.so if set or just exception.o otherwise and change -OS/-Os to set/clear this flag
* add -M nnnn option that limits compiler heap size to given number of megabytes
* update usage information displayed when compiler run with no command line arguments

parsetree.l
* add public accessor get UndefinedType
* fix problem where pragmas not always applied in compile pass
* improve warning message for NoFinal pragma and remove debug output
* fix problem where pragma warning messages might never be displayed if pragma applied in an inline pass


build 1169

* support proc references in K syntax
* add debugging code intended to diagnose excessive memory usage
* more progress on using compiler as dynamically loaded shared object

TODO:
- reduce memory usage
- fix bug where array literals can abort compilation if there is no type expression involving an array of the lowest denominator element type elsewhere in the program (this is a pain: template expansion is triggered by type expressions in one pass and then the array element type is inferred in a later pass at which point we cannot create an array template specialization for the element type if it turns out we don't already have one. May have to insist on an explicit type for array literals to work around this issue - the alternative would be speculatively creating an array template specialization for every encountered type expression just in case the type appears in an array literal)

build-lib.sh
* build library with -O1

common/exception.c
* add debugging code to trace object allocations and deallocations

compilestate.l
* fix problem where compiler could only be run once in a given process because some statically initialized objects were not correctly reinitialized on subsequent compilations
* do not link libraries referenced by library code (FIXME: not the best way to deal with problem of these libraries being linked twice - should instead put them in a set and link to each library exactly once)
* flush stderr before linking so any linker error messages do not get mixed up with compiler output
* throw exception if template expansion attempted after the check-templates pass

lib.l
* include more source files in lang.so

lib/trusted/gc.l
* add System.GC.collect() method that calls native GC_gcollect()

lib/trusted/object.l
* remove debug output from System.Object.toString()

lib/unsafe/klass.l
* debug output when searching for classes by name
* support new classes table structure with __get_vtable function rather than direct pointer to vtable

lib/unsafe/library.l
* add new static accessor System.Library.Self that returns a Library object referring to the current program (FIXME: not sure if this works as expected - does handle=0 argument to dlsym mean current program or current library?)
* rename loadClass to findClass to better reflect what the method actually does
* if library is Self then try the classes table before trying dlsym (FIXME: not sure if this works as expected - does handle=0 argument to dlsym mean current program or current library?)

lib/unsafe/postgres.l
* debug output when connecting to a database

main.l
* fix problem where compiler could only be run once in a given process because some statically initialized objects were not correctly reinitialized on subsequent compilations
* set maximum heap size to 512MB
* return exit status from run() method
* fix problem where if compiler loaded as shared object, some compilation results could cause calling program to end with System.Exit.exit()

parsedef.l
* remove dead code
* improve error message issued if library class and source class definition hashes do not match
* put pointer to __get_vtable method in classes table rather than direct vtable pointer
* debug output when symbol expected to have been declared in earlier pass not found

parseexpr.l
* expand array template for array literals with explicit types
* implement toString for Parse.VectorList to aid debugging problems with array literals

parsetree.l
* fix problem where compiler could only be run once in a given process because some statically initialized objects were not correctly reinitialized on subsequent compilations

syntax-k.jay
* support proc references in K syntax (merges various changes from syntax-l, see build 1145)


build 1168

* link against L shared library by default
* move code for dynamic loading of shared objects from test directory into L library

TODO:
- figure out why compiler memory usage has increased

compilestate.l
* turn off the warn-hide (-WH) option by default

lib/unsafe/library.l b/lib/unsafe/library.l
* move test171.l, which loads shared libraries, into L library as library.l
* add doc comments

main.l
* support loading compiler as a shared library
* disable register variables by default as they slow compilation noticably and improve speed of compiled code only by a few percent
* link against L shared library by default (disable with -Os)


build 1167

* clean up after switching to new name decoration scheme

container.l
* remove debug output

compilestate.l
* remove debug output

parsetype.l
* remove debug output

parsedef.l
* remove debug output

ltest/test172.l
ltest/test173.l
ltest/test174.l
ltest/test175.l
ltest/test176.l
ltest/test177.l
ltest/test178.l
* additional test sources


build 1166

* switch to new symbol name decoration scheme
- a subset of the GCC 3.x name decoration scheme
- fixes problems where some template specializations might not compile due to bad symbol names
- improves readability of error messages from the linker as symbols involving templates now demangled correctly

amd64/amd64.md
* use new name decoration scheme for string literal vtables

amd64/lrt/lrt0.S
* remove unused alloca and allocao functions
* remove '$' from symbol names
* use new name decoration scheme for program entry point

amd64/machine.l
* use new name decoration scheme for program entry point

common/exception.c
* use new name decoration scheme when handling exceptions and starting threads

compilestate.l
* use new name decoration scheme for class and method symbols and for proc types
* use decorated name for class file names rather than alternative 'qualified name' mangling (allows removal of redundant 'qualified name' name mangling code)
* update various error messages to use human readable symbol names
* update symbol searches that used 'qualified name' mangling to use decorated names instead

container.l
* remove 'qualified name' mangling
* additional debug output
* update symbol searches that used 'qualified name' mangling to use decorated names instead
* update various error messages to use human readable symbol names

lib/trusted/exception.l
* rename ArrayBoundsException to BoundsException in anticipation of making it the standard exception to throw for index-out-of-bounds condition (currently different containers in the library throw different exceptions making it awkward to substitute one container implementation for another)
* remove unused CannotCloneException

lib/trusted/gproc.l
* add a constructor that makes a new System.Proc<P> from a word argument, which allows calling abitrary addresses (FIXME: this should not be in the trusted part of the library)

ltest/test171.l
* remove code that attempted to explicitly initialize loaded shared objects as now initialized automatically via _init
* call supplied get vtable function to determine the vtable address for a loaded class

parsecall.l
* error checking for trying to create a bound proc reference from a static method and vice versa

parsedef.l
* supply template type arguments when declaring class arguments so CompileState can decorate class symbol instead of doing decoration here
* remove exception handling when making super class template specializations as was interfering with debugging (FIXME: should reinstate when stable)
* additional debug output
* use decorated name for class file names rather than alternative 'qualified name' mangling
* use new name decoration scheme for class table, vtable and size symbols
* complain when old decoration methods called
* let CompileState decorate method symbols rather than doing it here
* avoid preparing decorated method names again in every pass - use the decorated name stored in the method's container instead

parseexpr.l
* use NEW_GENERIC_ARRAY intermediate code instruction to create arrays for array literals (fixes problem where casting arrays created by array literals to object could cause crashes due to incorrect vtables)
* fix problem where calls through bound method references could crash due to incorrect value stored in proc reference structure


build 1165

* clean up shared library support

lib/trusted/primtype.l
* add some methods required to place char and bool values in container types

needcompile.l
* remove debug output for bad library hash

parsedef.l
* remove warnings and debug output for bad library hash except where actual method slot address difference found
* remove debug output regarding itable to vtable offsets


build 1164

* more progress on shared libraries: L compiler will now bootstrap linked against L shared library
- place exception handling code in separate shared library
- fix library link order problem

TODO:
- figure out why library class hashes sometimes differ from source hashes even though methods are assigned the same slot numbers

amd64/lrt/Makefile
* build exception.c as shared object exception.so rather than linking into lrt-amd64-1.o

amd64/lrt/lrt0.S
* define exception_top and exception_rsp here rather than in exception.c

common/exception.c
* make __exception_top and __exception_rsp extern as they're now defined in lrt0.S
* remove adding unwind info message

compilestate.l
* link .so files for L libraries after object files for classes in current project and before any other library files
* link exception.so after all L libraries and before any other library files


build 1163

* more progress towards dynamic linking.
- fix problems arising from loader apparently duplicating __ctable symbols
- fix bug where stack unwinding failed due to wrong addresses appearing in unwind records
- remove '$' from internal symbol names (not certain but suspect that linker or loader treated these symbols specially)
- change some symbols that were decorated like C++ methods but were actually labels in data segments to have names not recognized as methods (again not certain but suspect linker or loader may treat them as functions despite conflicting .type directive)

TODO:
- exception handling broken in shared libraries due to incorrect order of objects on link command line (works if project linked manually using gcc or ld)

amd64/amd64.md
* remove '$' from some internal symbol names

amd64/lrt/lrt0.S
* remove '$' from some internal symbol names
* replace method end addresses in unwind records for internal functions with method lengths

amd64/machine.l
* remove '$' from some internal symbol names
* add 'use System.String' and replace references to System.String with String
* load vtable pointer via GOT in internal __get_vtable functions in PIC mode (appears to fix odd behaviour where __ctable symbols have more than one address when shared libraries are used)
* change emitVTableSegment to utter strange section incantation used by g++ for vtables (FIXME: probably not required)
* rearrange position of unwind record in assembler output to avoid splitting it around method definition and avoiding placing method start and end labels within the method symbol
* emit explicit .size directive for each method

common/exception.c
* unwind record structure is changed so method ranges are defined as start,length rather than start,end (it's easier to get correct length at run time since ELF doesn't support nested or overlapping symbols)
* more debug output when unwinding
* remove '$' from some internal symbol names

compilestate.l
* remove debug output
* support storing method offsets in library definition files to help pinpoint cause of hash mismatch problems (will also be needed in future to resolve clashing interface slot assignments)
* change link behaviour to output a .so file for -OL compiles and to link against a .so file for .ll input files (FIXME: link order is currently broken for linking against .so files)
* only display link command line if -V (very verbose output) option given
* only look for files with .ll extension if .ll extension explicitly specified on command line
* look for .so file in directory where corresponding .ll file found
* remove '$' from some internal symbol names

container.l
* remove debug output
* only display interface slot numbers if -V (very verbose output) option given
* remove '$' from some internal symbol names

main.l
* remove debug output

needcompile.l
* remove debug output
* support storing method offsets in library definition files to help pinpoint cause of hash mismatch problems (will also be needed in future to resolve clashing interface slot assignments)

parsedef.l
* remove debug output
* list mismatched method slots for classes where source hash does not match library hash
* remove '$' from some internal symbol names
* specify vtable offset explicitly from __ctable plus fixed offset in vtable function rather than using a label (since label inside ELF __ctable symbol doesn't appear to relocate to expected address)

parsetree.l
* remove '$' from some internal symbol names


build 1162

* more progress on shared libraries
- fix bug where shared libraries crashed on load if any static initializer trashed a callee save register
- fix bug where virtual method and interface method calls could crash or call incorrect method due to incorrect calculation of offset from interface dispatch table start to virtual method dispatch table start

amd64/lrt/lrtD.S
* save callee save registers on entry to and restore on return from _init (fixes problem where code in static initializers could crash the dynamic loader by trashing registers)
* use regular label for static initializer function (FIXME: probably not needed)

container.l
* lazily calculate offset from interface dispatch table to virtual method dispatch table (fixes bug where vtable offsets could be incorrect depending on class compile order)
* additional debug output when calculating interface dispatch table slot numbers
* remove redundant call to and definition of buildInterfaceTables method

parsedef.l
* debug output when making template classes in implements clause concrete
* remove redundant call to Container.buildClassTables
* remove unneeded .extern directive for class static tables symbol
* only output class static table symbol if static table contains at least one variable


build 1161

* more progress towards shared libraries - fix problem where calls through interfaces crash or call incorrect methods and references to class names or sizes return garbage because class tables are split by linker because ELF does not support nested or overlapping symbols. The fix involves consolidating the interface dispatch tables, class size, name and type and virtual method dispatch tables (which were consecutive in the assembler source but separate ELF symbols) into one single ELF symbol and referencing the vtable pointer with an offset from the start of the interface table.
* put static variables in the bss segment

TODO:
- figure out why placing certain classes in a shared library crashes the loader when a program referencing the library loads

amd64.md
* replace vtable with ctable+offset in CONST_STR intermediate code instruction

amd64/lrt/Makefile
* temporarily append '-1' to runtime object file names to allow building stable and development compiler versions on same system

amd64/lrt/lrt0.S
* call __get_vtable$__<decorated class name> to determine vtable pointers for arrays (fix can't call through interfaces with shared libraries due to split class tables problem)

amd64/machine.l
* add emitDefLongZero() that outputs a .zero directive
* add emitVTableFunction() and emitVTableFunctionPIC() that return a class's vtable pointer (fix can't call through interfaces with shared libraries due to split class tables problem)
* add emitBSSSegment() that switches assembler to the .bss section
* use .string instead of .ascii + .byte 0 to assemble a C string constant
* use __get_vtable$ call to get main class vtable pointer (fix can't call through interfaces with shared libraries due to split class tables problem)
* remove dead code

common/exception.c
* use __get_vtable$ calls to get exception and string class vtable pointers

compilestate.l
* temporarily append '-1' to runtime object file names to allow building stable and development compiler versions on same system

container.l
* add field and accessor for current interface table offset
* place static variables in the bss segment
* debug output when writing out interface dispatch tables
* output global label ctable$__<class_decorated_name> before interface dispatch tables with size that covers entire interface dispatch table, class name, type + size slots and virtual dispatch table (fix can't call through interfaces with shared libraries due to split class tables problem)
* remove redundant .extern and .global directives for methods implementing interfaces
* remove debug output in assembler file for vtable offsets

lib/trusted/object.l
* debug output in toString()

mtree.l
* output .align 8 after a string constant to keep rodata segment 8 byte aligned (FIXME: should be .align Machine.WORD here)

needcompile.l
* additional debug output when hash from class source doesn't match hash in library

parsecall.l
* use loadVTable rather than loadGlobal to get vtable pointer when allocating arrays and objects (fix can't call through interfaces with shared libraries due to split class tables problem)

parsedef.l
* temporarily make source/library class hash mis-match a warning as errors made debugging shared library issues difficult
* prevent the linker splitting class tables in shared libraries by avoiding placing any global labels within the table
- remove type$__ name$__ and vtable$__ labels
- completely remove the unused type table
- output a copy of the size$__ slot outside the class table and make size$__ point to that instead
- replace vtable$__ with a function __get_vtable$__ that returns a pointer to the vtable
- output super vtable pointer as ctable$__ + offset
* place static variables in the bss segment
* better error message if definition of variable not found across passes
* emit global definition for each method with its definition

parseexpr.l
* work around problem in amd64.md where, because there are no two address rewrite instruction definitions, intermediate BRANCH instructions can fail to compile if their right operand generates a two address machine instruction (fixes problem where run time checked casts would not compile in PIC mode)
* use loadVTable rather than loadGlobal to get vtable for run time cast check (fix can't call through interfaces with shared libraries due to split class tables problem)
* use getVTableAsString rather than string literal to get vtable when creating static proc references (fix can't call through interfaces with shared libraries due to split class tables problem)
* use loadVTable rather than loadGlobal to get vtable when creating dynamic proc references (fix can't call through interfaces with shared libraries due to split class tables problem)

parsetree.l
* add loadVTable method that uses loadGlobal ctable$__ plus interface table size to return intermediate code to determine a vtable address
* add getVTableAsString that uses ctable$__ plus interface table size to return a string for an assembler expression that evaluates to a vtable address

parsetry.l
* remove .extern directive for removed vtable label
* use getVTableAsString rather than string literal to get vtable address for exception descriptor (fix can't call through interfaces with shared libraries due to split class tables problem)
* use loadVTable rather than loadGlobal to get vtable for exception catch test (fix can't call through interfaces with shared libraries due to split class tables problem)


build 1160

* implement creating and linking against shared libraries

TODO:
- if interface dispatch table offsets change between library and client due to interference between interfaces changing then client will not be able to use the library (won't compile due to incorrect hashes for classes implementing affected interfaces). Fixing this requires either:
- somehow deferring interface selector coloring until all libraries are loaded then back-patching offsets at each call site. It might be possible to get the loader to do the patching if selector offsets are made relocatable symbols, or
- replace methods for affected selectors with thunks that branch to correct method based on desired method (passed in a hidden parameter). Again it might be possible to have the loader replace the methods with thunks by preloading a library with the thunks in first.
- the PLT double call mechanism used to call final and static methods seems like it might be slower than a virtual call so might consider making all method calls libraries virtual
- need to enabled segfault handler at some point after all unwind tables are loaded
- would be better to read class hashes directly from the library .so rather than reading a separate .ll file but not clear how to load and interrogate an .so file for its contents without having its symbols collide with the compiler's symbols (alternative is to try libelf, which looks a bit involved)

amd64/lrt/lrt0.S
* make static$begin global (FIXME: not required)
* temporarily remove call to install segfault handler in main since unwind tables for exception handling might not be valid yet (FIXME: need to find a safe point in program startup to install the segfault handler)
* temporarily remove call to initialize garbage collector in main (probably not required)

amd64/lrt/lrtD.S
* add _init method, called by dynamic loader when library is initialized, that links library's unwind tables into the program and then runs its static initializers
* remove unused static$begin label
* remove previous broken _init implementation
* remove unused __unwind_start

amd64/machine.l
* make EXTERN instruction actually emit .globl (FIXME: may not be required)
* make GLOBAL instruction emit .globl rather than .global (assuming they're synonymous but GCC uses .globl)
* split emitGlobal into emitGlobalFunction and emitGlobalData and emit .type and .size GAS pseudo ops so loader knows the types/sizes of global symbols

amd64/lrt/exception.c
* add __static_begin function that calls a supplied static initializer (FIXME: no longer required now _init is working)

compilestate.l
* add LibraryHashFile class that reads a .ll file that contains the names and hashes of classes in a library
* remove unused LCacheDir accessor
* write hashes for all classes not in libraries to .ll file for current project
* fix typo in progress method for check templates pass
* remove dead code
* if input file is an L library (.ll) rather than L source then read the library's class and hash list and add the library's .so to the libraries list
* return a CompileStatus rather than bool as result of needCompile()

container.l
* remove unused IsPIC field and accessor
* add VTableSize accessor
* add StaticSize field and accessor and set it when building class tables
* add CompileStatus field and accessor (FIXME: remove - unused)
* when building class tables, output local functions with .type @functions using Machine.emitGlobalFunction()

test171.l
* call static$begin in loaded libraries (FIXME: remove - _init should now do this)

main.l
* add some additional options for libraries (FIXME: remove - unused)
* use accessor rather than set method to set executable name in CompileState

needcompile.l
* add CompileStatus enum that has values:
CURRENT - class is in current project and does not need compiling
LIBRARY - class is in a library and so does not need compiling)
STALE - class is in current project and needs compiling)
BAD_HASH - class is in a library but cannot be used due to hash mismatch
* hold a list of libraries and check classes against all libraries when determining if a class needs to be recompiled.
* return CompileStatus as needCompile result rather than bool so callers know whether to link against a library or an object file for classes that don't require compilation

parsedef.l
* debug output for bug where super class can be set twice (FIXME: this happens if a class is defined twice in the same namespace - need a better error message)
* issue error message if compiled class is in a library but its current definition hash doesn't match the hash in the library
* put vtable in data segment rather than read only data segment, appears to be required by loader if any methods in the vtable are in a library (FIXME: check this is definitely needed as it's potentially unsafe)
* explicitly set type and sizes of vtable and related symbols using Machine.emitGlobalData() (fixes problem where vtables in loaded libraries were truncated or would not link)

parseident.l
* use human name rather than toString when issuing error for not calling method symbol

parsepackage.l
* use CompileState.CacheDir rather than LCacheDir

symbol.l
* remove unused IsPIC accessor


build 1159

* fix exception handling in dynamically loaded code
* start implementing support for incremental compilation by dynamic loading of new classes

amd64/lrt/Makefile
* assemble dynamically loaded code prolog lrtD.S into ldn-amd64.o and copy to library directory

common/exception.c
* add __add_unwind_info(UnwindRecord **u) that links a new unwind table into a running program
* alter findUnwindInfo to search any added unwind tables in addition to the one compiled into program

compilestate.l
* only emit, assemble and link program entry point if not compiling in library mode
* link only files that required compilation if compiling in library mode (enables incremental compile of running program, provided no dependancies change)
* link dynamic code prolog in compiling in library mode
* add WantVirtual flag that forces calls to a method to be virtual, rather than static or inlined (required if a method may be overidden by a subsequently loaded class)

container.l
* revert change that made class hash depend on IsPIC as prevented incremental compile

test170.l
* add test exception throw

test171.l
* add LoadTest class with a forced non-final method (using pragma NoFinal) that can be overridden by a dynamically loaded class
* allow abitrary number of shared objects to be loaded via command line (for dynamic compilation tests)
* load shared objects from current directory
* use global symbol dlopen flag so symbols in loaded shared objects are visible to any subsequently loaded objects
* link unwind table from loaded object into existing unwind table
* if requested class cannot be found in last loaded library, search all global symbols for it

needcompile.l
* explain why a class is being compiled if compiling in library mode (for debugging incremental compile - make sure classes not loaded twice)

parsedef.l
* only add all referenced classes to link list if not compiling in library mode
* if compiling in library mode add compiled classes to link list
* if WantVirtual flag is set when compiling a method then mark it not-final

parseident.l
* remove debug output

parsetree.l
* add 'NoFinal' pragma that makes methods following it within its scope not-final (which prevents them being inlined or called statically)
* warn on undefined pragmas


build 1158

* progress towards exception handling in dynmically loaded code
* other PIC fixes

amd64/amd64.md
* allow reg var destination operand for LEA intermediate code instruction
* remove rules for unused TRY and START_CATCH intermediate code instructions

amd64/machine.l
* remove relocation markup from exception descriptor and exception stack pointer symbol names (now added by ParseTree.loadGlobalTLS)
* add emitWeak() method

compilestate.l
* do not abort compile if no main class if generating PIC
* do not attempt to link output if generating PIC
* make output executable relinkable (ld option -E) so that classes dynamically loaded into executable can link against its symbols

container.l
* add IsPIC property that is set for PIC methods
* make class hash depend on IsPIC property of its methods to force recompile of classes if -OL option changes across compiles (FIXME: IsPIC should probably be per-class not per method as a mixture of both in one object file will not link)

lib/trusted/string.l
* implement bool startsWith(char c) method

lib/unsafe/stream.l
* remove code that stored backtrace on FileStream creation for debug purposes (caused problems trying to test dynamic loading as exceptions currently broken in dynamically loaded code)

ltest/test170.l
* remove Main class

ltest/test171.l
* tidy up dynamic loading code

mtree.l
* make @PLT for static method calls conditional on WantPIC

parsedef.l
* output a weak label '__vtable' that points at class vtable, which makes it possible to dynamically load classes without knowing their decorated name (FIXME: not sure if .weak is really needed here)
* mark methods with IsPIC if WantPIC is set

parsetree.l
* generate PIC accesses to TLS using @TLSGC(%rip) and __tls_get_addr (required but not sufficient to fix exception handling in dynamically loaded code. Assembles and exception handlers without exceptions appear to run but otherwise untested as unwind tables still not accessible to dynamically loaded code)
* remove debug output

parsetry.l
* generate PIC accesses to current exception descriptor and saved stack pointer with @TLSGC(%rip) and __tls_get_addr
* generate intermediate code for exception handler body entry directly rather than using TRY intermediate code instruction to avoid duplicating PIC TLS access code

symbol.l
* add accessor for IsPIC property


build 1157

* complete basic support for dynamically loadable code:
- Made PIC output optional (controlled via -OL option)
- PIC object files can now be linked with -shared option with no relocation errors
- resulting shared libraries can be loaded with dlopen
- classes can be dynamically loaded from shared libraries with new System.Class(native.dlsym(<library handle>, <decorated vtable name>))

* TODO for shared libraries:
- Need way to define what classes in a project constitute a library
- Need to support compile time use of a shared library
- Need to support load time dynamic linking of executable to a shared library referenced at compile time
- Need to ensure static initializers are called on library load
- Need to enforce compatibility between class definitions in shared library and defititions used by library client
- Need to insert dynamically loaded unwind/reflection information into existing program (assuming that the relevant segments end up disjoint from the corresponding existing segments in the loading program)
- Generate correct PIC for TLS references (required for exception descriptor pointer and saved stack pointer)
- Consider using PC relative offsets for local symbols rather than going through GOT

amd64/amd64.md
* make PIC support optional for intermediate code instructions that reference global symbols
* allow immediate right operands for cmp instructions with register left operand (FIXME: should also change rewrite rules to match)
* allow immediate right operands for mov instructions with register left operand (FIXME: should also change rewrite rules to match)

amd64/machine.l
* support PIC reference to exception descriptor pointer and saved stack pointer (FIXME: not using TLS, which is certainly broken for threads and may also be broken for single threaded programs)
* revert name of read only data segment to .rodata
* generate PIC program entry point (FIXME: probably not required since not currently able to link a complete position independant executable)

compilestate.l
* support -OL option (WantPIC flag, which could be turned on and off per class or method but no pragma connected to it yet)
* call the linker directly with -shared if PIC executable (probably not useful right now as will include all referenced library classes in the shared exe)

intermediate.l
* remove some debug code
* add a utility method, wantPIC(int t, int f), that code generator uses to select rules based on whether PIC is enabled

lib/trusted/vgector.l
* restore including list of elements in toString() result (was disabled due to a box-on-method-call bug)

main.l
* support PIC option (-OL to enable, -Ol to disable)

mtree.l
* support PIC calls to static methods via PLT (FIXME: should depend on WantPIC but currently always enabled)

parsetree.l
* initial support for PIC reference to exception descriptor pointer and saved stack pointer (FIXME: should have Machine class provide intermediate code for PIC loading of regular globals and values in TLS)
* make loading regular global symbols via GOT optional dependent on WantPIC

parsetry.l
* load global symbols through loadGlobal() or loadGlobalTLS()

ltest/test170.l
* simple dynamic loading test library

ltest/test170.l
* simple dynamic loading test client


build 1156

* start work on generating position independent code to allow dynamic linking to L code
* fix another return jump elimination bug

amd64/amd64.md
* initial PIC code generation support
- support non constant vtable argument to CAST_CHECK instruction
- remove RELOC instruction and rules that produce it (may be able to restore once PIC is working, currently disabled to prevent bad GOTPCREL operands)
- result of CONST_STR and CONST_CSTR is indirect through GOTPCREL for PIC code
- add rewrite rule for mem = [INDIRECT [GLOBAL]] that passes tree unchanged (FIXME: probably not required)
- remove rewrite rules that match [GLOBAL] (FIXME: probably not required)
- add machine rules for [GLOBAL]
- support non constant vtable argument to NEW, NEW_FINALIZE, NEW_GENERIC_ARRAY instructions

amd64/machine.l
* change read only data segment name to .rodata.rel since this is what GCC seems to use for -fpic (FIXME: doesn't appear to be neccessary)

compilestate.l
* reduce maximum inlineable method size to 30 parse tree nodes
* include PIC options on linker command line to produce dynamically loadable executable (FIXME: options are not correct: '-shared' is what's required here)

container.l
* add code to support omitting method calls where all implementations known to be empty (useful for constructors, currently commented out)

mflow.l
* fix typo in comment output at spill sites

parsecall.l
* support PIC code via loadGlobal when new'ing arrays and objects
* add code to support omitting method calls where all implementations known to be empty (useful for constructors, currently commented out)

parsedef.l
* support PIC code via loadGlobal when calling profiler

parseexpr.l
* support PIC code via loadGlobal when generating run time cast checks
* support PIC code via loadGlobal when loading addresses of static variables and proc references
* remove dead code

parsetree.l
* add loadGlobal and loadGlobalNoGOT that load the address of a global symbol either directly or with GOTPCREL
* revert hiding error messages in inline code (fixes bug where errors in code that was inlined but for some reason not compiled would cause compilation to fail without a useful message)
* add code to support omitting method calls where all implementations known to be empty (useful for constructors, currently commented out)
* fix bug where no_code_after_return incorrectly cleared between template instantiations causing return jump elimination not to be applied in some methods in template classes

parsetry.l
* return true for IsLastReturn for throw statements
* support PIC code via loadGlobal when generating code for exception handlers


build 1155

* avoid inlining large methods
* allow inlining of methods that call constructors either directly or via new
* fix bug where return jump elimination code generation option (-OR) ignored
* fix bug where illegal static call resulted in exception rather than error message

compilestate.l
* if method contains more than a certain number of parsetree nodes in checkInline then throw CannotInlineException

intermediate.l
* allow argument and method call intermediate code instructions in inlined methods

parsedef.l
* fix bug where return jump elimination code generation option not applied
* count parse tree nodes when checking if a method can be inlined
* remove redundant return jump elimination code

parseexpr.l
* allow inlining of methods that call constructors
* issue error message for calling static method in object instance rather than throwing an exception

parsetree.l
* count parse tree nodes when checking if a method can be inlined


build 1154

* fix bug where some compiler messages could be repeated if multi processing enabled
* fix bug where some compiler messages could be repeated if method inlining enabled
* fix bug where assembler could be output to standard error if exception handlers compiled with method inlining enabled

compilestate.l
* flush IO.Std.err before starting multiple compile processes (fixes bug where subsequent buffer flush in child processes could cause recent compiler messages to be repeated)
* additional debug output if code generated with no output stream
* reword warning issued when accessor hides a symbol in an enclosing scope

lib/trusted/array.l
* disable hide warnings
* additional doc comments
* prevent new Array<T> by throwing NotImplementedException since a new'd Array's structure would not be compatible with compiled array subscript code
* implement Generic.Iterable<T> interface

lib/trusted/exception.l
* clearer default message if no message supplied to constructor

lib/trusted/gbag.l
* extend Iterable<T> interface

lib/trusted/giterator.l
* add Iterable<T> interface that consists of a single accessor get Iterator<T> Iterator

lib/trusted/gmap.l
* disable hide warnings
* implement Iterable<T> interface

lib/trusted/gset.l
* disable hide warnings
* implement Iterable<T> interface

lib/trusted/gvector.l
* disable hide warnings
* implement Iterable<T> interface

lib/trusted/intvector.l
* remove existing Util.IntVector implementation and instead derive Util.IntVector from Generic.Vector<int>

lib/unsafe/lock.l
* disable unsafe warnings

lib/unsafe/signal.l
* disable unsafe warnings

parsedef.l
* if attempted inlining fails with CannotInlineException, mark method cannot-inline to avoid repeated inline attempts

parseident.l
* remove debug output

parseloop.l
* check sub trees of for loops for non-inlineable constructs. Fixes problem where non inlineable constructs in for loops not detected until inline version of method is prepared, which was potentially inefficient.

parsetree.l
* do not display error or warning messages if in prepare inline pass (fixes bug where errors and warnings could be displayed repeatedly when method inlining enabled)


build 1153

* fix bug where calls through proc references could be optimized away as dead code if the call returned no result or if a returned result was not used

mtree.l
* fix proc reference dead code bug

amd64.md
* fix proc reference dead code bug


build 1151

* more progress on implicit conversions and boxing

compilestate.l
* remove debug output

container.l
* add additional escapes for decorating constructed types template arguments

intermediate.l
* remove debug output

test164.l
* more tests of implicit conversion between array types and Generic.Array<T>

parsecall.l
* support implicit conversion of System.Proc<P> to P if left value of call operation
* fix bug where calling non-method might not give a useful error message

parseexpr.l
* check intermediate code instruction is valid call operation when compiling method call
* remove debug output

parsetree.l
* do not recursively box array element types when determining box type for arrays (still not really right - need to integrate matching boxed types to primitive types directly in Type.matchScore otherwise constructed types that are a mixture of boxed and unboxed will not match)
* remove debug output
* support implicit conversion of Generic.Vector<T> to T if left value of dereference operation rather than calling indexer method

type.l
* add utility method for determining the actual type of a template class specialization type argument
* escape constructed types in template class names
* remove debug output


1150

lib/trusted/gproc
* include System.Proc<P> class in repository


build 1149

* fix bug where calls through proc references could crash due to registers live at call site being trashed

amd64.md
* change implementation of PROC_CALL to read/write single temporary with Return0 class rather than two temporaries that must get the same register (fixes bug where calls through proc references can crash due to live registers being trashed)

mflow.l
* additional debug output if machine instruction has null string representation

mtree.l
* PROC_CALL instructions now read and write their dest operand


build 1148

* implement implicit type conversion for arrays and proc references to and from their Object derived equivalents Generic.Array<T> and System.Proc<P>
* add very simple profiler
- enable with -OT (clear cache first)
- profiler option inserts calls to profiler on every method entry and exit
- either import prof or include lib\trusted\prof.l on command line
- when profiled executable exits it writes prof.csv file in working directory containing call counts and total execution time per method

amd64/lrt/lrt0.S
* add __prof_enter/__prof_exit, which save register state and then call Util.Profiler.enter(word)/exit(word)

exception.c
* add __get_nanotime function, which is a wrapper around clock_gettime( CLOCK_PROCESS_CPUTIME_ID, timespec )

compilestate.l
* replace numbers for warning flags with symbolic constants
* support profiler option

lib/amd64/primword.l
* add opCompare(word,word), which is required to use word values as key in Generic.Map<K,V>

lib/trusted/exit.l
* expand single on-exit list to multi-level list where all entries in each level disposed before next is processed

lib/trusted/prof.l
* very simple profiler

lib/trusted/string.l
* use opSet internally rather than deprecated putCharAt
* implement append(word,int)

main.l
* support -OT option, which enables profiler calls
* include some information about type lookups in statistics output

parsecall.l
* implement calling methods in values that can be cast directly to Object without boxing (i.e. array and proc) and remove previous non-functional implementation

parsedef.l
* implement profile entry and exit calls in method prologs and epilogs

parseexpr.l
* count type lookups, misses and clears

parseident.l
* treat no symbol found as a method in isMethod (required for method calls on non-objects)
* implement calling methods in values that can be cast directly to Object without boxing (i.e. array and proc) and remove previous non-functional implementation

parsetree.l
* implement NoProfile pragma

type.l
* count box type lookups and misses
* implement bool CanTreatAsObject accessor that returns true of values of a type can be cast to Object directly without boxing
* implement implicit conversion between CanTreatAsObject types and their Object equivalents


build 1147

* make primitive arrays instances of Generic.Array<T> class, which partially implements Generic.List<T>
* make proc references instances of System.Proc<T> class

amd64.md
* implement NEW_GENERIC_ARRAY intermediate code instruction
* increase size of structure allocated for proc references to accomodate vtable pointer

amd64/lrt/lrt0.S
* change __proc_thunk to accodate changed layout for proc reference structure
* implement allocag function that allocates an array and sets its vtable pointer

compilestate.l
* fix bug where proc references with no arguments caused a null pointer exception

container.l
* debug output to diagnose bug where generic class instances with proc reference type parameters not decorated correctly

array.l
* remove broken array implementation and replace it with a minimal Generic.Array<T> class

gvector.l
* temorarily remove call to StringBuffer.append that fails for proc reference arguments preventing proc references being stored in a Generic.Vector<T>

lang.l
* import gproc

test159.l
* test instantiating System.Proc<P> template

mtree.l
* accomodate changed layout of proc reference structure

ops
* add NEW_GENERIC_ARRAY instruction

parsecall.l
* fix bug where a template class might not be instantiated in the right pass if the only reference is 'new <template type>[n]'
* use NEW_GENERIC_ARRAY to allocate new arrays with correct specialization of Generic.Array<T>
* implement support for instance method calls on non-class types that can be boxed just by casting to box type (e.g. arrays and proc references)
* fix bug where templates in left value of proc reference might not be instantiated in the right pass
* call compileLoadProcRef rather than compleLoad to create new proc references

parsedef.l
* debug output for 'could not find previous definition of' message
* include vtable for appropriate specialization of System.Proc<P> in proc reference structures
* implement proc(...)(super.method)

parsedef.l
* debug output for undefined symbol message

parsetree.l
* add predefined type for System.Proc<P> template class
* extend getBoxType to find or create appropriate classes for arrays and procs from Generic.Array<T> and System.Proc<P>

parsetype.l
* fix bug where templates in left value of proc reference might not be instantiated in the right pass
* fix bug where templates in left value of array reference might not be instantiated in the right pass

token.l
* correctly lex proc types nested within template brackets and vice versa

type.l
* cache box type in Type objects
* fix bug where proc references in template names not correctly decorated


build 1146

* implement instance proc refs (with limitation that all arguments must fit in register parameters)

amd64/amd64.md
* implement PROC_REF intermediate code instruction, which allocates an instance proc ref structure

amd64/lrt/lrt0.S
* add dynamic proc call thunk functions for functions with 0-5 register arguments

compilestate.l
* additional debug output to diagnose null output bug

ops
* add PROC_REF intermediate code instruction

parsecall.l
* pass argument types to compileLoad when compiling instance proc references

parseexpr.l
* support creating instance proc references


build 1145

* continue implementing pointers to methods (new 'proc' type)
* change method and variable resolution so that kind of first symbol seen with matching name determines whether identifier refers to method, variable or accessor (required to keep method resolution sane with proc variables).

compilestate.l
* remove debug output

container.l
* remove unused hash field from Addresses class
* change name of hash field in Container to hash_ to avoid conflict with hash() method

intermediate.l
* change name of rset field in ITree to rset_ to avoid conflict with rset() method

lib/unsafe/exec.l
* rename wait parameter in run method to want_wait to avoid conflict with wait() method

mtree.l
* change name of rset field in MReg to rset_ to avoid conflict with rset() method

parsecall.l
* remove debug output
* improve error message for calling through a non-method/non-proc-ref value
* implement creating proc references from methods

parseexpr.l
* rename warn local variable to avoid conflict with warn() method
* implement creating proc references from static methods
* stub support for creating proc references from instance methods

parseident.l
* if isMethod called then assume caller intends to either de-method identifier or create proc reference from it, if not complain when value is compiled if symbol turns out to be a method (fixes bug where some methods can be treated as constants with value of vtable offset and type of return value)

parsetype.l
* remove debug output

syntax-l.jay
* support new syntax for creating proc references

type.l
* match proc types by comparing containers

amd64.md
* remove dead code
* make DEFINT intermediate code instruction available in rewrite as well as machine

lgeng.l
* use 'new <type> {...}' syntax for array literals rather than old '<type> {...}' syntax

ops
* not an intermediate file - reinstate in repository

ltest/test157.l
* add simple call though static proc ref test


build 1144

* continue implementing pointers to methods (new 'proc' type)
* include test156.l that include proc type syntax and calls through proc variables
* remove some intermediate files from git repository

amd64.md
* implement PROC_CALL and PROC_CALL_DISCARD intermediate code operations

compilestate.l
* include length in decorated name for proc types

container.l
* end search for methods immediately on exact match

mtree.l
* support PROC_CALL pseudo machine instruction (calls indirect through a register, easier than trying to convince register allocater to hold proc pointer in rax when calling through *0(rax) - required since called function may be a thunk that relies on value passed in rax)

ops
* add PROC_CALL and PROC_CALL_DISCARD intermediate code operations

parsecall.l
* implement calls though proc references

parseexpr.l
* implement calls through proc references

parseident.l
* implement calls through proc references

parsetree.l
* implement calls through proc references

syntax-l.jay
* remove various rules for method calls of form <some specific non-terminal>.name(...)
* make this and super match thing non-terminal
* add rules for method calls of form thing(...)
* do not wrap bracketed expressions in Parse.Parenthesis

type.l
* attempt to mangle proc references in a way that GNU toolchain understands (still broken)

ops
* remove intermediate file from repository

terminal.out
* remove intermediate file from repository

interp.l
* remove intermediate file from repository


build 1143

* start implementing pointers to methods
* changes to Doxygen config so generated HTML integrates better with website

Doxyfile
* set EXTRACT_ALL
* exclude jay source directory
* include HTML header and footer

compilestate.l
* initial support for proc types
* additional debug output intended to diagnose no output file stream bug
* store a pre constructed Type object in template instance Containers rather than constructing a new one on every reference to a particular template instance

container.l
* support additional '$' escape characters in qualified names to encode spaces and parentheses required by proc type expressions

exception.l
* remove bad \property tags from comments which were confusing Doxygen

gllist.l
* add doc comments
* remove bad \property tags from comments which were confusing Doxygen

gmap.l
* MapIterator<K,T> implements Iterator<MapPair<K,T>>
* add doc comments
* remove bad \property tags from comments which were confusing Doxygen

gqueue.l
* add doc comments
* remove bad \property tags from comments which were confusing Doxygen

klass.l
* fix bug introduced in 1142 that caused System.Object.create() to fail with CastException

thread.l
* add doc comments
* remove bad \property tags from comments which were confusing Doxygen

parsedef.l
* store a pre constructed Type object in template instance Containers rather than constructing a new one on every reference to a particular template instance

parsetype.l
* initial support for proc types
* fix problem where generated C++ doc stubs for nested generic types not parseable by Doxygen due to no space between closing generic brackets '>'

symbol.l
* add a new symbol kind Symbol.PROC

syntax-l.jay
* initial support for proc types
* remove special rules in grammar for calling static methods in template classes and instead includ template classes in primary non-terminal
* change syntax to require 'new' before <type> <vector_list> (e.g. String {"a","b","c"}) construct as made it very difficult to implement constructed types as an expression primary non-terminal (note that 'new <type>' not generally required before array literal anyway as array type is inferred if 'new <type' is ommitted)

token.l
* add 'proc' keyword

type.l
* initial support for proc types


build 1142

* Force all classes to inherit from System.Object
* Add more documentation comments to library
* Reorganise some library sources
* Move some library classes to more appropriate namespaces where the original namespace was not consistent with other classes
* Minor fixes to documentation stub output

Doxyfile
* add to repository

lib/trusted/gmap.l
* add doc comments
* remove unused keys parameter from MapIterator

lib/trusted/gqueue.l
* split queue implementation out of thread pool and place in separate source file
* move Queue<T> from Util namespace to Generic namespace

lib/trusted/gsort.l
* add doc comments

lib/trusted/map.l
* add doc comments

lib/amd64/primtype.l
* add doc comments

lib/trusted/startup.l
* call System.Exit.shutdown() to dispose objects registered to dispose on exit

lib/trusted/array.l
* add doc comments

lib/unsafe/classsize.l
* add doc comments

lib/unsafe/kit.l
* add doc comments

lib/unsafe/klass.l
* add doc comments

lib/unsafe/lock.l
* split Lock out of thread.l and place in separate source file
* move Lock from System namespace into Util namespace

lib/unsafe/postgres.l
* add doc comments

lib/unsafe/signal.l
* split Signal out of thread.l and place in a separate source file
* move Signal from System namespace into Util namespace

lib/unsafe/sql.l
* add doc comments

lib/unsafe/sqlite3.l
* add doc comments

lib/unsafe/stat.l
* add doc comments

lib/unsafe/stream.l
* update references to Lock to reflect namespace move
* Builds prior to 1141 essentially didn't buffer any output written via IO.Writer.println. 1141 fixed this but the fix exposed another problem where buffered output to standard output and standard error was not flushed before program exit. This is fixed by adding System.Exit class plus two changes here:
* add a dispose() method to IO.Writer that flushes the buffer and then disposes the underlying stream
* register standard out and standard error streams to dispose on exit to ensure any buffered characters are output before program exits

lib/unsafe/thread.l
* add doc comments
* remove Lock and Signal classes from this file

lib/unsafe/threadpool.l
* update references to Lock to reflect namespace move
* update references to Signal to reflect namespace move
* update references to LockedQueue to reflect namespace move
* add doc comments

lib/unsafe/unwind.l
* add doc comments

x86/enviroment.l
* add doc comments

x86/primlong.l
* add doc comments

x86/primword.l
index 76596e3..789cccd 100644
--- a/lib/x86/primword.l
+++ b/lib/x86/primword.l
@@ -1,5 +1,6 @@

ltest/test155.l
* remove explicit 'extends Object'

main.l
* exit via System.Exit.exit(int) rather than native.exit() (fix bug where buffered error messages not output on exit)

parsedef.l
* when generating documentation stubs, output C++ '#include <name>' rather than 'import name;'
* for clases other than Object, inherit from Object if no super class specified with 'extends' (fixes various issues with classes that don't inherit from Object being handled correctly by the runtime)
* when generating documentation stubs, output explicit inheritance from System.Object for classes where no super class is specified

parsetree.l
* check CurrentClass is not null before checking Template property when determining if an error message should include a template class name (fixes problem where some template related errors could cause compiler to take a NullPointerException)


build 1141

* add support for documentation comments by converting non-functioning pretty printer to output C++ style stubs parseable by Doxygen
* start adding documentation comments to library
* remove spurious files from jay directory
* remove jay intermediate files syntaxl.l and syntaxk.l from git repository

lib/amd64/primword.l
* add doc comments

lib/safe/klass.l
* add doc comments

lib/safe/stream.l
* add doc comments

lib/safe/thread.l
* add doc comments

lib/trusted/args.l
* add doc comments

lib/trusted/array.l
* add doc comments

lib/trusted/envmap.l
* add doc comments

lib/trusted/exception.l
* add doc comments

lib/trusted/gbag.l
* add doc comments

lib/trusted/gc.l
* add doc comments

lib/trusted/giterator.l
* add doc comments

lib/trusted/glist.l
* add doc comments

lib/trusted/gllist.l
* add doc comments

lib/trusted/gmap.l
* add doc comments

lib/trusted/gset.l
* add doc comments

lib/trusted/gsort.l
* add doc comments

lib/trusted/gvector.l
* add doc comments

lib/trusted/hash.l
* add doc comments

lib/trusted/intvector.l
* add doc comments

lib/trusted/iterator.l
* add doc comments

lib/trusted/list.l
* add doc comments

lib/trusted/object.l
* add doc comments

lib/trusted/oset.l
* add doc comments

lib/trusted/pointer.l
* add doc comments

lib/trusted/sort.l
* add doc comments

lib/trusted/startup.l
* add doc comments

lib/trusted/string.l
* add doc comments

lib/trusted/time.l
* add doc comments

lib/trusted/vector.l
* add doc comments

lib/unsafe/exec.l
* add doc comments
* fix bug where fork and vfork always return false instead of returning true in child process

lib/unsafe/method.l
* add doc comments

lib/unsafe/sql.l
* add doc comments

lib/unsafe/stream.l
* add doc comments

ltest/test155.l
* add doc comments

parsecall.l
* fix bug where print failed for constructor call without arguments

parsedef.l
* convert non-functioning pretty printer to output C++ stubs with doc comments

parseident.l
* convert non-functioning pretty printer to output C++ stubs with doc comments

parsepackage.l
* convert non-functioning pretty printer to output C++ stubs with doc comments
* output stubs to lcache rather than directories containing source files

parsetree.l
* convert non-functioning pretty printer to output C++ stubs with doc comments

syntax-k.jay
* associate doc comments with appropriate parse trees

syntax-l.jay
* associate doc comments with appropriate parse trees

token.l
* only buffer doc comments rather than all comments
* only concatenate directly consecutive comments


build 1140

* code cleanups

compilestate.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

container.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

generator.l
* convert get/set methods to accessor syntax

intermediate.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax
* use Generic.SortList<T> rather than Util.Sort to sort local variable use counts

lgeng.l
* convert get/set methods to accessor syntax

gsort.l
* remove list type formal argument and instead split Generic.Sort<T,U> into Generic.SortList<T> and Generic.SortArray<T> that sort Generic.List<T> and T[] respectively

test155.l
* also test Generic.Bag<T> interface

main.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

mbitset.l
* use common types to avoid repeated qualification of type names

mblock.l
* convert get/set methods to accessor syntax

mflow.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

mframe.l
* convert get/set methods to accessor syntax

mtree.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

needcompile.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax
* use Generic.Map<T> instead of Util.Map to store class hashes

parsecall.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parsecond.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parsedef.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parseexpr.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parseident.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parseloop.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parsepackage.l
* use common types to avoid repeated qualification of type names

parsetree.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parsetype.l
* use common types to avoid repeated qualification of type names

symbol.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

symboltable.l
* use common types to avoid repeated qualification of type names

token.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

type.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax


build 1039
* fix bug where used type names not always visible in template classes
* fix bug where using entire namespace only worked for symbols with name the same length as the namespace's name

compilestate.l
* resolve used types and namespaces in a separate pass (fix bug where used type names not always visible in template classes)

lib/trusted/gllist.l
* fix bug where remove cleared entire list

lib/trusted/gvector.l
* access external types with 'use' rather than qualified names

ltest/test154.l
* access external types with 'use' rather than qualified names
* also test Generic.Bag<T> interface

parsepackage.l
* resolve used types and namespaces in a separate pass

parsetree.l
* resolve used types and namespaces in a separate pass

printtermg.l
* use Generic.List<T> interface

symbol.l
* fix bug where using entire namespace only worked for symbols with name the same length as the namespace's name


build 1038

* migrate front end from using Util.Vector to Generic.Vector.
* fix lexical analyser bug where unclosed quotes hang the compiler.
* fix lexical analyser bug where character literals not required to be exactly one character long
* fix bug where test to determine if run time cast check possible too restrictive

compilestate.l
* migrate from Util.Vector to Generic.Vector

container.l
* migrate from Util.Vector to Generic.Vector

main.l
* migrate from Util.Vector to Generic.Vector

parsecond.l
* migrate from Util.Vector to Generic.Vector

parsedef.l
* migrate from Util.Vector to Generic.Vector

parseexpr.l
* migrate from Util.Vector to Generic.Vector
* fix bug where test to determine if run time cast check possible too restrictive

parseident.l
* migrate from Util.Vector to Generic.Vector

parseloop.l
* migrate from Util.Vector to Generic.Vector

parsetry.l
* migrate from Util.Vector to Generic.Vector

parsetype.l
* migrate from Util.Vector to Generic.Vector

symbol.l
* migrate from Util.Vector to Generic.Vector

token.l
* fix bug where end of file in string, character or C-string literal causes hang
* fix bug where character literals not required to be exactly one character long

type.l
* migrate from Util.Vector to Generic.Vector

lib/trusted/gllist.l
* implement Generic.List<T> interface
* make push/pop order consistent with Generic.Vector<T>

lib/trusted/gset.l
* implement Generic.Bag<T> interface


(no build number)
compilestate.l
* if verbose output requested output name of each source file as it is parsed

(no build number)

in progress - migrate to generic collections


build 1037

supress information output relating to multi process compilation unless verbose output requested
fix bug where multi process compiles fail with link errors

compilestate.l
* only output process pool information messages if verbose output wanted
* output process pool information messages using ParseTree.message rather than IO.Std.err.println

parsedef.l
* add object files to link set earlier (fixes bug introduced in 1036 that broke multi process compilation because main process did not see correct link set)


build 1036

fix various problems with interfaces and class dependancy checking

compilestate.l
* fix bug introduced in 1035 where .hash files written to current directory instead of lcache
* write .depend files out named .tmp and then rename to .depend when compile complete (fixes problem where .depend files written too early can cause dependancy changes to go unnot\
iced and stale object files to be linked)
* remove debug output
* fix bug introduced in 1035 where .hash files only written if multiprocessing enabled with -jN

container.l
* remove debug output
* add Container.is_interface flag + accessors
* add Container.populateAllImplementedInterfaces. Used to determine complete set of implemented interfaces for a class taking in to account interfaces implemented in parent class \
and parent interfaces of all implemented interfaces
* sort interfaces before coloring interface dispatch table slots so that class compilation order does not affect slot indexes (fixes problem where repeated compiles result in clas\
ses being needlessly recompiled and output executables differing due to changed interface dispatch table slot indexes)
* when coloring interface dispatch table slots, check interface interference and allocate slots on method by method basis rather than interface by interface (reduces amount of was\
ted space in interface dispatch tables)
* support methods in super classes implementing interfaces declared implemented in child classes
* interface error checking for:
all required interface methods implemented
compatible return type in implementing methods
non method members in interfaces

lib/gvector.l
* add clear() method

needcompile.l
* fix bug where .hash files potentially written before being read causing dependancy changes to go unnoticed and stale object files to be linked)

parsedef.l
* mark interface and interface template Containers as IsInteface
* do not class object files to link files set twice
* interface error checking:
interface super class must also be an interface
class super class may not be an interface
implemented interfaces be interfaces
* do not attempt to compile interfaces to object code
* only display 'compile class:' message if class actually requires compilation
* add object files to link in here only

git
* removed some intermediate files from repository

(no build number)

import runtime library


Build 1135 - import into git


Build 1223:
* Support serialization of objects containing pointers subject to some restrictions:
- pointer must point at non-pointer, serializable values
- pointer must point to head of a sequence of values of known length
- object must implement _get_PointerLength(int n)
* Make Generic.Vector serializable
* Library updates to improve support for word type

lib/trusted/gvector.l:
* Reorder fields so allocated length is serialized before value pointer
* Implement _get_PointerLength(int n)

lib/trusted/object.l:
* Add _get_PointerLength(int n), which the serializer uses to get the length of the n-th pointer typed field in an object. Objects with pointers that want to be serializable must override this method and return appropriate values.

lib/trusted/primword.l:
* Add fromString(String s) method

lib/trusted/serial.l:
* Add support for serializing word values
* Add support for serializing pointers with help from containing object via _get_PointerLength()
* Serialize arrays directly without having to create a dummy instance first
* Add readType() method that reads a single type table entry

lib/trusted/string.l
* Add parseWord() method
* Remove debug output

lib/unsafe/klass.l:
* Fix vtable slot number used in TypeTable property
* Add IsArray method that returns true if Class represents an array class

lib/unsafe/stream.l
* add print(word) method


Build 1222:
* Implement transparent serialization support for strings and arrays in library
* Fix bug where interface despatch entries in ctable not filled in for classes where parent class implements an interface but class itself doesn't

container.l:
* Emit interface ctable slots even if class does not implement any interfaces directly. Fixes problem where calls through interfaces could branch to bogus addresses

lib/trusted/array.l:
* Allow init to be called even though resulting object is not useable as an array because serializer needs to construct a temporary instance to detemine how to serialize object
* Override System.Object.IsArray with property that always returns true

lib/trusted/object.l:
* Add IsArray property that should return false unless object has elements after it in memory that need to be serialized

lib/trusted/serial.l:
* Change signature of fromSerial to return an Object, so it has the option of constructing a new object if the one passed in from the serializer is not suitable for some reason
* Support serializing arrays

lib/trusted/string.l:
* Support serializing strings (FIXME: serialized StringBuffers become Strings when read)


Build 1221:
* Emit additional type table entry for arrays for element type

compilestate.l:
* Mark Containers representing specialization of System.Array<T> as IsArray

container.l:
* Add IsArray property
* Emit additional type table entry for element type for classes that are a specialization of System.Array<T> as IsArray

parseexpr.l:
* add method makeGetConstArrayDataPointer that gets a constant pointer to start of array data given constant array pointer and index (used to determine offset of array data when emitting type table for array classes)


Build 1220:
* Implement transparent object serialization for objects that contain only serializable values (i.e. scalars or other objects)

Makefile:
* Build and install native object code version of runtime (lrt-llvm-<version>.o)

container.l:
* Add CallAsFinal property that == IsFinal if class is not an interface or false if it is
* Emit per field type information in class tables

lib.l:
* Include serialization code in shared library

lib/trusted/object.l
* Use same type numbers as compiler
* Update methods that reference type table to reflect changed vtable slot
* Fix problem where Class property referenced wrong vtable slot

serial.l:
* Add register(Class) method that registers a class using it's class name as it's tag (FIXME: won't work for classes with spaces in the name - i.e. Proc<>)
* Implement transparent serialization by walking field type tables to determine serialization action for each field unless class is marked as implements Serial, in which case explicit toSerial or fromSerial methods are called.

lib/unsafe/walk.l:
* Fix to use updated type table format (untested)

parseexpr.l:
* Change makeInstance so it can also calculate constant field offsets (used by type table generation to keep bitcode pointer size independant)
* Change references to IsFinal to CallAsFinal when deciding whether to call virtual methods dynamically or statically

parsetree.l:
* Fix incorrect landing pad generation for finally clauses (wrong argument type to llvm.eh.selector caused landing pads to have no action, which caused the runtime to issue a warning)


Build 1219:
* Add simple serialization support to library (not transparent - requires explicit support from serializable classes to write to/read from serialization stream)
* Fix class<type> construct
* Make Class object for a given class unique by including a static Class object for each class in the class's module referenced from a slot in the vtable where previously various ways of creating a Class all created a new instance of Class on each call (FIXME: need to fix System.Library to use same mechanism to locate newly loaded classes)

container.l:
* Fix naming of per interface id global variables to include prefix '__interface_' before decorated name
* Add getClassGlobal method that returns address of static Class instance for a given Container, creating the LLVM global variable if it doesn't exist in the current module
* Remove dead code
* Place a reference to class's static Class object in ctable in emitTables() (in currently unused type table slot to avoid breaking existing code)

lib/trusted/serial.l:
* Clean up code

main.l:
* Remove debug output

parsedef.l:
* Create static Class instance for each class compiled

parseexpr.l:
* Fix class<type> construct (FIXME: use of '<'/'>' in this syntax is not consistent with other constructs involving types)
* Remove debug output


Build 1218:
* Warn and always return false for 'isa' for type where no runtime type information available
* Clean up after implementing 'isa' and runtime interface type checks

container.l:
* Remove debug output

lrt-unwind.c:
* Remove debug output

parsecall.l:
* Remove debug output

parsedef.l:
* Remove debug output

parseexpr.l:
* Remove debug output

parseexpr.l:
* Warn and always return false for 'isa' for type where no runtime type information available
* Remove debug output

symbol.l:
* Remove debug output


Build 1217:
* Complete runtime type checking of casts to interfaces
* Implement 'isa' construct that performs runtime type testing against class and interface types

container.l:
* Uncomment code that forceably overrides Object._implements() with current class's __implements_ method when class tables are being output

parseexpr.l:
* Add class IsA that implements the 'isa' construct
* Move methods for emitting code for testing if an object is a paricular class or subclass of that class and for testing if an object implements a particular interface out of Cast and into Expression
* Remove runtime check warning now as cast checks are working again

syntax-l.jay:
* add isa construct (isa some_type(x) for example: isa List<String>({"test"}) == true)

token.l:
* add 'isa' keyword


Build 1216:
* Progress towards run time type checking for interfaces

container.l:
* Split getting LLVM function type for __implements_ function out of getImplementsFunction into getImplementsFunctionType
* Fix linkage for per interface global variable (initialize it to null and set with link-once-any linkage so we get exactly one copy in the program)
* Forceably override Object._implements() with right __implements_ function for class in emitClassTables (commented out until re-bootstrapped)
* remove dead code

lib/trusted/gvector.l:
* Don't wrap toString result in '[Vector' and ']'

lib/trusted/object.l:
* mark _dispose() as @Virtual (FIXME: @Virtual may not be neccessary)
* add _implements() method and mark as @Virtual (FIXME: @Virtual may not be neccessary)

parseexpr.l:
* warn and mark unsafe if non-object is cast to an object (although cast is run time checked the check itself is not safe if the source type is not object since it dereferences an untrusted pointer)
* add makeInterfaceCastCheck that emits code that calls an object's __implements_ method to determine if it implements a given interface and either returns a boolean or throws a cast exception
* add makeObjectCastCheck that emits code that determines if an object is an instance of a specific class and either returns a boolean or throws a cast exception
* if a cast requires a runtime check emit either an implemented interface or class instance test (previously only class instance tests were supported)

syntax-k.jay:
* support pragmas within block statements

type.l:
* add isInterface() method that returns true if a type is an interface


Build 1215:
* Work towards run time type checking for interfaces
* Small additions to library

container.l:
* add getImplementsFunction, which refers to a function for a class that takes an interface global variable and returns true if that class implements the interface
* add getInterfaceGlobal, that returns the address of the global variable for an interface (which is just used as a handle to uniquely identify the interface)
* use updated Generic.Sort<T> to sort interfaces prior to selector coloring

lib/trusted/gsort.l:
* add a new class, Generic.Sort<T>, that can override sort order via a supplied element compare proc reference (defaults to T.opCompare(T))

lib/trusted/object.l
* add opEquals and opCompare methods

lib/trusted/primlong.l:
* add fromString method

lib/trusted/primtype.l:
* add fromString methods (having same name for this across types makes it more useful in templates than String.parseXXXX()).

lib/trusted/string.l:
* support parsing and formatting longs

lib/unsafe/stream.l:
* additional constructor for IOException without os_error parameter
* add print methods that print chars, ints and longs directly

parsecall.l:
* fix problem where creating proc reference could cause compile time SEGV in some cases

parsedef.l:
* emit a function for each class that takes an interface global variable and returns true if that class implements the interface

parsetree.l:
* relax array subscript LLVM value type check to test for any integer type rather than only 32-bit integer

symbol.l:
* fix incorrect ordering in Quality.opCompare that caused less specific overloads to be preferred when creating proc references


Build 1214:
* Limited support for searching box classes when creating proc references (currently only works if left value is a (non-type) expression or a type identifier, which is enough for the library template classes' needs)

Makefile:
* Fix install path for lang.so

compilestate.l:
* Fix link path for dummy.o

lib/trusted/gproc.l:
* Fix compile error

parsecall.l:
* Add check around suspicious code that checks isClass on method call left value to determine if static rather than method.IsStatic
* Search left value box type for proc method if left value is not a class
* Remove bogus isObject/CanTreatAsObject test when creating proc references
* Simplify logic when compiling proc reference creation
* Improve error reporting when compiling proc reference creation

parseexpr.l:
* add isType() method

parseident.l:
* implement isType() method that returns true if identifier is a type variable (and hence has no value)


Build 1213:
* Fix comparison orderings in opCompare throughout library

Makefile:
* run jay with -v to create y.output

lib/trusted/primlong.l:
* remove from bits specific directories as no bits dependant code
* fix opCompare order

lib/trusted/primword.l:
* remove from bits specific directories as no bits dependant code
* fix opCompare order

lib/trusted/primtype.l:
* fix opCompare orders

lib/trusted/string.l
* fix opCompare order

parseexpr.l:
* change names for proc thunks to better match their purposes

parsetype.l:
* add missing call to clear()


Build 1212:
* Support references to virtual methods:
- can be used to call a virtual method as if it were static
- can refer to any virtual method with correct signature
- take an additional initial parameter that is the object to invoke the virtual method on
- the actual method called is resolved at call time depending on the type of the first argument

A reference to a virtual method is created if:
- proc ref first argument is a class
- left value of requested method is assignable to that class
- a method is found that matches the proc ref type with the first argument type removed and this method is a strictly better overload match than any method found by regular static or bound method search (for example void proc(Test,int)(Test.test) would match test() in class Test { void test(int) { } })

* Change syntax of proc reference creation to include return type. This fixes a problem where it was not possible to resolve types of proc references early enough in compilation in some circumstances.
* Fix problem where redefining a static method in a subclass caused an exception (FIXME: currently this is allowed although the resulting semantics are not defined. Should determine if behaviour is reasonable and issue a warning or an error as appropriate.

container.l:
* Support return type for proc reference creation expression
* Use supplied return type to make sure concrete version of Proc<P> exists in checkTemplates() (Not previously possible as return type was not known until compile pass. Fixes 'wrong pass should have been done earlier' errors)
* Check if method is static before attempting to get its address when building class tables (fixes an exception due to address not valid if static method redefined in subclass)
* Support creating unbound references to virtual methods
* Remove debug output

parseexpr.l:
* Support creating unbound references to virtual methods including required thunks
* Remove debug output

syntax-k.jay:
* Include return type in proc ref creation syntax

syntax-l.jay:
* Include return type in proc ref creation syntax


Build 1211:
* Update JIT library to work with current LLVM
* More Makefile fixes

Makefile:
* Only set defaults values for LLVM_CC and LLVM_CXX if not already set
* Create safe directory before install if it doesn't already exist
* Remove '-N' option from dependancy generation command line
* Add rules for building parsers from grammars

jit.cpp:
* Switch from ModuleProvider (removed from LLVM) to getLazyBitcodeModule

llvmc.cpp:
* Remove unreferenced include of llvm/Support/Streams (removed from LLVM)

compilestate:
* Make dependancies referencing library directory reference ./lib


Build 1210-1:
* Remove debug output

Makefile:
* Only set defaults values for LLVM_CC and LLVM_CXX if not already set

parseexpr.l:
* Remove debug output


Build 1210:
* Fix problem in 1209 where virtual method calls broken
* Add 'bootstrap' target to Makefile that bootstraps compiler and sanity checks result

Makefile:
* Add 'bootstrap' target that that bootstraps the compiler three times (/bin/lc -compile-1-> ./lc1 -compile-2-> ./lc2 -compile-3-> ./lc3)and checks that the last two resulting executables (./lc2 and ./lc3) are identical

parseexpr.l:
* Fix problem where wrong this parameter passed to makeCrowbarCall resulting in generated virtual method calls jumping through hyperspace


Build 1209:
* Restore support for proc references (previously disabled on LLVM back end)
* Support compile shared libraries via bitcode object files, which enables global optimization within the shared library

Makefile:
* Compile and install L shared library (relies on changes to llvm-ld to support '-shared' option)
* Default to -w (no standard library) when building but allow overriding via LFLAGS

compilestate.l:
* Additional linker options when compiling native PIC executable with bitcode object files (FIXME: not all needed now added '-shared' support to llvm-ld)
* Recognise '.so' as a valid object file extension
* Add missing relocate option to llc command line when compiling to native object code (fixes problem where object files not position independant despite -CP option)

container.l:
* separate out code for getting LLVM function type for a given L method into a separate method (Container.getLLVMFunctionType())

jit.cpp:
* prototype mechanism for freeing global variables after modules loaded and compiled in attempt to determine what is leaking when loading LLVM modules (not enabled)

lib/trusted/gproc.l:
* change types of opaque members (thunk address, bound object reference, target method address) from word to char ptr to simplify (reduce number of casts required) proc reference creation and call bitcode.

parsecall.l:
* create proc references support
* call through proc references support

parseexpr.l:
* separate out code that gets a function pointer from an object's vtable into a separate method
* separate out code that casts all arguments to matching LLVM types and calls a function into a separate method
* call through proc reference support
* support creating thunks required to call through a proc reference to a given method
* call through proc references support
* create proc references support

parseident.l:
* fix references to compileLoad to add (null) return type parameter required by proc reference support


Build 1208:
* Implement compiling to native object files, which trades code quality for compile speed. Builds where only a subset of source files changed get a speed up plus enabling parallel backend via -jN regains its benefit as native code generation parallelized. Build times for compiler itself back down to around 11 seconds as with old back end (although total amount of code compiled is somewhat lower as old back end is gone)

Makefile:
* Allow lc compiler and compile flags be overridden via environment variables LC and LFLAGS

compilestate.l:
* Support compiling to bitcode or native object files
* Split WantNative into WantNativeExecutable and WantNativeObjectFiles
* Use either gcc or llvm-ld as linker depending on WantNativeObjectFiles option
* Compile bitcode to assembler and assemble to native object file if WantNativeObjectFiles option set
* Reenable WantPIC option (untested)

main.l:
* Rename -N/-n option that selects native or bitcode executable to -CN/-Cn
* Add -CB/-Cb option that selects native or bitcode object files (FIXME: really need to sort this option names out)

needcompile.l:
* Use CompileState .getObjectFileName to determine object file name for class, which knows whether file should end in ".bc" or ".o"

parsedef.l:
* Call CompileState.writeOrAssembleBitcode to write out and, optionally, compile to assembler and assemble to native object file


Build 1207:
* Support building compiler and library to .zip file for install on another machine via unzip

Makefile:
* Build runtime bitcode file
* Support install to arbitrary prefix
* Fix inconsistencies in library directories for various installed files
* Support install to a .zip file by installing to directory in /tmp and then zipping the result
* Preserve dates on installed files and don't overwrite existing files if newer
* Add 'clean' target
* Include $(MODEL) on C/C++ compiler command lines in case we're cross compiling
* Build and install fcgi.o

common/exception.c:
* Move into main source directory

compilestate.l:
* Bodge make dependancy file generation so library appears in current directory (fixes problem where dependancy generation sees installed library but we want it to see changes in the as-yet-uninstalled ./lib source directory. FIXME: need a clean solution for this)
index 928e9bd..a36bec4 100644
* Search current directory first when searching for source files
* Make library directory search order more consistent

jit.cpp:
* Rename some variables for style consistency with rest of codebase
* Disable optimization by default, enable by calling __JIT_enable_opt() before loading any modules
* Delete bitcode for functions after they're compiled

lib/amd64/*:
* remove as no longer referenced

lib/linux-x86-64/unsafe/jit.l:
* fix path for import of jit.o (FIXME: need a cleaner way to implement imports of .o files - should search either library or source path)

lib/trusted/string.l:
* implement System.StringBuffer System.String.replace(char replace, char with);

lib/x86/*:
* remove as no longer referenced

parseexpr.l:
* mark String literal objects as constant

parsetree.l:
* mark C string literals as constant


Build 1206:

Makefile:
* Generate dependancies from source (so lc works better with make)
* Add 'install' target
* Build C/C++ object files in working directory and only copy to install directory on 'make install'
* Fix library build
* Install library by copying rather than having a symbolic link to the source directory

compilestate.l:
* Add WantPrintDeps option that generates a dependancy file from set of files visited

jit.cpp:
* Rename lli.cpp (originally derived from LLVM lli.cpp) to jit.cpp as that's what it's used for
* No longer use Linker to link loaded modules as it doesn't seem to be required, instead store a list of loaded modules and search this list when searching for functions by name

main.l
* Remove unused -D/-d options that used to generated debug information
* Add -D option that generates dependancies (FIXME: consider changing to -M to match GCC)


Build 1205:

Makefile:
* build JIT wrapper jit.o

lib/unsafe/stream.l:
* add exists static method and Exists property

lli.cpp:
* delete builder and linked modules after use (FIXME: still seems to consume a huge amount of memory for tiny amounts of loaded bitcode)

compilestate.l:
* search lib/<target-id>/unsafe before lib/unsafe to allow target specific unsafe libraries


Build 1204:

* Implement 32-bit x86 support

compilestate.l:
* add RuntimeFunction.GET_L_EXECPTION that calls __get_l_exception to extract the L Exception object reference from a struct _Unwind_Exception_L
* add Want64BitTarget option
* replace Machine.NAME with CompileState.TargetISA (last vestiges of Gen.Machine now gone)
* add String TargetID property that returns a triple: OS name-target ISA name-pointer bits
* search LIBRARY_DIR / TargetID for target specific libraries

exception.l:
* work around undiagnosed SEGV in _Unwind_Backtrace on 32-bit x86 by simply not populating backtrace on non-64-bit system

llvm/lrt/Makefile b/llvm/lrt/Makefile:
* make install directory and paths to C and C++ compilers configurable via environment

llvm/lrt/unwind.c:
* use malloc and free rather than GC_malloc to allocate _Unwind_Exception_L structures
* nest _Unwind_Exception structure inside _Unwind_Exception_L rather than trying to copy its layout
* implement __get_l_exception, that extracts the L Exception object reference from a struct _Unwind_Exception_L so bitcode does not need to know its layout
* remove some debug output when creating _Unwind_Exception_L structures
* remove a load of unused code from personality function as we always want our landing pads called irrespective of exception type

llvm/machine.l:
* remove more unused code (FIXME: this file can go now)

main.l:
* disable GC on startup while debugging 32-bit target
* fix option parsing problem for options where value or sub-option in following command line argument
* add -m32 and -m64 command line options

parseexpr.l:
* remove use of broken Type.Size property when compiling casts
* throw quieter exception on encountering parse tree node with no type assigned as this happens often after errors and backtrace is distracting (FIXME: should fix underlying problem here)

parsetree.l:
* use __get_l_exception to get L Exception object reference from _Unwind_Exception in landing pads
* remove redundant references to broken Type.Size property

type.l:
* return either 32-bit or 64-bit integer LLVM.Type for Type.WORD depending on Want64BitTarget (FIXME: it would be nice if we could emit 32-bit/64-bit agnostic bitcode - so far this is the only place that's conditional on word size)


Build 1203:
* Implement runtime cast checks
* Only validate modules once after all methods compiled
* Only validate modules and functions if no errors have occurred yet

compilestate.l:
* add support for RuntimeFunction.THROW_CAST, which calls System.CastException.throwCast()
* remove unused WantProfile option
* add WantCastCheck option

trusted/exception.l:
* add System.CastException.throwCast(), which is called when invalid casts are detected

lib/unsafe/stream.l:
* fix missing System qualifier on String type that broke build

main.l:
* enable WantCastCheck option by default
* remove redundant -A/-a option
* add -CC/-Cc options that enable/disable cast checks

parsedef.l:
* don't warn for missing static methods in libraries (FIXME: 0 was a bad choice of address for static methods as it's not possible to determine if the method is present in a library)
* only verify modules after class is completely compiled and only if no errors occurred (should be slightly faster and avoid some spurious errors from LLVM after compiling classes that contain errors)
* only verify functions if no compile errors have yet occurred

parseexpr.l:
* add checks to casts where required to ensure value is reference to object of compatible class (FIXME: should move the throw call to the method end)

parsetree.l:
* add NoCastCheck pragma
* remove NoProfile pragma


Build 1202:
* Fix a problem where array bounds checks could generate invalid LLVM bitcode
* More null check fixes

compilestate.l:
* revert SEGV handler support

stream.l:
* implement IO.Writer.toString() to display IO.CharStream it's writing to

parsecall.l:
* if left value of a MethodCall is super or explicit this, do not supply left value to compleLoad (avoids a redundant null check in this case)

parseexpr.l:
* move null check when attempting to get array size before GEP rather than relying on null check in makeLoadIndirect (fixes problem where operations on null arrays did not result in a null pointer exception because tested address had one word offset applied)
* handle call through super class with null from (FIXME: code for call through super with non-null from should be removed)
* add null check before proc call

parsetree.l:
* add unreachable statement after array bounds check (fixes problem where bounds checks could cause LLVM assertion failure)
* add explicit null check on array subscript if array bounds check not enabled (fixes problem where array subscript with null pointer check enabled but bounds check disabled could fault instead of throwing null pointer exception)


Build 1201:
* combine duplicate runtime exception throws into single call where possible

common/exception.c:
* change __segv_handler to call System.MemoryException.throwME() on SEGV signal (untested)

compilestate.l:
* store outermost throw null and throw bounds basic blocks in CompileState

* write out address of static functions as zero when writing library hash files
* call __install_segv_handler in __entry_point
* used modified name for llvm-ld as L version forces relinkable executables, which breaks llvm-gcc if it tries to use our linker

container.l:
* do not allocate vtable slots for static functions
* do not include addresses of static functions in class hashes (since they're now always zero)
* issue warning if attempting to override static function with virtual or vice versa

lib/trusted/exception.l:
* add static void MemoryException.throwME() that runtime uses to create and throw an exception on SEGV signal

llvm.l:
* add toString() method to struct BasicBlock so it can be stored in a Generic.Vector
* support adding basic blocks that are output at the end of the IRBlock (used to put exception throw code out-of-line)

parseexpr.l:
* add explicit null check before calls through non-this
* remove redundant null check on this (as null checks on calls should ensure that this is never null)

diff --git a/parsetree.l b/parsetree.l
* merge multiple ArrayBoundsException and NullPointerException throws into single function call per exception type per exception handler block, which reduces the bloat from explicit null + bounds checks and should mean the branches default to predicted not taken (at least in non-optimized code)
* move test for WantNullCheck option into addNullCheck so it applies to all null checks and not just ones resulting from makeLoadIndirect()
* remove now redundant null check in addStoreIndirect()
* remove debug output in ErrorValue
* add staticError that prints an error message and sets the errors occurred flag (FIXME: buildClassTables needs to be able to issue errors including source file name and line number)
* remove redundant null check flag from addStoreIndirect in assignment (FIXME: not sure addStoreIndirect needs this flag at all)

symbol.l:
* debug output if Symbol.Address called on symbol with no valid address


Build 1200:

* Fix problem where incorrect object size stored in ctable causing Class.create() to construct corrupt objects

Makefile:
* Don't link against pre-linked standard library (avoids problems where changing library classes can result in a compiler that can't create executables)

compilestate.l:
* Only link in dummy.o (stubs for unimplemented runtime functions) if WantLinkLibraries set

container.l:
* Store LLVM constant expression for object size in ctable size slot rather than Container.Size since this value is not correct (fixes problem where Class.create() caused memory corruption due to incorrect size of constructed objects)

lib/trusted/object.l:
* Check this is not null in _dispose (FIXME: this works around an as yet undiagnosed problem where the GC calls Object._dispose() on null objects)

llvm.l:
* Add LLVMConstTypeSizeIndirectPointer(Type) that returns a type's size as a constant pointer to that type. This is required for storing object size in ctable where we want to avoid casting a potentially 64bit pointer through a 32bit integer and back (there's no chance of information loss in this particulara case but the cast is not implemented by the LLVM code generator)

parsedef.l:
* Work around a problem where occasionally no hashes appear to be stored for a class in a library even though the class itself is present


Build 1199:
* return zero from main()

common/exception.c:
* return zero from main()

compilestate.l:
* attempt to set --export-dynamic linker option to make executables relinkable (FIXME: doesn't work - currently bodged in llvm-ld instead)

lib/unsafe/library:
* add static methods to locate a class searching all libraries (which is only behaviour supported right now anyway)

parsetree.l:
* honour WantNullCheck option
* check value is pointer before issuing null check (fixes crash if null check emitted for error value)

symbol.l:
* set DLLExport linkage on static variables to make executables relinkable (FIXME: may not be required)


Build 1198:
* Fix null check issue and enable null checks by default
* Fix option parsing issues

main.l:
* fix problem where sub options in following program argument caused options to be mis-parsed (FIXME: this escaped undetected for a long time because type checking on arithmetic operations is incomplete)

parseexpr.l:
* change null check on instance variable loads to check this pointer for null not the address of the instance variable


Build 1197:
* Support compilation directly to native code (-N option)
* implement null pointer checks
* reinstate array bounds checks

Makefile:
* use -N native output option rather than compiling to bitcode and then running lcc and g++

compilestate.l:
* add RuntimeFunctions THROW_NULL and THROW_BOUNDS
* add WantNullCheck flag
* add OptimizeLevel option, which currently just disables optimization if set to zero and enables it otherwise
* add WantNative flag
* add WantForceLink flag
* add WantOneFile flag, which compiles all bitcode into single module rather than one module per class
* don't link if no code generated and output file exists unless WantForceLink flag is set
* remove WantPIC flag
* remove WantRedZone flag (FIXME: may want to revert this as LLVM has an equivalent function attribute)

lib/trusted/exception.l
* add static NullPointerException.throwNPE() method, which is used to construct and throw an exception on failed null pointer checks
* add static ArrayBoundsException.throwBounds() method, which is used to construct and throw an exception on failed array bounds checks

main.l
* default to OptimizeLevel = 1
* add C option that enables/disables runtime checks
.. -CA/-Ca enables/disables array bounds checks
.. -CN/-Cn enables/disables null pointer checks
* add f flag that forces link even if no classes compiled
* change L option to l for consistency with other compilers
* change l option to s
* remove P option
* change S option to T
* add S option that compiles into a single module rather than multiple modules followed by link
* add W/w option that enables/disables the standard library
* add N/n option that enables/disables native code executable
* remove obsolete code generation options

needcompile.l
* support single module compile

parseexpr.l:
* remove dead code
* null check on dynamic method call

parseident.l:
* remove a redundant null check

parseloop:
* remove dead code

parsetree.l:
* switch from using llvm.eh.selector.i64 to llvm.eh.selector
* null check on store as well as load
* remove dead code
* add NoNullCheck pragma
* use invoke instead of call for array bounds check fail if active exception handler

parsetry.l:
* use 32 bit local for current exception type rather than 64 bit
* use pointer rather than 64 bit integer for exception value when calling LLVM llvm.eh.exception and llvm.eh.selector (should make code 32/64 bit agnostic, untested)


Build 1196

* Add llvm.l source file, which was missing from repository


Build 1195:
* Fix problem where classes always compiled even if .bc object file current with respect to source (due to struct size issue causing garbage results for IO.Stat)

Known problems:
* structs are treated as if they have a vtable pointer both when allocated and when computing field addresses (which is consistent but breaks interfacing with C or other code that doesn't expect the additional pointer sized hole at the start of the struct)

common/exception.c
* work around struct size issue in __stat_file

lib/unsafe/library.l:
* drop .so support
* implement .bc support

needcompile.l:
* fix problem where object file existence and date check used '.o' file extension instead of '.bc'

parsedef.l:
* output a __get_ctable function for every class that can be used by System.Library to locate dynamically loaded classes

parseexpr.l:
* remove debug output

type.l
* remove debug output


Build 1194:

Reenable shared library support:
* Support creating a library .bc file plus .lh library hash file
* Support static linking against a library .bc file as defined in corresponding .lh library hash file
* Support dynamic linking against a library .bc file as defined in corresponding .lh library hash file
* Initial changes to LLVM lli to support dynamic loading and linking of bitcode files

Makefile:
* build lc using library in lang.bc

compilestate.l:
* add WantLinkLibrarys property. If true will link library bitcode into output executable bitcode, otherwise required library bitcode must be linked at runtime when executable is loaded.
* change library hash file extension from ".ll" to ".lh" to avoid name clash with LLVM assembler files
* remove debug output
* change shared library file extension from ".so" to ".bc"
* don't link in runtime if building a library
* add WantLinkLibraries property that, if true, statically links in referenced .bc libraries

string.l:
* don't allocate excessively long StringBuffers for results of String.split(char)

llvm/lrt/unwind.c:
* remove debug output

main.l:
* remove debug output
* add a new command line option -U/-u, which enables/disables static linking against bc libraries, default is -U
* change library hash file extension from ".ll" to ".lh" to avoid name clash with LLVM assembler files

parsedef.l:
* alter code emitted for static init functions to check if function has already been run and return immediately in that case.
* issue warning if class hash differs between current source and stored library hash (FIXME: not clear why this is failing for some library classes even though all stored method offsets appear to match)
* remove redundant call to state.addLinkFile which broke static library linking


Build 1193:
* Fix GC roots for JIT

generator.l:
* remove file

intermediate.l:
* remove file

llvm/lrt/unwind.c:
* when a GC root is added, expand existing GC root region to include it rather than adding a new region (fixes problem where roots not correct because static variables not contiguous within a class under JIT)

mblock.l:
* remove file

mflow:
* remove file

mframe:
* remove file

mtree:
* remove file

parsedef.l
* call __add_root for each static variable rather than __add_roots for range (fixes problem where roots not correct because static variables not contiguous within a class under JIT)


Build 1192:
* Remove old back end
* Implement exception backtraces (not yet useful as backtrace_symbols() doesn't resolve function addresses to symbols for some reason)
* Build fixes to enable compiler to run under JIT (FIXME: requires GC be disabled so presumably static variable roots still not correct)

Makefile:
* build llvmc.cpp as shared library for compiler to link against when run under JIT
* build optimized and non-optimized bitcode executables

compilestate.l:
* remove references to old back end
* return __alloc_object_finalize as runtime function for finalizable object allocation (fixes problem where finalizers not run on garbage collected objects)
* store value of enum members as constant LLVM.Value rather than integer (allows removing reference to old back end constant folding code)

container.l:
* remove references to old back end
* if a symbol has no valid address but has a constant LLVM.Value then use that value as the symbol's hash when calculating hash over container's members

lci.sh:
* script to run compiler bitcode executable under JIT

lib/trusted/exception.l:
* backtrace support using C library functions backtrace() and backtrace_symbols()

lib/unsafe/stream.l:
* make open mode constants public

llvm/llvmimports.l
* remove redundant reference to LLVMBitWriter library (FIXME: this whole source file is now redundant)

llvm/lrt/unwind.c
* remove debug output

llvm/machine.l
* remove references to old back end

llvmc.cpp:
* add LLVMGetConstValue(LLVMValueRef) that gets the value of it's argument, which must be a constant integer

main.l:
* remove references to old back end

mbitset.l:
* remove references to old back end

parsecall.l:
* remove references to old back end

parsecond.l:
* remove references to old back end

parsedef.l:
* remove references to old back end
* store value of enum members as constant LLVM.Value rather than integer (allows removing reference to old back end constant folding code)
* sanity test to check all static variables have GC roots added
* store value of constants as as constant LLVM.Value rather than integer (allows removing reference to old back end constant folding code)

parseexpr.l:
* remove references to old back end

parseident.l:
* remove references to old back end
* store value of constants as as constant LLVM.Value rather than integer (allows removing reference to old back end constant folding code)

parseloop.l:
* remove references to old back end

parsepackage.l:
* remove references to old back end

parsetree.l:
* remove references to old back end
* keep reference to a dummy IRBlock used when compiling expressions that are expected to be constant
* fix for problem where pragmas not applied correctly (untested)

parsetry.l:
* remove references to old back end

parsetype.l:
* remove references to old back end

symbol.l:
* allow get Address property for symbols with no valid address, with warning message, for debugging purposes


Build 1191
* Reenable garbage collection in lc
* Remove debug output

lib/trusted/gvector.l:
* remove debug output

llvm/lrt/throw.cpp:
* remove debug output

main.l
* do not disable garbage collection on compiler start

parsedef.l:
* remove debug output

parseexpr.l:
* remove debug output

parseident.l:
* remove debug output

parseloop.l:
* remove debug output

parsepackage.l:
* remove debug output

parsetree.l:
* remove debug output

parsetry.l:
* remove debug output

symbol.l:

Build 1190:
More LLVM fixes:
* now bootstraps with LLVM back end (statically compiled with llc)
* remove unused dependancy on LLVM JIT
* allow import of .bc files (same as importing .o)
* fixes for Boehm GC

compilestate.l:
* remove references to unused LLVM JIT
* recognize ".bc" as an object file extension when importing

container.l:
* fix interface offset calculation for LLVM
* emit a call to GC_add_roots() in __static_init for classes with at least one static variable

lib/trusted/exit:
* debug output (mostly commented out)

lib/trusted/gvector.l:
* treat all vectors as having reference elements (FIXME: T.isreference is currently broken)
* handle printing vectors with null elements
* debug output

lib/trusted/string.l
* debug output
* disable Freeze

llvm/lrt/unwind.c
* debug output
* work torwards exception backtraces
* return cleanly if version < 0 in handleLsda since this function must be called to be JIT'd before any exception is thrown

main.l
* initialize garbage collector on startup (FIXME: probably not needed)
* disable garbage collection on startup (FIXME: may no longer be needed)

parsedef.l
* emit call to debug output at start of __static_init for each class with static variables
* emit call to __add_roots for each class with static variables (FIXME: is this done, incorrectly, only for classes with static initializers?)
* debug output for interface calls

parsepackage.l
* debug output

parsetree.l
* avoid using static variable in newline() (FIXME: no longer needed)

symbol.l
* set LLVM Values for first and last static variables in class via Container.hasStatic()

Build 1189:
More LLVM exception handling fixes

parsetree.l:
* store unwind struct pointer in ExceptionDescriptor as well as L exception object
* rename ExceptionDescriptor fields for clarity

parsetry.l:
* when jumping to outer exception handler due to unhandled exception within function, propogate unwind struct pointer as well as exception type and L exception object (fixes problem where return with active exception handler returns garbage)

Build 1188:
More LLVM exception handling fixes

parsetry.l:
* fix rethrow/return test after outermost exception handler (untested)
* forward current exception type and L exception object to outer handler on unhandled exception (FIXME: this won't work if the exception is a return - need to forward the original unwind exception struct as well here)
* change names of locals used to hold in flight exceptions to make purpose clearer
* push L exception object onto exception descriptor stack not unwind struct pointer (FIXME: really need both - see above)
* store 'caught' flag in exception type on entry to try body so default handler action is to run finally block and swallow exception rather than propogating an empty exception

Build 1187:
LLVM exception handling fixes

compilestate.l:
* add InBottomExceptionHandler propery

throw.cpp:
* print address of thrown exception for debug purposes

unwind.c:
* allocate additional word after end of _Unwind_Exception structure to store pointer to L exception object
* wrap debug output in macro so it can be suppressed conditionally

parsetree.l
* declare __l_personality as vaarg (FIXME: probably no required)
* reinstate dummy type info arg to LLVM eh selector intrinsic
* store 'exception not yet caught' flag in .eh_type on entering catch landing pad
* fix offset used to obtain L exception from unwind exception structure

parsetry.l
* fix broken catch vtable test
* store caught exception in catch block parameter variable
* store 'exception caught' flag in .eh_type on leaving catch block (FIXME: flag value is wrong here)
* test .eh_type before entering catches block to ensure flag is 'uncaught exception' (FIXME: is this needed?)
* rethrow uncaught exceptions with _Unwind_RaiseException()

parsetype:
* don't throw exception if trying to display a type with no dump() method

Build 1186-8:
More LLVM fixes

lib.l
* don't import library.l as uses a proc reference that currently breaks LLVM code generation

compiler.l
* don't use Library class as uses a proc reference that currently breaks LLVM code generation

parsedef.l
* remove debug output
* force initializer for static variables (FIXME: ugly)

parseexpr.l
* fix problem where !~ compiled to null LLVM.Value causing seg fault at compile time
* return dummy value for proc calls allowing code using them to compile (to broken code)

parseloop.l
* fix foreach statements where type of loop variable is not inferred

parsetree.l
* fix problem where assigning to array accessor caused LLVM assert failure

parsetry.l
* fix problem where multiple catches for try statement caused seg fault

Build 1186-7:

Fix LLVM support for static variables including initialization of static variables on program start

compilestate.l
* run System.Startup.run1(main_object) on startup (which will give us exception catch all and on exit handling, once exception handling is working)

container.l
* add HasStatic property, which is true if the class has any static initializers

parsedef.l
* if a class has any static initializers then emit a function that runs them and append it to the global llvm.global_ctors array so the initializers run before a module loads (FIXME: need to do topographical sort of initializer dependancies and order them accordingly otherwise no guarentee that dependent initializers not initialized in wrong order)

parsetree.l
* make some standard Type values publically accessible

symbol.l
* if a symbol's LLVM static global value is referenced then mark its owner as needing static initialization
* if a symbol's LLVM static global value is referenced whilst compiling its owning class then generate a null initializer for it (fixes LLVM error if static variables referenced)

Build 1186-6
more LLVM fixes

compilestate.l
* don't link against pthread as llvm-ld places broken -load directive in lli script referencing static libpthread.a (FIXME)

parsecall.l
* remove dead code

parseexpr.l
* fix LoadTemporary to load an LLVM.Value (optionally indirect) rather than an ITree

parseloop.l
* fix foreach statement LLVM support
* no longer issue special case code for foreach over an array, instead just let elements() auto box to Generic.Array

Build 1186-5:
more LLVM fixes. Get linking and entry point working (entry point now calls Main.init() directly - really needs to call library start up)

Build 1186-4:
more LLVM backend work - linker command line and entry point

Build 1186-3:
continue back end port to LLVM. Mainly exception handling

Build 1186-2:
More progress on LLVM back end

Build 1186-1:
Progress towards LLVM back end

Build 1186:
begin support for LLVM back end

build 1185

mtree.l
* zero rax before call if called method is named 'fprintf' (indicates zero parameters in XMM registers, fixes problem where native.fprintf can crash on Amd64)

parsedef.l
* fold constants in enum initializers (fixes problem where constant expressions not accepted as enum initializers)


build 1184
* fix problem where exception backtraces were sometimes empty
* fix sandboxed compilation

common/exception.c
* additional debug output
* fix problem where exception backtraces were occasionally empty (caused by backtrace info not populated when unwind info located by binary search rather than cached lookup or initial linear search)
* use sigaltstack to setup up alternate 64kB signal stack for SEGV handler
* exit if unable to install SEGV signal handler at program startup

lib/trusted/exit.l
* fix sandboxed mode by adding NoMarkUnsafe pragma

ltest/test83.l
* don't enable GC after null pointer exceptions (no longer required)

main.l
* change copyright date to 2004-2010

mflow.l
* remove debug output

parseexpr.l
* remove debug output


build 1182

* faster temporary live range size calculation

compilestate.l
* reduce maximum inlineable method size to 25 parse tree nodes (otherwise code size increases and no performance benefit)

mflow.l
* reinstate calculate range sizes only if register variables and/or copy coalescing enabled
* simple and fast temporary live range size calculation based only on distance from first to last referencing instruction in method (i.e. linear distance ignoring CFG). Ranges are used when choosing what temporaries to consider spilling and which temporaries to split when live ranges for fixed color temporaries overlap. Exact ranges not needed as worst effect of any inaccuracies are poor descisions resulting in worse code and old accurate range size calculation was very inefficient.


build 1181
* fix bug where inlined overloaded inequalities could miscompile to the reversed version of the operator
* simplify range size calculation in order to test effect on coalescing

common/Makefile
* compile exception.c -O1

common/exception.c
* use non GC pthread functions (FIXME: why?)
* use GC_malloc instead of GC_malloc_ignore_off_page for object allocations if not using GCJ malloc
* don't attempt to trace all deallocations via finalizers

compilestate.l
* increase maximum inlineable method size

intermediate.l
* remove dead code
* sanity check on copied ITree operator number
* set size of LIST ITrees created in transformForInline to zero (prevents non-canonical LIST operator numbers being created here)
* set size of COPY ITree created in transformForInline to original size (prevents size being inconsisted with size encoded in operator here)

lib/trusted/vector.l
* reorder fields for better packing
* switch to gvector style reallocation scheme
* use GC_malloc_ignore_off_page to allocate array of vector values

lib/unsafe/thread.l
* use non GC pthread functions (FIXME: why?)

main.l
* print backtrace on fatal error

mbitset.l
* remove debug code recording largest allocated bitset

mblock.l
* convert setter functions to accessor syntax

mflow.l
* remove dead code
* range size calculation debug code
* try simple but inefficient range size calculation that iterates over live set at each instruction incrementing range sizes for each live temporary
* always calculate range sizes while debugging coalescing bug
* remove debug heap probe
* if range size identical (or not calculated) when splitting temporaries, make split decision based on number of references instead

mtree.l
* comment out unused comparison methods
* debug output names of last inlined methods
* disable GC around getMethod (FIXME: probably pointless)

parseexpr.l
* debug output overloaded inequalities
* fix for issue where inlining could break overloaded inequalities due to overwriting original comparison operator
* debug output for inlined methods

parsetree.l
* remove probeHeap()
* add NoRegVars pragma (FIXME: may be broken - state not restored when compile states popped)


build 1180

* fix null pointer handling problems
* fix bug where exceptions could fail to be caught
* add debug code to investigate contents of heap when compiling

amd64/lrt/lrt0.S
* explicitly set libgc stack bottom on program entry
* add __native_thunk that saves all callee save registers and then calls a native function (prevents problems caused by unwind not restoring registers if native function could throw an exception)

common/exception.c
* exit with error rather than just displaying warning if bad exception descriptor encountered when handling exception
* additional debug output
* fix bug where binary search by instruction address could fail to find associated unwind record causing exception not to be caught
* allow exceptions in native code with warning (they're now safe if native code called via __native_thunk)
* exit with error if SIGSEGV caught within handler
* if an exception is not caught then display uncaught exception with backtrace, if any available rather than a generic message
* allocate runtime exceptions with __alloc_object rather than GC_malloc or calloc (fixes memory corruption after memory exception caused by using memory not scanned by garbage collector to hold exception object)
* in segv handler, if faulting instruction address is null or near null then assume fault caused by call through null and get calling instruction address from stack top instead (fixes problem where some method calls on null objects resulted in exceptions that could not be caught)

lib/trusted/gc.l
* add methods to enable and disable garbage collection

lib/trusted/gvector.l
* enable test that allocates unscanned memory for vectors of non reference values

ltest/test83.l
* allocate large amounts of memory between null pointer references and display of exceptions to expose garbage collection problems

mbitset.l
* debug output

mflow.l
* debug output

parsetree.l
* add debug code to investigate contents of heap

type.l
* remove debug code that forced all 8 byte values to be treated as references by the garbage collector


build 1179

* compile speed improvement

lib/trusted/gvector.l
* do not add additional elements to end of vectors (were previously added to debug memory corruption problem)

lib/trusted/string.l
* do not add additional characters to end of strings (were previously added to debug memory corruption problem)
* comment out debugging code

main.l
* do not set maximum heap size unless explicitly requested via -M

mflow.l
* use faster range size calculation
* only calculate temporary live range sizes if register variables or copy coalescing enabled (calculating range sizes is slow. consequences of not having accurate range sizes are potentially bad split or spill descisions in exchange for approx 10% compile speed increase)
* switch sense of test when deciding which temporary to split if two temporaries requiring the same register are live at the same time (split the longer range since there's a good chance that splitting the shorter range won't help and will cause another register allocation iteration)
* fix bug introduced in previous build that broke -O1 compiliation with null pointer exception


build 1178

amd64/lrt/lrt0.S
* clear memory returned by GC_malloc_atomic

exception.c
* don't define GC_DEBUG
* make use of GC_gcj_malloc compile time dependent on USE_GCJ_MALLOC constant
* use non debug versions of GC_*
* call __alloc_object from __alloc_object_finalize rather than duplicating code
* check for null buffer in findLineNumber
* do not allocate atomic memory for backtrace buffer as may contain pointers (fixes problem where garbage collection between exception and backtrace display can cause memory corruption)

compilestate.l
* remove code used to trace now fixed no output stream bug

lib/trusted/exception.l
* use a pointer to store backtrace info handle rather than word (fixes problem where garbage collection between exception and backtrace display can cause memory corruption)

lib/trusted/gvector.l
* remove redundant 'private' access on fields
* shorted default length
* add memory corruption check code (disabled)
* alternate length extension scheme intended to waste less memory
* do not clear additional elements (allocated memory is already clear)

lib/trusted/string.l
* add memory corruption check code (disabled)
* alternate length extension scheme intended to waste less memory

mflow.l
* alternative faster mechanism to calculate temporary live range sizes (disabled)

parseexpr.l
* fix bug where arrays of non-references allocated as arrays of references


build 1177

* reduce memory use and garbage collector overhead by supplying garbage collector with pointer bitmaps
* migrate runtime to updated unwind record format

amd64/lrt/Makefile
* add version number to exception handling library file name

amd64/lrt/lrt0.S
* call __init_gcj_malloc (in exception.c) on startup that initializes the GCJ interface to Boehm GC

amd64/machine.l
* add constants describing the size and layout of the bitmap style object descriptor used by Boehm GC
* add emitDefLong with word argument to support object descriptor bitmaps, which are full word length

common/exception.c
* use vendor custom type decoration for word argument to __set_pthread_id(word) and set word System.Exception.BacktraceInfo = w
* use GC_gcj_malloc to allocate objects with non-null vtable
* increase FINALIZE_OFFSET to 2 as vtable slot 1 now occupied by object descriptor bitmap
* replace references to GC_malloc_* with GC_MALLOC_* since mixing upper + lower case version can cause crashes due to missing debug information (FIXME: why does this happen? lrt0.S calls these functions without supplying debug info and that doesn't cause the same problems)
* add dummy GC mark function __gcj_mark_proc that prints an error message and returns the stack unchanged (should never be called)

compilestate.l
* a constant for the runtime library version number and append it to all linked runtime files
* remove definition of and references to broken timing method

container.l
* first method slot is now 2 as slot 1 contains object descriptor bitmap
* add field and read accessor word ReferenceBits that holds the object bitmap descriptor
* when building class tables also build either a Boehm GC/GCJ bitmap or length descriptor describing which words in the object are pointers (bitmap if all pointers will fit, otherwise a length covering all words up to and including the last pointer)

lib/trusted/gvector.l
* revert to non atomic GC_malloc for all element types (FIXME: may not be required or else .isreference attribute is returning false for some element type that is actually a pointer)

lib/trusted/string.l
* fix bug that gave garbled results when converting word values to strings

lib/unsafe/classsize.l
* migrate from method start/method end unwind record to method start/method length unwind record

lib/unsafe/method.l
* migrate from method start/method end unwind record to method start/method length unwind record


build 1176

* fix problem where non object reference values reachable only through a Generic.Vector could be prematurely freed by the garbage collector

lib/trusted/gvector.l
* use T.isreference rather than T.isobject to determine whether to allocate atomic memory for vector elements

parseident.l
* add .isreference attribute so container template classes can decided whether to allocate garbage collector scanned memory based on whether their elements could hold references or not

symbol.l
* support .isreference attribute


build 1175

* use less conservative garbage collection settings when allocating memory

amd64/amd64.md
* split array allocation operation into two operations one for arrays of references and one for other values

amd64/lrt/lrt0.S
* split array allocation operation into two operations one for arrays of references and one for other values
* replace GC_malloc with GC_malloc_ignore_off_page for object and arrays of references and GC_malloc_atomic_ignore_off_page for arrays of other values

container.l
* don't check inheritance from System.Object in IsObject - all non-structs/non-interfaces are objects (FIXME: interfaces are always objects to - should check callers and change this)

lib/trusted/gvector.l
* remove test for huge allocations (libgc will warn anyway)
* split allocation into two operations one for vectors of objects and one for other values (FIXME: unsafe - needs to test if any reference not just objects)
* replace GC_malloc with GC_malloc_ignore_off_page for vectors of references and GC_malloc_atomic_ignore_off_page for vectors of other values

parsecall.l
* split array allocation operation into two operations one for arrays of references and one for other values
* replace GC_malloc with GC_malloc_ignore_off_page for arrays of references and GC_malloc_atomic_ignore_off_page for arrays of other values

parseexpr.l
* split array literal allocation operation into two operations one for arrays of references and one for other values

type.l
* add isReference() that returns true for any type that holds a reference to another value


build 1174

* speed up exception handling by caching rip->unwind info mappings and by using binary search rather than linear search on cache misses (reduces time spent handling exceptions when compiling from 25% to practically none)

exception.c
* speed up exception handling by caching rip->unwind info mappings and by using binary search rather than linear search on cache misses (FIXME: code intended to cache expected next stack frame based on current frame not yet working)

compilestate.l
* add some debug code to attempt to determine where compile time is spent

lib/trusted/primtype.l
* add char.isSpace() method

lib/trusted/string.l
* make System.String implement Iterable<char>

syntax-k.jay
syntax-l.jay
* modifications to make yyextract happy


build 1173

* add command line option and pragma to disable array bounds checks

main.l
* add option and pragma to disable array bounds checks
* clean up list of code generation options displayed when compiler is run with no arguments

mflow.l
* don't generate comment instructions for spills, fills, splits, eliminated copies etc unless debug output is enabled
* issue warning if any method in a class is compiled with array bounds checking disabled

parsetree.l
* avoid repeatedly calling Name accessor when matching pragma names
* add NoBoundsCheck pragma
* if CompileState.WantBoundsCheck is false then skip bounds check when generating array subscript code


build 1172
* fix bug where boolean expressions involving constant expressions could fail to compile
* fix bug where spurious BoundsExceptions thrown on amd64 if copy coalescing enabled (compiler now bootstraps with copy coalescing enabled)

Doxyfile
* fix output directory

amd64/amd64.md
* fix rewrite rules that transform branches on constant conditions to empty instructions or unconditional jumps (fixes bug where boolean expressions involving constant expressions could fail to compile)

amd64/machine.l
* reenable red zone support
* fix instruction strings where comment precedes instruction (required to prevent assembler file comment suppression also supressing the following instruction)

compilestate.l
* add WantRedZone compile flag
* add WantStatistics compile flag
* reduce maximum size of method parse tree considered for inlining from 30 nodes to 20
* add field and accessor InLastInlinePass that is used when determining whether to inline a non-leaf method
* add field and accessor CurrentMethodHasIf that is used when determining whether to inline a non-leaf method

container.l
* add field and accessor HasIf that is used when determining whether to inline a non-leaf method
* throw exception if attempting to create a class that is its own super class
* fix error message issued when a method implementing a method in an interface has an incompatible return type

footer.html
header.html
* do not include header.lsi and footer.lsi respectively as Doxygen documentation pages now embedded in a single LSP page rather than each being a separate page

intermediate.l
* add KillAfter accessor that if set to a positive value causes a cannot inline exception after specified number of intermediate code instructions are generated (used to limit size of inlined methods)

lib/trusted/array.l
* fix doc comment to remove '.' that prematurely ended the short description
* fix doc commens to reflect renaming ArrayBoundsException to BoundsException

lib/trusted/glist.l
* additional doc comments

lib/trusted/gmap.l
* remove redundant inheritance from System.Object
* Generic.Map<K,T> implements Generic.Iterable<T>

lib/trusted/gproc.l
* add doc comments
* remove broken constructors

lib/trusted/object.l
* additional doc comments

lib/unsafe/array.l
* remove broken array implementation

lib/unsafe/sqlite3.l
* fix various compile errors (FIXME: worked in the past but needs retesting)

main.l
* use CompileState.WantStatistics compile flag rather than internal field
* add -OZ and -Oz that enable or disable the red zone
* enable copy coalescing and red zone when -O1 selected
* update usage

mflow.l
* suppress indentation, dead instructions, live temporary information and other comments in assembler output if stripping debug information
* change marker for register allocator comments to 'RA'
* remove dead code

mframe.l
* reenable red zone support
* make red zone usage conditional on CompileState.WantRedZone flag
* fix bug where stack pointer needlessly adjusted by zero bytes in case where no locals or spills and red zone disabled
* remove debug output when setting up frame pointer using lea instruction

mtree.l
* add isComment() method (used when suppressing comments in assembler output)

parsecond.l
* set CurrentMethodHasIf if an if statement is encountered in the check inline pass

parsedef.l
* give up on preparing inline version of a method as soon as intermediate representation exceeds a certain number of instructions (currently CompileState.INLINE_MAX * 2 == 40)
* remove debug output when method cannot be inlined

parseexpr.l
* fix error issued when 'super.' construct used in method with no superclass to use human readable class name
* remove code that allowed inlining calls to constructors as a special case
* allow method calls within inlined methods, provided we're on the last inline pass and the inlined method contains at least one if statement (rationale is some small methods that are worth inlining test for an error condition and handle it with an exception throw or method call)

parsetree.l
* if copy coalescing is enabled and pointer size != integer size do not omit cast instruction when subscripting arrays (fixes bug where copy coalescing could cause spurious BoundsExceptions to be thrown. FIXME: cause was garbage in high 32-bits of temporary holding array index due to 64-bit spill + fill of 32-bit value - this is probably the underlying cause for this bug and coalescing merely exposed the problem by either provoking the spill or by removing an intervening move that happened to clear the high half of the register before it was used as an index. Should consider either applying this fix even when coalesing is off or fixing fills to take into account operand size of next use)

type.l
* return undefined type when searching for a method in an undefined type rather than throwing an exception


build 1171
* Reduce memory usage. Compiler will now bootstrap in 200M heap (320M with inlining on), which is around half the heap size required by the previous build
- tokenizer folds all occurances of equal strings in the input into references to a single string
- allocate instance variables using smallest allowable alignment rather than aligning to a machine word irrespective of size
- removed some redundant instance variables and rearranged others to pack better

TODO:
- figure out how to reduce memory footprint of intermediate code
- make folding equal strings in tokenizer optional to avoid any slow down if memory is plentiful

* include information about sizes of non-pointer instance variables in class type tables
* fix a bug where use of user defined operators in template classes could result incorrect operator methods being called

common/exception.c
* improve message issued when exception thrown in foreign code

compilestate.l
* support WantPack option
* add memory usage debug code (disabled, dumps classes and sizes of reachable objects)
* clean up error message for duplicate symbol
* use human readable name in error message for duplicate method

container.
* reduce memory usage by reordering fields to improve packing
* include information about sizes of non-pointer instance variables in class type tables
* if WantPack then allocate instance variables using smallest allowable alignment for size (but round total instance table size up to whole machine word)

intermediate.l
* reduce memory usage by reordering fields to improve packing

lib/trusted/array.l
* remove broken values field
* add methods to support Util.Walk (FIXME: these methods are unsafe and should not be in the trusted version of array.l)

lib/trusted/gmap.l
* reduce memory usage by reordering fields to improve packing

lib/trusted/gvector.l
* remove redundant inheritances from System.Object
* reduce memory usage by reordering fields to improve packing
* add methods to support Util.Walk (FIXME: these methods are unsafe and should not be in the trusted version of gvector.l)

lib/trusted/object.l
* add constants for type table entries
* return char ptr from get TypeTable rather than word pointer
* add methods to support Util.Walk

lib/trusted/string.l
* add Freeze accessor, which looks string up in string pool and either adds it, if not present, or returns existing value if already present (used by compiler to fold all equal strings into single value. FIXME: should probably move this out of this class as introduces a dependancy on Generic.Set<String> + Generic.Map<String,bool>)
* make System.String.copy() method return this for constant string

lib/unsafe/compiler.l
* change NoFinal pragma to Virtual

lib/unsafe/exec.l
* flush stderr after writing fork-failed error message
* vfork rather than fork (FIXME: this appears to work but actually we're performing operations between vfork and exec that are not allowed according to Linux vfork man page)

lib/unsafe/stream.l
* reduce memory usage by reordering fields to improve packing

lib/unsafe/walk.l
* visits all objects reachable from a root object exactly once calling a supplied proc reference for each reachable object

main.l
* rename profiler option from -OP/-Op to -OQ/-Oq
* add pack instance variables option -OP/-Op with default of enabled


build-1170

* fix a problem with building statically linked executables
* fix bug where pragmas might not be applied
* add -OM <heap size> option that limits compiler heap size to <heap size> megabytes
* reinstate throwing NullPointerExceptions on null dereference
* do not output HTTP header on null pointer dereference unless requested via System.Startup.HTTPMode = true

amd64/lrt/Makefile
* copy static exception.o as well as shared exception.so to lib directory (fixes issue where static link could fail)

amd64/lrt/lrt0.S
* remove '$' from symbols
* reinstate SIGSEGV signal handler

common/exception.c
* remove HTTP content type header output on SIGSEGV (intended to aid debugging LSP but library now outputs HTTP header if needed)
* remove unused __static_begin function

compilestate.l
* add WantSharedStandardLibrary flag that links against lang.ll+lang.so+exception.so if set or just exception.o otherwise
* return undefined_type rather than null if attempting to create specialization of an undefined template class (fixes a null pointer exception on references to undefined template classes)

lib/trusted/gc.l
* add accessor static set int GC.MaxHeapSize

lib/trusted/startup.l
* fix HTTP header on uncaught null pointer exception to include correct end-of-line sequence

main.l
* flush stderr before exit (FIXME: should not be required as System.Exit should be calling dispose on IO.Std.err to flush it)
* add WantSharedStandardLibrary flag that links against lang.ll+lang.so+exception.so if set or just exception.o otherwise and change -OS/-Os to set/clear this flag
* add -M nnnn option that limits compiler heap size to given number of megabytes
* update usage information displayed when compiler run with no command line arguments

parsetree.l
* add public accessor get UndefinedType
* fix problem where pragmas not always applied in compile pass
* improve warning message for NoFinal pragma and remove debug output
* fix problem where pragma warning messages might never be displayed if pragma applied in an inline pass


build 1169

* support proc references in K syntax
* add debugging code intended to diagnose excessive memory usage
* more progress on using compiler as dynamically loaded shared object

TODO:
- reduce memory usage
- fix bug where array literals can abort compilation if there is no type expression involving an array of the lowest denominator element type elsewhere in the program (this is a pain: template expansion is triggered by type expressions in one pass and then the array element type is inferred in a later pass at which point we cannot create an array template specialization for the element type if it turns out we don't already have one. May have to insist on an explicit type for array literals to work around this issue - the alternative would be speculatively creating an array template specialization for every encountered type expression just in case the type appears in an array literal)

build-lib.sh
* build library with -O1

common/exception.c
* add debugging code to trace object allocations and deallocations

compilestate.l
* fix problem where compiler could only be run once in a given process because some statically initialized objects were not correctly reinitialized on subsequent compilations
* do not link libraries referenced by library code (FIXME: not the best way to deal with problem of these libraries being linked twice - should instead put them in a set and link to each library exactly once)
* flush stderr before linking so any linker error messages do not get mixed up with compiler output
* throw exception if template expansion attempted after the check-templates pass

lib.l
* include more source files in lang.so

lib/trusted/gc.l
* add System.GC.collect() method that calls native GC_gcollect()

lib/trusted/object.l
* remove debug output from System.Object.toString()

lib/unsafe/klass.l
* debug output when searching for classes by name
* support new classes table structure with __get_vtable function rather than direct pointer to vtable

lib/unsafe/library.l
* add new static accessor System.Library.Self that returns a Library object referring to the current program (FIXME: not sure if this works as expected - does handle=0 argument to dlsym mean current program or current library?)
* rename loadClass to findClass to better reflect what the method actually does
* if library is Self then try the classes table before trying dlsym (FIXME: not sure if this works as expected - does handle=0 argument to dlsym mean current program or current library?)

lib/unsafe/postgres.l
* debug output when connecting to a database

main.l
* fix problem where compiler could only be run once in a given process because some statically initialized objects were not correctly reinitialized on subsequent compilations
* set maximum heap size to 512MB
* return exit status from run() method
* fix problem where if compiler loaded as shared object, some compilation results could cause calling program to end with System.Exit.exit()

parsedef.l
* remove dead code
* improve error message issued if library class and source class definition hashes do not match
* put pointer to __get_vtable method in classes table rather than direct vtable pointer
* debug output when symbol expected to have been declared in earlier pass not found

parseexpr.l
* expand array template for array literals with explicit types
* implement toString for Parse.VectorList to aid debugging problems with array literals

parsetree.l
* fix problem where compiler could only be run once in a given process because some statically initialized objects were not correctly reinitialized on subsequent compilations

syntax-k.jay
* support proc references in K syntax (merges various changes from syntax-l, see build 1145)


build 1168

* link against L shared library by default
* move code for dynamic loading of shared objects from test directory into L library

TODO:
- figure out why compiler memory usage has increased

compilestate.l
* turn off the warn-hide (-WH) option by default

lib/unsafe/library.l b/lib/unsafe/library.l
* move test171.l, which loads shared libraries, into L library as library.l
* add doc comments

main.l
* support loading compiler as a shared library
* disable register variables by default as they slow compilation noticably and improve speed of compiled code only by a few percent
* link against L shared library by default (disable with -Os)


build 1167

* clean up after switching to new name decoration scheme

container.l
* remove debug output

compilestate.l
* remove debug output

parsetype.l
* remove debug output

parsedef.l
* remove debug output

ltest/test172.l
ltest/test173.l
ltest/test174.l
ltest/test175.l
ltest/test176.l
ltest/test177.l
ltest/test178.l
* additional test sources


build 1166

* switch to new symbol name decoration scheme
- a subset of the GCC 3.x name decoration scheme
- fixes problems where some template specializations might not compile due to bad symbol names
- improves readability of error messages from the linker as symbols involving templates now demangled correctly

amd64/amd64.md
* use new name decoration scheme for string literal vtables

amd64/lrt/lrt0.S
* remove unused alloca and allocao functions
* remove '$' from symbol names
* use new name decoration scheme for program entry point

amd64/machine.l
* use new name decoration scheme for program entry point

common/exception.c
* use new name decoration scheme when handling exceptions and starting threads

compilestate.l
* use new name decoration scheme for class and method symbols and for proc types
* use decorated name for class file names rather than alternative 'qualified name' mangling (allows removal of redundant 'qualified name' name mangling code)
* update various error messages to use human readable symbol names
* update symbol searches that used 'qualified name' mangling to use decorated names instead

container.l
* remove 'qualified name' mangling
* additional debug output
* update symbol searches that used 'qualified name' mangling to use decorated names instead
* update various error messages to use human readable symbol names

lib/trusted/exception.l
* rename ArrayBoundsException to BoundsException in anticipation of making it the standard exception to throw for index-out-of-bounds condition (currently different containers in the library throw different exceptions making it awkward to substitute one container implementation for another)
* remove unused CannotCloneException

lib/trusted/gproc.l
* add a constructor that makes a new System.Proc<P> from a word argument, which allows calling abitrary addresses (FIXME: this should not be in the trusted part of the library)

ltest/test171.l
* remove code that attempted to explicitly initialize loaded shared objects as now initialized automatically via _init
* call supplied get vtable function to determine the vtable address for a loaded class

parsecall.l
* error checking for trying to create a bound proc reference from a static method and vice versa

parsedef.l
* supply template type arguments when declaring class arguments so CompileState can decorate class symbol instead of doing decoration here
* remove exception handling when making super class template specializations as was interfering with debugging (FIXME: should reinstate when stable)
* additional debug output
* use decorated name for class file names rather than alternative 'qualified name' mangling
* use new name decoration scheme for class table, vtable and size symbols
* complain when old decoration methods called
* let CompileState decorate method symbols rather than doing it here
* avoid preparing decorated method names again in every pass - use the decorated name stored in the method's container instead

parseexpr.l
* use NEW_GENERIC_ARRAY intermediate code instruction to create arrays for array literals (fixes problem where casting arrays created by array literals to object could cause crashes due to incorrect vtables)
* fix problem where calls through bound method references could crash due to incorrect value stored in proc reference structure


build 1165

* clean up shared library support

lib/trusted/primtype.l
* add some methods required to place char and bool values in container types

needcompile.l
* remove debug output for bad library hash

parsedef.l
* remove warnings and debug output for bad library hash except where actual method slot address difference found
* remove debug output regarding itable to vtable offsets


build 1164

* more progress on shared libraries: L compiler will now bootstrap linked against L shared library
- place exception handling code in separate shared library
- fix library link order problem

TODO:
- figure out why library class hashes sometimes differ from source hashes even though methods are assigned the same slot numbers

amd64/lrt/Makefile
* build exception.c as shared object exception.so rather than linking into lrt-amd64-1.o

amd64/lrt/lrt0.S
* define exception_top and exception_rsp here rather than in exception.c

common/exception.c
* make __exception_top and __exception_rsp extern as they're now defined in lrt0.S
* remove adding unwind info message

compilestate.l
* link .so files for L libraries after object files for classes in current project and before any other library files
* link exception.so after all L libraries and before any other library files


build 1163

* more progress towards dynamic linking.
- fix problems arising from loader apparently duplicating __ctable symbols
- fix bug where stack unwinding failed due to wrong addresses appearing in unwind records
- remove '$' from internal symbol names (not certain but suspect that linker or loader treated these symbols specially)
- change some symbols that were decorated like C++ methods but were actually labels in data segments to have names not recognized as methods (again not certain but suspect linker or loader may treat them as functions despite conflicting .type directive)

TODO:
- exception handling broken in shared libraries due to incorrect order of objects on link command line (works if project linked manually using gcc or ld)

amd64/amd64.md
* remove '$' from some internal symbol names

amd64/lrt/lrt0.S
* remove '$' from some internal symbol names
* replace method end addresses in unwind records for internal functions with method lengths

amd64/machine.l
* remove '$' from some internal symbol names
* add 'use System.String' and replace references to System.String with String
* load vtable pointer via GOT in internal __get_vtable functions in PIC mode (appears to fix odd behaviour where __ctable symbols have more than one address when shared libraries are used)
* change emitVTableSegment to utter strange section incantation used by g++ for vtables (FIXME: probably not required)
* rearrange position of unwind record in assembler output to avoid splitting it around method definition and avoiding placing method start and end labels within the method symbol
* emit explicit .size directive for each method

common/exception.c
* unwind record structure is changed so method ranges are defined as start,length rather than start,end (it's easier to get correct length at run time since ELF doesn't support nested or overlapping symbols)
* more debug output when unwinding
* remove '$' from some internal symbol names

compilestate.l
* remove debug output
* support storing method offsets in library definition files to help pinpoint cause of hash mismatch problems (will also be needed in future to resolve clashing interface slot assignments)
* change link behaviour to output a .so file for -OL compiles and to link against a .so file for .ll input files (FIXME: link order is currently broken for linking against .so files)
* only display link command line if -V (very verbose output) option given
* only look for files with .ll extension if .ll extension explicitly specified on command line
* look for .so file in directory where corresponding .ll file found
* remove '$' from some internal symbol names

container.l
* remove debug output
* only display interface slot numbers if -V (very verbose output) option given
* remove '$' from some internal symbol names

main.l
* remove debug output

needcompile.l
* remove debug output
* support storing method offsets in library definition files to help pinpoint cause of hash mismatch problems (will also be needed in future to resolve clashing interface slot assignments)

parsedef.l
* remove debug output
* list mismatched method slots for classes where source hash does not match library hash
* remove '$' from some internal symbol names
* specify vtable offset explicitly from __ctable plus fixed offset in vtable function rather than using a label (since label inside ELF __ctable symbol doesn't appear to relocate to expected address)

parsetree.l
* remove '$' from some internal symbol names


build 1162

* more progress on shared libraries
- fix bug where shared libraries crashed on load if any static initializer trashed a callee save register
- fix bug where virtual method and interface method calls could crash or call incorrect method due to incorrect calculation of offset from interface dispatch table start to virtual method dispatch table start

amd64/lrt/lrtD.S
* save callee save registers on entry to and restore on return from _init (fixes problem where code in static initializers could crash the dynamic loader by trashing registers)
* use regular label for static initializer function (FIXME: probably not needed)

container.l
* lazily calculate offset from interface dispatch table to virtual method dispatch table (fixes bug where vtable offsets could be incorrect depending on class compile order)
* additional debug output when calculating interface dispatch table slot numbers
* remove redundant call to and definition of buildInterfaceTables method

parsedef.l
* debug output when making template classes in implements clause concrete
* remove redundant call to Container.buildClassTables
* remove unneeded .extern directive for class static tables symbol
* only output class static table symbol if static table contains at least one variable


build 1161

* more progress towards shared libraries - fix problem where calls through interfaces crash or call incorrect methods and references to class names or sizes return garbage because class tables are split by linker because ELF does not support nested or overlapping symbols. The fix involves consolidating the interface dispatch tables, class size, name and type and virtual method dispatch tables (which were consecutive in the assembler source but separate ELF symbols) into one single ELF symbol and referencing the vtable pointer with an offset from the start of the interface table.
* put static variables in the bss segment

TODO:
- figure out why placing certain classes in a shared library crashes the loader when a program referencing the library loads

amd64.md
* replace vtable with ctable+offset in CONST_STR intermediate code instruction

amd64/lrt/Makefile
* temporarily append '-1' to runtime object file names to allow building stable and development compiler versions on same system

amd64/lrt/lrt0.S
* call __get_vtable$__<decorated class name> to determine vtable pointers for arrays (fix can't call through interfaces with shared libraries due to split class tables problem)

amd64/machine.l
* add emitDefLongZero() that outputs a .zero directive
* add emitVTableFunction() and emitVTableFunctionPIC() that return a class's vtable pointer (fix can't call through interfaces with shared libraries due to split class tables problem)
* add emitBSSSegment() that switches assembler to the .bss section
* use .string instead of .ascii + .byte 0 to assemble a C string constant
* use __get_vtable$ call to get main class vtable pointer (fix can't call through interfaces with shared libraries due to split class tables problem)
* remove dead code

common/exception.c
* use __get_vtable$ calls to get exception and string class vtable pointers

compilestate.l
* temporarily append '-1' to runtime object file names to allow building stable and development compiler versions on same system

container.l
* add field and accessor for current interface table offset
* place static variables in the bss segment
* debug output when writing out interface dispatch tables
* output global label ctable$__<class_decorated_name> before interface dispatch tables with size that covers entire interface dispatch table, class name, type + size slots and virtual dispatch table (fix can't call through interfaces with shared libraries due to split class tables problem)
* remove redundant .extern and .global directives for methods implementing interfaces
* remove debug output in assembler file for vtable offsets

lib/trusted/object.l
* debug output in toString()

mtree.l
* output .align 8 after a string constant to keep rodata segment 8 byte aligned (FIXME: should be .align Machine.WORD here)

needcompile.l
* additional debug output when hash from class source doesn't match hash in library

parsecall.l
* use loadVTable rather than loadGlobal to get vtable pointer when allocating arrays and objects (fix can't call through interfaces with shared libraries due to split class tables problem)

parsedef.l
* temporarily make source/library class hash mis-match a warning as errors made debugging shared library issues difficult
* prevent the linker splitting class tables in shared libraries by avoiding placing any global labels within the table
- remove type$__ name$__ and vtable$__ labels
- completely remove the unused type table
- output a copy of the size$__ slot outside the class table and make size$__ point to that instead
- replace vtable$__ with a function __get_vtable$__ that returns a pointer to the vtable
- output super vtable pointer as ctable$__ + offset
* place static variables in the bss segment
* better error message if definition of variable not found across passes
* emit global definition for each method with its definition

parseexpr.l
* work around problem in amd64.md where, because there are no two address rewrite instruction definitions, intermediate BRANCH instructions can fail to compile if their right operand generates a two address machine instruction (fixes problem where run time checked casts would not compile in PIC mode)
* use loadVTable rather than loadGlobal to get vtable for run time cast check (fix can't call through interfaces with shared libraries due to split class tables problem)
* use getVTableAsString rather than string literal to get vtable when creating static proc references (fix can't call through interfaces with shared libraries due to split class tables problem)
* use loadVTable rather than loadGlobal to get vtable when creating dynamic proc references (fix can't call through interfaces with shared libraries due to split class tables problem)

parsetree.l
* add loadVTable method that uses loadGlobal ctable$__ plus interface table size to return intermediate code to determine a vtable address
* add getVTableAsString that uses ctable$__ plus interface table size to return a string for an assembler expression that evaluates to a vtable address

parsetry.l
* remove .extern directive for removed vtable label
* use getVTableAsString rather than string literal to get vtable address for exception descriptor (fix can't call through interfaces with shared libraries due to split class tables problem)
* use loadVTable rather than loadGlobal to get vtable for exception catch test (fix can't call through interfaces with shared libraries due to split class tables problem)


build 1160

* implement creating and linking against shared libraries

TODO:
- if interface dispatch table offsets change between library and client due to interference between interfaces changing then client will not be able to use the library (won't compile due to incorrect hashes for classes implementing affected interfaces). Fixing this requires either:
- somehow deferring interface selector coloring until all libraries are loaded then back-patching offsets at each call site. It might be possible to get the loader to do the patching if selector offsets are made relocatable symbols, or
- replace methods for affected selectors with thunks that branch to correct method based on desired method (passed in a hidden parameter). Again it might be possible to have the loader replace the methods with thunks by preloading a library with the thunks in first.
- the PLT double call mechanism used to call final and static methods seems like it might be slower than a virtual call so might consider making all method calls libraries virtual
- need to enabled segfault handler at some point after all unwind tables are loaded
- would be better to read class hashes directly from the library .so rather than reading a separate .ll file but not clear how to load and interrogate an .so file for its contents without having its symbols collide with the compiler's symbols (alternative is to try libelf, which looks a bit involved)

amd64/lrt/lrt0.S
* make static$begin global (FIXME: not required)
* temporarily remove call to install segfault handler in main since unwind tables for exception handling might not be valid yet (FIXME: need to find a safe point in program startup to install the segfault handler)
* temporarily remove call to initialize garbage collector in main (probably not required)

amd64/lrt/lrtD.S
* add _init method, called by dynamic loader when library is initialized, that links library's unwind tables into the program and then runs its static initializers
* remove unused static$begin label
* remove previous broken _init implementation
* remove unused __unwind_start

amd64/machine.l
* make EXTERN instruction actually emit .globl (FIXME: may not be required)
* make GLOBAL instruction emit .globl rather than .global (assuming they're synonymous but GCC uses .globl)
* split emitGlobal into emitGlobalFunction and emitGlobalData and emit .type and .size GAS pseudo ops so loader knows the types/sizes of global symbols

amd64/lrt/exception.c
* add __static_begin function that calls a supplied static initializer (FIXME: no longer required now _init is working)

compilestate.l
* add LibraryHashFile class that reads a .ll file that contains the names and hashes of classes in a library
* remove unused LCacheDir accessor
* write hashes for all classes not in libraries to .ll file for current project
* fix typo in progress method for check templates pass
* remove dead code
* if input file is an L library (.ll) rather than L source then read the library's class and hash list and add the library's .so to the libraries list
* return a CompileStatus rather than bool as result of needCompile()

container.l
* remove unused IsPIC field and accessor
* add VTableSize accessor
* add StaticSize field and accessor and set it when building class tables
* add CompileStatus field and accessor (FIXME: remove - unused)
* when building class tables, output local functions with .type @functions using Machine.emitGlobalFunction()

test171.l
* call static$begin in loaded libraries (FIXME: remove - _init should now do this)

main.l
* add some additional options for libraries (FIXME: remove - unused)
* use accessor rather than set method to set executable name in CompileState

needcompile.l
* add CompileStatus enum that has values:
CURRENT - class is in current project and does not need compiling
LIBRARY - class is in a library and so does not need compiling)
STALE - class is in current project and needs compiling)
BAD_HASH - class is in a library but cannot be used due to hash mismatch
* hold a list of libraries and check classes against all libraries when determining if a class needs to be recompiled.
* return CompileStatus as needCompile result rather than bool so callers know whether to link against a library or an object file for classes that don't require compilation

parsedef.l
* debug output for bug where super class can be set twice (FIXME: this happens if a class is defined twice in the same namespace - need a better error message)
* issue error message if compiled class is in a library but its current definition hash doesn't match the hash in the library
* put vtable in data segment rather than read only data segment, appears to be required by loader if any methods in the vtable are in a library (FIXME: check this is definitely needed as it's potentially unsafe)
* explicitly set type and sizes of vtable and related symbols using Machine.emitGlobalData() (fixes problem where vtables in loaded libraries were truncated or would not link)

parseident.l
* use human name rather than toString when issuing error for not calling method symbol

parsepackage.l
* use CompileState.CacheDir rather than LCacheDir

symbol.l
* remove unused IsPIC accessor


build 1159

* fix exception handling in dynamically loaded code
* start implementing support for incremental compilation by dynamic loading of new classes

amd64/lrt/Makefile
* assemble dynamically loaded code prolog lrtD.S into ldn-amd64.o and copy to library directory

common/exception.c
* add __add_unwind_info(UnwindRecord **u) that links a new unwind table into a running program
* alter findUnwindInfo to search any added unwind tables in addition to the one compiled into program

compilestate.l
* only emit, assemble and link program entry point if not compiling in library mode
* link only files that required compilation if compiling in library mode (enables incremental compile of running program, provided no dependancies change)
* link dynamic code prolog in compiling in library mode
* add WantVirtual flag that forces calls to a method to be virtual, rather than static or inlined (required if a method may be overidden by a subsequently loaded class)

container.l
* revert change that made class hash depend on IsPIC as prevented incremental compile

test170.l
* add test exception throw

test171.l
* add LoadTest class with a forced non-final method (using pragma NoFinal) that can be overridden by a dynamically loaded class
* allow abitrary number of shared objects to be loaded via command line (for dynamic compilation tests)
* load shared objects from current directory
* use global symbol dlopen flag so symbols in loaded shared objects are visible to any subsequently loaded objects
* link unwind table from loaded object into existing unwind table
* if requested class cannot be found in last loaded library, search all global symbols for it

needcompile.l
* explain why a class is being compiled if compiling in library mode (for debugging incremental compile - make sure classes not loaded twice)

parsedef.l
* only add all referenced classes to link list if not compiling in library mode
* if compiling in library mode add compiled classes to link list
* if WantVirtual flag is set when compiling a method then mark it not-final

parseident.l
* remove debug output

parsetree.l
* add 'NoFinal' pragma that makes methods following it within its scope not-final (which prevents them being inlined or called statically)
* warn on undefined pragmas


build 1158

* progress towards exception handling in dynmically loaded code
* other PIC fixes

amd64/amd64.md
* allow reg var destination operand for LEA intermediate code instruction
* remove rules for unused TRY and START_CATCH intermediate code instructions

amd64/machine.l
* remove relocation markup from exception descriptor and exception stack pointer symbol names (now added by ParseTree.loadGlobalTLS)
* add emitWeak() method

compilestate.l
* do not abort compile if no main class if generating PIC
* do not attempt to link output if generating PIC
* make output executable relinkable (ld option -E) so that classes dynamically loaded into executable can link against its symbols

container.l
* add IsPIC property that is set for PIC methods
* make class hash depend on IsPIC property of its methods to force recompile of classes if -OL option changes across compiles (FIXME: IsPIC should probably be per-class not per method as a mixture of both in one object file will not link)

lib/trusted/string.l
* implement bool startsWith(char c) method

lib/unsafe/stream.l
* remove code that stored backtrace on FileStream creation for debug purposes (caused problems trying to test dynamic loading as exceptions currently broken in dynamically loaded code)

ltest/test170.l
* remove Main class

ltest/test171.l
* tidy up dynamic loading code

mtree.l
* make @PLT for static method calls conditional on WantPIC

parsedef.l
* output a weak label '__vtable' that points at class vtable, which makes it possible to dynamically load classes without knowing their decorated name (FIXME: not sure if .weak is really needed here)
* mark methods with IsPIC if WantPIC is set

parsetree.l
* generate PIC accesses to TLS using @TLSGC(%rip) and __tls_get_addr (required but not sufficient to fix exception handling in dynamically loaded code. Assembles and exception handlers without exceptions appear to run but otherwise untested as unwind tables still not accessible to dynamically loaded code)
* remove debug output

parsetry.l
* generate PIC accesses to current exception descriptor and saved stack pointer with @TLSGC(%rip) and __tls_get_addr
* generate intermediate code for exception handler body entry directly rather than using TRY intermediate code instruction to avoid duplicating PIC TLS access code

symbol.l
* add accessor for IsPIC property


build 1157

* complete basic support for dynamically loadable code:
- Made PIC output optional (controlled via -OL option)
- PIC object files can now be linked with -shared option with no relocation errors
- resulting shared libraries can be loaded with dlopen
- classes can be dynamically loaded from shared libraries with new System.Class(native.dlsym(<library handle>, <decorated vtable name>))

* TODO for shared libraries:
- Need way to define what classes in a project constitute a library
- Need to support compile time use of a shared library
- Need to support load time dynamic linking of executable to a shared library referenced at compile time
- Need to ensure static initializers are called on library load
- Need to enforce compatibility between class definitions in shared library and defititions used by library client
- Need to insert dynamically loaded unwind/reflection information into existing program (assuming that the relevant segments end up disjoint from the corresponding existing segments in the loading program)
- Generate correct PIC for TLS references (required for exception descriptor pointer and saved stack pointer)
- Consider using PC relative offsets for local symbols rather than going through GOT

amd64/amd64.md
* make PIC support optional for intermediate code instructions that reference global symbols
* allow immediate right operands for cmp instructions with register left operand (FIXME: should also change rewrite rules to match)
* allow immediate right operands for mov instructions with register left operand (FIXME: should also change rewrite rules to match)

amd64/machine.l
* support PIC reference to exception descriptor pointer and saved stack pointer (FIXME: not using TLS, which is certainly broken for threads and may also be broken for single threaded programs)
* revert name of read only data segment to .rodata
* generate PIC program entry point (FIXME: probably not required since not currently able to link a complete position independant executable)

compilestate.l
* support -OL option (WantPIC flag, which could be turned on and off per class or method but no pragma connected to it yet)
* call the linker directly with -shared if PIC executable (probably not useful right now as will include all referenced library classes in the shared exe)

intermediate.l
* remove some debug code
* add a utility method, wantPIC(int t, int f), that code generator uses to select rules based on whether PIC is enabled

lib/trusted/vgector.l
* restore including list of elements in toString() result (was disabled due to a box-on-method-call bug)

main.l
* support PIC option (-OL to enable, -Ol to disable)

mtree.l
* support PIC calls to static methods via PLT (FIXME: should depend on WantPIC but currently always enabled)

parsetree.l
* initial support for PIC reference to exception descriptor pointer and saved stack pointer (FIXME: should have Machine class provide intermediate code for PIC loading of regular globals and values in TLS)
* make loading regular global symbols via GOT optional dependent on WantPIC

parsetry.l
* load global symbols through loadGlobal() or loadGlobalTLS()

ltest/test170.l
* simple dynamic loading test library

ltest/test170.l
* simple dynamic loading test client


build 1156

* start work on generating position independent code to allow dynamic linking to L code
* fix another return jump elimination bug

amd64/amd64.md
* initial PIC code generation support
- support non constant vtable argument to CAST_CHECK instruction
- remove RELOC instruction and rules that produce it (may be able to restore once PIC is working, currently disabled to prevent bad GOTPCREL operands)
- result of CONST_STR and CONST_CSTR is indirect through GOTPCREL for PIC code
- add rewrite rule for mem = [INDIRECT [GLOBAL]] that passes tree unchanged (FIXME: probably not required)
- remove rewrite rules that match [GLOBAL] (FIXME: probably not required)
- add machine rules for [GLOBAL]
- support non constant vtable argument to NEW, NEW_FINALIZE, NEW_GENERIC_ARRAY instructions

amd64/machine.l
* change read only data segment name to .rodata.rel since this is what GCC seems to use for -fpic (FIXME: doesn't appear to be neccessary)

compilestate.l
* reduce maximum inlineable method size to 30 parse tree nodes
* include PIC options on linker command line to produce dynamically loadable executable (FIXME: options are not correct: '-shared' is what's required here)

container.l
* add code to support omitting method calls where all implementations known to be empty (useful for constructors, currently commented out)

mflow.l
* fix typo in comment output at spill sites

parsecall.l
* support PIC code via loadGlobal when new'ing arrays and objects
* add code to support omitting method calls where all implementations known to be empty (useful for constructors, currently commented out)

parsedef.l
* support PIC code via loadGlobal when calling profiler

parseexpr.l
* support PIC code via loadGlobal when generating run time cast checks
* support PIC code via loadGlobal when loading addresses of static variables and proc references
* remove dead code

parsetree.l
* add loadGlobal and loadGlobalNoGOT that load the address of a global symbol either directly or with GOTPCREL
* revert hiding error messages in inline code (fixes bug where errors in code that was inlined but for some reason not compiled would cause compilation to fail without a useful message)
* add code to support omitting method calls where all implementations known to be empty (useful for constructors, currently commented out)
* fix bug where no_code_after_return incorrectly cleared between template instantiations causing return jump elimination not to be applied in some methods in template classes

parsetry.l
* return true for IsLastReturn for throw statements
* support PIC code via loadGlobal when generating code for exception handlers


build 1155

* avoid inlining large methods
* allow inlining of methods that call constructors either directly or via new
* fix bug where return jump elimination code generation option (-OR) ignored
* fix bug where illegal static call resulted in exception rather than error message

compilestate.l
* if method contains more than a certain number of parsetree nodes in checkInline then throw CannotInlineException

intermediate.l
* allow argument and method call intermediate code instructions in inlined methods

parsedef.l
* fix bug where return jump elimination code generation option not applied
* count parse tree nodes when checking if a method can be inlined
* remove redundant return jump elimination code

parseexpr.l
* allow inlining of methods that call constructors
* issue error message for calling static method in object instance rather than throwing an exception

parsetree.l
* count parse tree nodes when checking if a method can be inlined


build 1154

* fix bug where some compiler messages could be repeated if multi processing enabled
* fix bug where some compiler messages could be repeated if method inlining enabled
* fix bug where assembler could be output to standard error if exception handlers compiled with method inlining enabled

compilestate.l
* flush IO.Std.err before starting multiple compile processes (fixes bug where subsequent buffer flush in child processes could cause recent compiler messages to be repeated)
* additional debug output if code generated with no output stream
* reword warning issued when accessor hides a symbol in an enclosing scope

lib/trusted/array.l
* disable hide warnings
* additional doc comments
* prevent new Array<T> by throwing NotImplementedException since a new'd Array's structure would not be compatible with compiled array subscript code
* implement Generic.Iterable<T> interface

lib/trusted/exception.l
* clearer default message if no message supplied to constructor

lib/trusted/gbag.l
* extend Iterable<T> interface

lib/trusted/giterator.l
* add Iterable<T> interface that consists of a single accessor get Iterator<T> Iterator

lib/trusted/gmap.l
* disable hide warnings
* implement Iterable<T> interface

lib/trusted/gset.l
* disable hide warnings
* implement Iterable<T> interface

lib/trusted/gvector.l
* disable hide warnings
* implement Iterable<T> interface

lib/trusted/intvector.l
* remove existing Util.IntVector implementation and instead derive Util.IntVector from Generic.Vector<int>

lib/unsafe/lock.l
* disable unsafe warnings

lib/unsafe/signal.l
* disable unsafe warnings

parsedef.l
* if attempted inlining fails with CannotInlineException, mark method cannot-inline to avoid repeated inline attempts

parseident.l
* remove debug output

parseloop.l
* check sub trees of for loops for non-inlineable constructs. Fixes problem where non inlineable constructs in for loops not detected until inline version of method is prepared, which was potentially inefficient.

parsetree.l
* do not display error or warning messages if in prepare inline pass (fixes bug where errors and warnings could be displayed repeatedly when method inlining enabled)


build 1153

* fix bug where calls through proc references could be optimized away as dead code if the call returned no result or if a returned result was not used

mtree.l
* fix proc reference dead code bug

amd64.md
* fix proc reference dead code bug


build 1151

* more progress on implicit conversions and boxing

compilestate.l
* remove debug output

container.l
* add additional escapes for decorating constructed types template arguments

intermediate.l
* remove debug output

test164.l
* more tests of implicit conversion between array types and Generic.Array<T>

parsecall.l
* support implicit conversion of System.Proc<P> to P if left value of call operation
* fix bug where calling non-method might not give a useful error message

parseexpr.l
* check intermediate code instruction is valid call operation when compiling method call
* remove debug output

parsetree.l
* do not recursively box array element types when determining box type for arrays (still not really right - need to integrate matching boxed types to primitive types directly in Type.matchScore otherwise constructed types that are a mixture of boxed and unboxed will not match)
* remove debug output
* support implicit conversion of Generic.Vector<T> to T if left value of dereference operation rather than calling indexer method

type.l
* add utility method for determining the actual type of a template class specialization type argument
* escape constructed types in template class names
* remove debug output


1150

lib/trusted/gproc
* include System.Proc<P> class in repository


build 1149

* fix bug where calls through proc references could crash due to registers live at call site being trashed

amd64.md
* change implementation of PROC_CALL to read/write single temporary with Return0 class rather than two temporaries that must get the same register (fixes bug where calls through proc references can crash due to live registers being trashed)

mflow.l
* additional debug output if machine instruction has null string representation

mtree.l
* PROC_CALL instructions now read and write their dest operand


build 1148

* implement implicit type conversion for arrays and proc references to and from their Object derived equivalents Generic.Array<T> and System.Proc<P>
* add very simple profiler
- enable with -OT (clear cache first)
- profiler option inserts calls to profiler on every method entry and exit
- either import prof or include lib\trusted\prof.l on command line
- when profiled executable exits it writes prof.csv file in working directory containing call counts and total execution time per method

amd64/lrt/lrt0.S
* add __prof_enter/__prof_exit, which save register state and then call Util.Profiler.enter(word)/exit(word)

exception.c
* add __get_nanotime function, which is a wrapper around clock_gettime( CLOCK_PROCESS_CPUTIME_ID, timespec )

compilestate.l
* replace numbers for warning flags with symbolic constants
* support profiler option

lib/amd64/primword.l
* add opCompare(word,word), which is required to use word values as key in Generic.Map<K,V>

lib/trusted/exit.l
* expand single on-exit list to multi-level list where all entries in each level disposed before next is processed

lib/trusted/prof.l
* very simple profiler

lib/trusted/string.l
* use opSet internally rather than deprecated putCharAt
* implement append(word,int)

main.l
* support -OT option, which enables profiler calls
* include some information about type lookups in statistics output

parsecall.l
* implement calling methods in values that can be cast directly to Object without boxing (i.e. array and proc) and remove previous non-functional implementation

parsedef.l
* implement profile entry and exit calls in method prologs and epilogs

parseexpr.l
* count type lookups, misses and clears

parseident.l
* treat no symbol found as a method in isMethod (required for method calls on non-objects)
* implement calling methods in values that can be cast directly to Object without boxing (i.e. array and proc) and remove previous non-functional implementation

parsetree.l
* implement NoProfile pragma

type.l
* count box type lookups and misses
* implement bool CanTreatAsObject accessor that returns true of values of a type can be cast to Object directly without boxing
* implement implicit conversion between CanTreatAsObject types and their Object equivalents


build 1147

* make primitive arrays instances of Generic.Array<T> class, which partially implements Generic.List<T>
* make proc references instances of System.Proc<T> class

amd64.md
* implement NEW_GENERIC_ARRAY intermediate code instruction
* increase size of structure allocated for proc references to accomodate vtable pointer

amd64/lrt/lrt0.S
* change __proc_thunk to accodate changed layout for proc reference structure
* implement allocag function that allocates an array and sets its vtable pointer

compilestate.l
* fix bug where proc references with no arguments caused a null pointer exception

container.l
* debug output to diagnose bug where generic class instances with proc reference type parameters not decorated correctly

array.l
* remove broken array implementation and replace it with a minimal Generic.Array<T> class

gvector.l
* temorarily remove call to StringBuffer.append that fails for proc reference arguments preventing proc references being stored in a Generic.Vector<T>

lang.l
* import gproc

test159.l
* test instantiating System.Proc<P> template

mtree.l
* accomodate changed layout of proc reference structure

ops
* add NEW_GENERIC_ARRAY instruction

parsecall.l
* fix bug where a template class might not be instantiated in the right pass if the only reference is 'new <template type>[n]'
* use NEW_GENERIC_ARRAY to allocate new arrays with correct specialization of Generic.Array<T>
* implement support for instance method calls on non-class types that can be boxed just by casting to box type (e.g. arrays and proc references)
* fix bug where templates in left value of proc reference might not be instantiated in the right pass
* call compileLoadProcRef rather than compleLoad to create new proc references

parsedef.l
* debug output for 'could not find previous definition of' message
* include vtable for appropriate specialization of System.Proc<P> in proc reference structures
* implement proc(...)(super.method)

parsedef.l
* debug output for undefined symbol message

parsetree.l
* add predefined type for System.Proc<P> template class
* extend getBoxType to find or create appropriate classes for arrays and procs from Generic.Array<T> and System.Proc<P>

parsetype.l
* fix bug where templates in left value of proc reference might not be instantiated in the right pass
* fix bug where templates in left value of array reference might not be instantiated in the right pass

token.l
* correctly lex proc types nested within template brackets and vice versa

type.l
* cache box type in Type objects
* fix bug where proc references in template names not correctly decorated


build 1146

* implement instance proc refs (with limitation that all arguments must fit in register parameters)

amd64/amd64.md
* implement PROC_REF intermediate code instruction, which allocates an instance proc ref structure

amd64/lrt/lrt0.S
* add dynamic proc call thunk functions for functions with 0-5 register arguments

compilestate.l
* additional debug output to diagnose null output bug

ops
* add PROC_REF intermediate code instruction

parsecall.l
* pass argument types to compileLoad when compiling instance proc references

parseexpr.l
* support creating instance proc references


build 1145

* continue implementing pointers to methods (new 'proc' type)
* change method and variable resolution so that kind of first symbol seen with matching name determines whether identifier refers to method, variable or accessor (required to keep method resolution sane with proc variables).

compilestate.l
* remove debug output

container.l
* remove unused hash field from Addresses class
* change name of hash field in Container to hash_ to avoid conflict with hash() method

intermediate.l
* change name of rset field in ITree to rset_ to avoid conflict with rset() method

lib/unsafe/exec.l
* rename wait parameter in run method to want_wait to avoid conflict with wait() method

mtree.l
* change name of rset field in MReg to rset_ to avoid conflict with rset() method

parsecall.l
* remove debug output
* improve error message for calling through a non-method/non-proc-ref value
* implement creating proc references from methods

parseexpr.l
* rename warn local variable to avoid conflict with warn() method
* implement creating proc references from static methods
* stub support for creating proc references from instance methods

parseident.l
* if isMethod called then assume caller intends to either de-method identifier or create proc reference from it, if not complain when value is compiled if symbol turns out to be a method (fixes bug where some methods can be treated as constants with value of vtable offset and type of return value)

parsetype.l
* remove debug output

syntax-l.jay
* support new syntax for creating proc references

type.l
* match proc types by comparing containers

amd64.md
* remove dead code
* make DEFINT intermediate code instruction available in rewrite as well as machine

lgeng.l
* use 'new <type> {...}' syntax for array literals rather than old '<type> {...}' syntax

ops
* not an intermediate file - reinstate in repository

ltest/test157.l
* add simple call though static proc ref test


build 1144

* continue implementing pointers to methods (new 'proc' type)
* include test156.l that include proc type syntax and calls through proc variables
* remove some intermediate files from git repository

amd64.md
* implement PROC_CALL and PROC_CALL_DISCARD intermediate code operations

compilestate.l
* include length in decorated name for proc types

container.l
* end search for methods immediately on exact match

mtree.l
* support PROC_CALL pseudo machine instruction (calls indirect through a register, easier than trying to convince register allocater to hold proc pointer in rax when calling through *0(rax) - required since called function may be a thunk that relies on value passed in rax)

ops
* add PROC_CALL and PROC_CALL_DISCARD intermediate code operations

parsecall.l
* implement calls though proc references

parseexpr.l
* implement calls through proc references

parseident.l
* implement calls through proc references

parsetree.l
* implement calls through proc references

syntax-l.jay
* remove various rules for method calls of form <some specific non-terminal>.name(...)
* make this and super match thing non-terminal
* add rules for method calls of form thing(...)
* do not wrap bracketed expressions in Parse.Parenthesis

type.l
* attempt to mangle proc references in a way that GNU toolchain understands (still broken)

ops
* remove intermediate file from repository

terminal.out
* remove intermediate file from repository

interp.l
* remove intermediate file from repository


build 1143

* start implementing pointers to methods
* changes to Doxygen config so generated HTML integrates better with website

Doxyfile
* set EXTRACT_ALL
* exclude jay source directory
* include HTML header and footer

compilestate.l
* initial support for proc types
* additional debug output intended to diagnose no output file stream bug
* store a pre constructed Type object in template instance Containers rather than constructing a new one on every reference to a particular template instance

container.l
* support additional '$' escape characters in qualified names to encode spaces and parentheses required by proc type expressions

exception.l
* remove bad \property tags from comments which were confusing Doxygen

gllist.l
* add doc comments
* remove bad \property tags from comments which were confusing Doxygen

gmap.l
* MapIterator<K,T> implements Iterator<MapPair<K,T>>
* add doc comments
* remove bad \property tags from comments which were confusing Doxygen

gqueue.l
* add doc comments
* remove bad \property tags from comments which were confusing Doxygen

klass.l
* fix bug introduced in 1142 that caused System.Object.create() to fail with CastException

thread.l
* add doc comments
* remove bad \property tags from comments which were confusing Doxygen

parsedef.l
* store a pre constructed Type object in template instance Containers rather than constructing a new one on every reference to a particular template instance

parsetype.l
* initial support for proc types
* fix problem where generated C++ doc stubs for nested generic types not parseable by Doxygen due to no space between closing generic brackets '>'

symbol.l
* add a new symbol kind Symbol.PROC

syntax-l.jay
* initial support for proc types
* remove special rules in grammar for calling static methods in template classes and instead includ template classes in primary non-terminal
* change syntax to require 'new' before <type> <vector_list> (e.g. String {"a","b","c"}) construct as made it very difficult to implement constructed types as an expression primary non-terminal (note that 'new <type>' not generally required before array literal anyway as array type is inferred if 'new <type' is ommitted)

token.l
* add 'proc' keyword

type.l
* initial support for proc types


build 1142

* Force all classes to inherit from System.Object
* Add more documentation comments to library
* Reorganise some library sources
* Move some library classes to more appropriate namespaces where the original namespace was not consistent with other classes
* Minor fixes to documentation stub output

Doxyfile
* add to repository

lib/trusted/gmap.l
* add doc comments
* remove unused keys parameter from MapIterator

lib/trusted/gqueue.l
* split queue implementation out of thread pool and place in separate source file
* move Queue<T> from Util namespace to Generic namespace

lib/trusted/gsort.l
* add doc comments

lib/trusted/map.l
* add doc comments

lib/amd64/primtype.l
* add doc comments

lib/trusted/startup.l
* call System.Exit.shutdown() to dispose objects registered to dispose on exit

lib/trusted/array.l
* add doc comments

lib/unsafe/classsize.l
* add doc comments

lib/unsafe/kit.l
* add doc comments

lib/unsafe/klass.l
* add doc comments

lib/unsafe/lock.l
* split Lock out of thread.l and place in separate source file
* move Lock from System namespace into Util namespace

lib/unsafe/postgres.l
* add doc comments

lib/unsafe/signal.l
* split Signal out of thread.l and place in a separate source file
* move Signal from System namespace into Util namespace

lib/unsafe/sql.l
* add doc comments

lib/unsafe/sqlite3.l
* add doc comments

lib/unsafe/stat.l
* add doc comments

lib/unsafe/stream.l
* update references to Lock to reflect namespace move
* Builds prior to 1141 essentially didn't buffer any output written via IO.Writer.println. 1141 fixed this but the fix exposed another problem where buffered output to standard output and standard error was not flushed before program exit. This is fixed by adding System.Exit class plus two changes here:
* add a dispose() method to IO.Writer that flushes the buffer and then disposes the underlying stream
* register standard out and standard error streams to dispose on exit to ensure any buffered characters are output before program exits

lib/unsafe/thread.l
* add doc comments
* remove Lock and Signal classes from this file

lib/unsafe/threadpool.l
* update references to Lock to reflect namespace move
* update references to Signal to reflect namespace move
* update references to LockedQueue to reflect namespace move
* add doc comments

lib/unsafe/unwind.l
* add doc comments

x86/enviroment.l
* add doc comments

x86/primlong.l
* add doc comments

x86/primword.l
index 76596e3..789cccd 100644
--- a/lib/x86/primword.l
+++ b/lib/x86/primword.l
@@ -1,5 +1,6 @@

ltest/test155.l
* remove explicit 'extends Object'

main.l
* exit via System.Exit.exit(int) rather than native.exit() (fix bug where buffered error messages not output on exit)

parsedef.l
* when generating documentation stubs, output C++ '#include <name>' rather than 'import name;'
* for clases other than Object, inherit from Object if no super class specified with 'extends' (fixes various issues with classes that don't inherit from Object being handled correctly by the runtime)
* when generating documentation stubs, output explicit inheritance from System.Object for classes where no super class is specified

parsetree.l
* check CurrentClass is not null before checking Template property when determining if an error message should include a template class name (fixes problem where some template related errors could cause compiler to take a NullPointerException)


build 1141

* add support for documentation comments by converting non-functioning pretty printer to output C++ style stubs parseable by Doxygen
* start adding documentation comments to library
* remove spurious files from jay directory
* remove jay intermediate files syntaxl.l and syntaxk.l from git repository

lib/amd64/primword.l
* add doc comments

lib/safe/klass.l
* add doc comments

lib/safe/stream.l
* add doc comments

lib/safe/thread.l
* add doc comments

lib/trusted/args.l
* add doc comments

lib/trusted/array.l
* add doc comments

lib/trusted/envmap.l
* add doc comments

lib/trusted/exception.l
* add doc comments

lib/trusted/gbag.l
* add doc comments

lib/trusted/gc.l
* add doc comments

lib/trusted/giterator.l
* add doc comments

lib/trusted/glist.l
* add doc comments

lib/trusted/gllist.l
* add doc comments

lib/trusted/gmap.l
* add doc comments

lib/trusted/gset.l
* add doc comments

lib/trusted/gsort.l
* add doc comments

lib/trusted/gvector.l
* add doc comments

lib/trusted/hash.l
* add doc comments

lib/trusted/intvector.l
* add doc comments

lib/trusted/iterator.l
* add doc comments

lib/trusted/list.l
* add doc comments

lib/trusted/object.l
* add doc comments

lib/trusted/oset.l
* add doc comments

lib/trusted/pointer.l
* add doc comments

lib/trusted/sort.l
* add doc comments

lib/trusted/startup.l
* add doc comments

lib/trusted/string.l
* add doc comments

lib/trusted/time.l
* add doc comments

lib/trusted/vector.l
* add doc comments

lib/unsafe/exec.l
* add doc comments
* fix bug where fork and vfork always return false instead of returning true in child process

lib/unsafe/method.l
* add doc comments

lib/unsafe/sql.l
* add doc comments

lib/unsafe/stream.l
* add doc comments

ltest/test155.l
* add doc comments

parsecall.l
* fix bug where print failed for constructor call without arguments

parsedef.l
* convert non-functioning pretty printer to output C++ stubs with doc comments

parseident.l
* convert non-functioning pretty printer to output C++ stubs with doc comments

parsepackage.l
* convert non-functioning pretty printer to output C++ stubs with doc comments
* output stubs to lcache rather than directories containing source files

parsetree.l
* convert non-functioning pretty printer to output C++ stubs with doc comments

syntax-k.jay
* associate doc comments with appropriate parse trees

syntax-l.jay
* associate doc comments with appropriate parse trees

token.l
* only buffer doc comments rather than all comments
* only concatenate directly consecutive comments


build 1140

* code cleanups

compilestate.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

container.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

generator.l
* convert get/set methods to accessor syntax

intermediate.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax
* use Generic.SortList<T> rather than Util.Sort to sort local variable use counts

lgeng.l
* convert get/set methods to accessor syntax

gsort.l
* remove list type formal argument and instead split Generic.Sort<T,U> into Generic.SortList<T> and Generic.SortArray<T> that sort Generic.List<T> and T[] respectively

test155.l
* also test Generic.Bag<T> interface

main.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

mbitset.l
* use common types to avoid repeated qualification of type names

mblock.l
* convert get/set methods to accessor syntax

mflow.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

mframe.l
* convert get/set methods to accessor syntax

mtree.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

needcompile.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax
* use Generic.Map<T> instead of Util.Map to store class hashes

parsecall.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parsecond.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parsedef.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parseexpr.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parseident.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parseloop.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parsepackage.l
* use common types to avoid repeated qualification of type names

parsetree.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

parsetype.l
* use common types to avoid repeated qualification of type names

symbol.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

symboltable.l
* use common types to avoid repeated qualification of type names

token.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax

type.l
* use common types to avoid repeated qualification of type names
* convert get/set methods to accessor syntax


build 1039
* fix bug where used type names not always visible in template classes
* fix bug where using entire namespace only worked for symbols with name the same length as the namespace's name

compilestate.l
* resolve used types and namespaces in a separate pass (fix bug where used type names not always visible in template classes)

lib/trusted/gllist.l
* fix bug where remove cleared entire list

lib/trusted/gvector.l
* access external types with 'use' rather than qualified names

ltest/test154.l
* access external types with 'use' rather than qualified names
* also test Generic.Bag<T> interface

parsepackage.l
* resolve used types and namespaces in a separate pass

parsetree.l
* resolve used types and namespaces in a separate pass

printtermg.l
* use Generic.List<T> interface

symbol.l
* fix bug where using entire namespace only worked for symbols with name the same length as the namespace's name


build 1038

* migrate front end from using Util.Vector to Generic.Vector.
* fix lexical analyser bug where unclosed quotes hang the compiler.
* fix lexical analyser bug where character literals not required to be exactly one character long
* fix bug where test to determine if run time cast check possible too restrictive

compilestate.l
* migrate from Util.Vector to Generic.Vector

container.l
* migrate from Util.Vector to Generic.Vector

main.l
* migrate from Util.Vector to Generic.Vector

parsecond.l
* migrate from Util.Vector to Generic.Vector

parsedef.l
* migrate from Util.Vector to Generic.Vector

parseexpr.l
* migrate from Util.Vector to Generic.Vector
* fix bug where test to determine if run time cast check possible too restrictive

parseident.l
* migrate from Util.Vector to Generic.Vector

parseloop.l
* migrate from Util.Vector to Generic.Vector

parsetry.l
* migrate from Util.Vector to Generic.Vector

parsetype.l
* migrate from Util.Vector to Generic.Vector

symbol.l
* migrate from Util.Vector to Generic.Vector

token.l
* fix bug where end of file in string, character or C-string literal causes hang
* fix bug where character literals not required to be exactly one character long

type.l
* migrate from Util.Vector to Generic.Vector

lib/trusted/gllist.l
* implement Generic.List<T> interface
* make push/pop order consistent with Generic.Vector<T>

lib/trusted/gset.l
* implement Generic.Bag<T> interface


(no build number)
compilestate.l
* if verbose output requested output name of each source file as it is parsed

(no build number)

in progress - migrate to generic collections


build 1037

supress information output relating to multi process compilation unless verbose output requested
fix bug where multi process compiles fail with link errors

compilestate.l
* only output process pool information messages if verbose output wanted
* output process pool information messages using ParseTree.message rather than IO.Std.err.println

parsedef.l
* add object files to link set earlier (fixes bug introduced in 1036 that broke multi process compilation because main process did not see correct link set)


build 1036

fix various problems with interfaces and class dependancy checking

compilestate.l
* fix bug introduced in 1035 where .hash files written to current directory instead of lcache
* write .depend files out named .tmp and then rename to .depend when compile complete (fixes problem where .depend files written too early can cause dependancy changes to go unnot\
iced and stale object files to be linked)
* remove debug output
* fix bug introduced in 1035 where .hash files only written if multiprocessing enabled with -jN

container.l
* remove debug output
* add Container.is_interface flag + accessors
* add Container.populateAllImplementedInterfaces. Used to determine complete set of implemented interfaces for a class taking in to account interfaces implemented in parent class \
and parent interfaces of all implemented interfaces
* sort interfaces before coloring interface dispatch table slots so that class compilation order does not affect slot indexes (fixes problem where repeated compiles result in clas\
ses being needlessly recompiled and output executables differing due to changed interface dispatch table slot indexes)
* when coloring interface dispatch table slots, check interface interference and allocate slots on method by method basis rather than interface by interface (reduces amount of was\
ted space in interface dispatch tables)
* support methods in super classes implementing interfaces declared implemented in child classes
* interface error checking for:
all required interface methods implemented
compatible return type in implementing methods
non method members in interfaces

lib/gvector.l
* add clear() method

needcompile.l
* fix bug where .hash files potentially written before being read causing dependancy changes to go unnoticed and stale object files to be linked)

parsedef.l
* mark interface and interface template Containers as IsInteface
* do not class object files to link files set twice
* interface error checking:
interface super class must also be an interface
class super class may not be an interface
implemented interfaces be interfaces
* do not attempt to compile interfaces to object code
* only display 'compile class:' message if class actually requires compilation
* add object files to link in here only

git
* removed some intermediate files from repository

(no build number)

import runtime library


Build 1135 - import into git
site design and content copyright (C) jeek 1995-2010     [ 13132 ]