History log of /system/core/libacc/acc.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
88f29fefa86c9fe32c888c2b161e38b20c478cf5 27-Apr-2010 Nick Kralevich <nnk@google.com> fix build on darwin.

Change-Id: I655b92f0a09bc4bc1b2b277b24ca24c081b4da94
/system/core/libacc/acc.cpp
093ba2599137453d015e04896a2971f3e9c0a251 23-Apr-2010 Nick Kralevich <nnk@google.com> make libacc run with execute stack protections enabled.

libacc was allocating memory using malloc for executable pages.
When running on a system where the stack and heap are not
executable, using malloc for executable pages will result in
a segfault.

This change modifies libacc to allow the code to run, even
if the system is running with executable stack and heap disabled.

Change-Id: Ia74e3d83750c09b7eefd865ff059db920093040d
/system/core/libacc/acc.cpp
ba48fe2f4e8bbcf53dbf66c40503a5751354f379 27-Nov-2009 Jack Palevich <jackpal@google.com> Fix memory deallocation bug in toy vector class.

Yet another reason to use standard collection classes. :-)
/system/core/libacc/acc.cpp
13edb721c0a933b943f77385c412563c26425c05 10-Nov-2009 Jack Palevich <jackpal@google.com> am 556c60f4: am 51da51a2: am 02effee6: Correctly compute the type of an assignment expression.

Merge commit '556c60f4f27e2a3bfde6a47acf876716ea8d5795'

* commit '556c60f4f27e2a3bfde6a47acf876716ea8d5795':
Correctly compute the type of an assignment expression.
02effee6a9224b531cb3fe6eac8278b46b9fbe86 08-Nov-2009 Jack Palevich <jackpal@google.com> Correctly compute the type of an assignment expression.

This change enables following types of statements to work correctly:

a = b = 3;
if ((a = getchar()) < 0) { ... }

This fixes 2232082 acc: assignment in comparison segfaults
/system/core/libacc/acc.cpp
46f2bd2080115122f1ba5f3e12f6ce6a81a82fae 30-Oct-2009 Jack Palevich <jackpal@google.com> Fix type bug that breaks 64-bit OSX build.
/system/core/libacc/acc.cpp
c951c59232f59f1e0235725103f8636fe2f580f7 29-Oct-2009 Jack Palevich <jackpal@google.com> Add support for the continue statement

Add error check for a break statement that's not inside a loop. (We just
generated bad code before. Oops!)
/system/core/libacc/acc.cpp
ee1f829dd45a3a45fd0eb453b76a30cb99043be2 29-Oct-2009 Jack Palevich <jackpal@google.com> Implement typedef.
/system/core/libacc/acc.cpp
188a5a7a3af54bd45383c72e452d627d33e63391 28-Oct-2009 Jack Palevich <jackpal@google.com> Support nested macros. (Still don't support macro arguments.)

Now you can say:

#define A B
#define B C
#define C 4

int x = A;

And it will work as expected.

Print an error message rather than assert when we're expecting a
function value, but don't find one.
/system/core/libacc/acc.cpp
b13d4e857a761d42ebbaece2bafd7799c875686e 19-Sep-2009 Jack Palevich <jackpal@google.com> Improve error-handling when an expected token is missing.

We had been arbitrarily swallowing the next token, even if it wasn't
the one we were expecting. Now we only swallow it if it _is_ the one
we were expecting.
/system/core/libacc/acc.cpp
1c60e46e0e5a20426e235eaede8f1cf7395f4cc0 19-Sep-2009 Jack Palevich <jackpal@google.com> Produce error rather than assert when encountering a nested function.

Remove extra '\n' characters from error messages.

Dynamically allocate error message buffer.
/system/core/libacc/acc.cpp
53f06587929ab22c6d7abaf9a9bc0c65303c151b 10-Sep-2009 Jack Palevich <jackpal@google.com> Update peephole optimizer

+ Save one instruction for loads of local byte or float values.
+ Save two instructions for pointer arithmetic with a stride that
is a power of two.
/system/core/libacc/acc.cpp
d30a2ce2440f1eaf495c04c3b184959310a8da0a 10-Sep-2009 Jack Palevich <jackpal@google.com> Implement a simple peephole optimization framework for ARM.

Implement some optimizations:

+ performing arithmetic by a small constant is 3 instructions shorter.
+ reading a local variables is 1 instruction shorter.
+ constant array indexing (e.g. p[5]) is 5 instructions shorter.
/system/core/libacc/acc.cpp
d5315573d792c8441482b1cbe9ac7e93d3f730d1 09-Sep-2009 Jack Palevich <jackpal@google.com> Move ARM disassembler out of libacc and into the acc command-line tool.
/system/core/libacc/acc.cpp
c408bbf4a76e52a87b15b7b01a484f91c98925f8 08-Sep-2009 Jack Palevich <jackpal@google.com> Turn an assert into an error to handle bad struct members more gracefully.
/system/core/libacc/acc.cpp
9116bc4c184334dc2ad90473fdd8529c335938e3 08-Sep-2009 Jack Palevich <jackpal@google.com> Improved DEBUG_SAVE_INPUT_TO_FILE logic.
/system/core/libacc/acc.cpp
61de31feff2c2507531064a3f330cf97dea4df6c 08-Sep-2009 Jack Palevich <jackpal@google.com> Generate an error for the use of an undeclared struct.
/system/core/libacc/acc.cpp
8fe5dcac3447447bd81501a045560abf1bb9cf98 05-Sep-2009 Jack Palevich <jackpal@google.com> Improve error message for unknown struct members

We now customize the error message to correctly refer to the '.' or
'->' operator , whichever one is actually being used when the error
occurs.
/system/core/libacc/acc.cpp
5fd66ae01e3b4a75307a65d839e4679327f10471 05-Sep-2009 Jack Palevich <jackpal@google.com> Improve address operator (unary &).

Until now the address operator only worked with simple variables.
Now it works with arbitrary expressions (that are lvalues or function
names). So for example this now works:

struct S { int a[10]};

int f(struct S* p) {
return &p->a[3];
}
/system/core/libacc/acc.cpp
ecfd8e73e4d0102ba01139f9b7ea1e97ce7b79d5 28-Aug-2009 Joe Onorato <joeo@android.com> acc error tweaks
/system/core/libacc/acc.cpp
9221bcccb39a53c8cddf338e53d0cfa2201b52dd 27-Aug-2009 Jack Palevich <jackpal@google.com> Preliminary struct and union support.

Working features:
- struct
- union
- nested structs
- anonymous structs
- forward declarations
- '.' and '->'
- copying structs using '='

Missing features:
- passing structs by value
- returning structs by value
- typedef
- sizeof

Example:

struct v {float x, y, z, w; };

void add(struct v* result, struct v* a, struct v* b) {
result->x = a->x + b->x;
result->y = a->y + b->y;
result->z = a->z + b->z;
result->w = a->w + b->w;
}

Reworked size-of and alignment logic to support structs.

Improved encoding of ARM immediate constants.
/system/core/libacc/acc.cpp
c0f253359f11c087a3ffc92b46755c6c96f57899 25-Aug-2009 Jack Palevich <jackpal@google.com> Make pointer casting work.
/system/core/libacc/acc.cpp
30321cb3f3a14bad54a0a792be6346109eb043eb 21-Aug-2009 Jack Palevich <jackpal@google.com> Add ARM hardware floating point support.
/system/core/libacc/acc.cpp
0a01a5db5672b65f81732eaed6fb9fcccea16d06 19-Aug-2009 Jack Palevich <jackpal@google.com> Handle functions with anonymous arguments

Example:

int f(int a, int, int c) {
return a + c;
}
/system/core/libacc/acc.cpp
815d8b8fdbd86bb2f7e5f11dc9ace9cb62212d59 19-Aug-2009 Jack Palevich <jackpal@google.com> Allow redefinition of macros.

Example:

#define A 3
#define A 4

This used to do strange things, but now works as it should.
/system/core/libacc/acc.cpp
0b1827a5b23a78da5ed88c4158c73b822b92f7a9 19-Aug-2009 Jack Palevich <jackpal@google.com> Allow '//'-style comments in #defines.
/system/core/libacc/acc.cpp
0b2de0de64666854c3621ddd69f580898776708e 19-Aug-2009 Jack Palevich <jackpal@google.com> Allow parenthesized expressions as the value of defines

For example, this now works:

#define A (1 + 2)

Note that we still don't support defines with argument lists, so this is
still illegal:

#define A(X) (X + 2)

Also in this change: The compiler test script allows command-line
arguments to disable testing on ARM and to disable testing the output
of the old OTCC compiler.

Disabling testing on ARM is handy for developing front-end code when no
device or emulator is available.

Disabling testing OTCC output is handy for some 64-bit Linux environments,
because the original OTCC needs some tweaking to be fully compatible, and
I don't have time to investigate this problem right now.
/system/core/libacc/acc.cpp
7f5b1a2b317874a9009d20ed4d3789a7cb508ca4 18-Aug-2009 Jack Palevich <jackpal@google.com> do not merge: cherry-picked ecd23c09e87d7088285f8b7c2eeb98815c2e69e0 from master branch
/system/core/libacc/acc.cpp
80e4972625b60d799db67021af18194567aed3e7 05-Aug-2009 Jack Palevich <jackpal@google.com> Support 2D arrays.
/system/core/libacc/acc.cpp
b61545096d2f55f76b22b7ef734e7cdb0c5eaf97 04-Aug-2009 Jack Palevich <jackpal@google.com> Implement arrays.

Added check to see that pointer types are compatible when passing function
arguments.
/system/core/libacc/acc.cpp
c9b8ffc3897952deef9e23949ce42fdc09f14a24 03-Aug-2009 Jack Palevich <jackpal@google.com> Add support for "short" data type.
/system/core/libacc/acc.cpp
96138992ac98f8962dc2345d9ba3e99006af80b2 01-Aug-2009 Jack Palevich <jackpal@google.com> Fix parsing of function declarations that return pointers.

Check that <op>= only evaluates the left-hand-side once.
/system/core/libacc/acc.cpp
47cbea9c696c8fbeb67c66387b85f59b73d32e6d 01-Aug-2009 Jack Palevich <jackpal@google.com> Support brackets for accessing array values.

Don't yet support allocating arrays.
/system/core/libacc/acc.cpp
5b65909f93f7c35fc1e7aaf7dccc2198e30d17d1 31-Jul-2009 Jack Palevich <jackpal@google.com> Clean up the way we handle postfix operators.

Function names are now treated just like any other variable.
/system/core/libacc/acc.cpp
aaac9284b407d236981cbe9be9b167c67cc905ba 31-Jul-2009 Jack Palevich <jackpal@google.com> Implement pre-increment / pre-decrement
/system/core/libacc/acc.cpp
43aaee31b9cedc059213396f1e7aa420ace0c797 31-Jul-2009 Jack Palevich <jackpal@google.com> Support the comma operator.
/system/core/libacc/acc.cpp
0c01774816245e59aac7f2109c28523eeb6492ac 31-Jul-2009 Jack Palevich <jackpal@google.com> Implement op=.
/system/core/libacc/acc.cpp
29daf577a110ab19ad333993f178483e747278f1 31-Jul-2009 Jack Palevich <jackpal@google.com> Assignment in ordinary expressions is now handled using lvals and rvals.
/system/core/libacc/acc.cpp
b5e33311593e8b6d52ccb1eb5d5453a6cdd2d9e0 31-Jul-2009 Jack Palevich <jackpal@google.com> Start using lvals and rvals.
/system/core/libacc/acc.cpp
8968e8e1158deda0ad035852791d5be8dcdc1632 31-Jul-2009 Jack Palevich <jackpal@google.com> Change assignment code gen to use leaR0 .. storeR0ToTOS.

This is another step towards being able to handle lval / rvals.

Improved storeR0ToTOS to convert R0 to the proper type to store into
*TOS. (This is something that storeR0 was already doing.)

Removed storeR0 as it is no longer being used.
/system/core/libacc/acc.cpp
8f361faffc93f89d1025d9ca729d76cd7850ad99 31-Jul-2009 Jack Palevich <jackpal@google.com> Fix bad ARM code generation for '||' and '&&' operators.

Add tests of '&', '&&', '|' and '||' operators.
/system/core/libacc/acc.cpp
9f51a2696126c6db40d00c8183b26e89fb7e443e 30-Jul-2009 Jack Palevich <jackpal@google.com> Load function symbols using lea syntax.

Use a common code path for ordinary, forward, and indirect calls.
/system/core/libacc/acc.cpp
a7813bda4a4101baad47f11ef4ff9ff5e33d242f 29-Jul-2009 Jack Palevich <jackpal@google.com> Remove loadR0 in favor of lea + loadR0FromR0.

(This is another small step towards lval/rval.)

+ Use strd to store local doubles.
+ loadR0FromR0 now handles pointers.
/system/core/libacc/acc.cpp
ddf7c9c14184acffe5ac33d06389cf733cfe11da 29-Jul-2009 Jack Palevich <jackpal@google.com> Implement inc/dec in a more lval-friendly way.
/system/core/libacc/acc.cpp
7fcdf1c5f8f25228bf348be9360594679329616f 24-Jul-2009 Jack Palevich <jackpal@google.com> Adjust stack alignment for local variables to work more like arguments.

This makes it easier to generate frame-pointer-relative addresses for ARM.

Prior to this we had stored char sized local variables in the highest
address of the 4-byte stack allocation. Now we store "char"s in the
lowest address of the 4-byte stack allocation, just like chars are
passed as arguments.

We now store global chars on byte boundaries.
/system/core/libacc/acc.cpp
2ff5c22e9658cc69f7831830808f96d5913cfdba 24-Jul-2009 Jack Palevich <jackpal@google.com> Keep track of the current arena.

This means we don't have to pass it around as an argument.

This change was made because I'm about to start creating pointer types
during expression evaluation, and I didn't want to add an arena
argument to all the expression functions.
/system/core/libacc/acc.cpp
89baa2083fbc71d3a9fb50ddd59c1b58347bf2f3 23-Jul-2009 Jack Palevich <jackpal@google.com> Fix the ARM postdecrement operator.

Add a test for ++ and -- so this bug won't happen again.
/system/core/libacc/acc.cpp
58c30eef99aa3d9b5039532c4cf015d476fd815b 18-Jul-2009 Jack Palevich <jackpal@google.com> Code generator cleanup

Factor ARM integer binary operation setup code into a function.

Don't pass redundant pType information into loadR0FromR0, storeR0ToTOS,
gcmp, gUnaryCmp, li

Separate inc/dec from variable loading. Generates worse code, but now
we handle pointer inc/dec and char inc/dec.
/system/core/libacc/acc.cpp
b40367bde10f7d55a7309a220dfbab6bd54c761a 17-Jul-2009 Jack Palevich <jackpal@google.com> Remove unused logging code.
/system/core/libacc/acc.cpp
ba929a4ffac09becb3ae75facd74dc4f85c2725a 17-Jul-2009 Jack Palevich <jackpal@google.com> Track lvalues vs. rvalues.
/system/core/libacc/acc.cpp
3377bfd8451b33877318ddfef657e82fe7ed4c9c 17-Jul-2009 Jack Palevich <jackpal@google.com> Report error (rather than crashing) when a declaration name is missing.

Repo case:

void main()
{
int );
}
/system/core/libacc/acc.cpp
8148c5be54f12dcefcb5415adee709f40772589f 17-Jul-2009 Jack Palevich <jackpal@google.com> Coerce R0 to destination type before storing it into a variable.
/system/core/libacc/acc.cpp
dc45646238b8c9a0f124d7ae16bc3d14122d6e7c 17-Jul-2009 Jack Palevich <jackpal@google.com> Implement a "#line" directive.
/system/core/libacc/acc.cpp
b1544cad421ee8fcdd3dfb349392f21a91e3934f 17-Jul-2009 Jack Palevich <jackpal@google.com> Detect assignments to undeclared variables.

Previously we only detected reading from undefined variables.
/system/core/libacc/acc.cpp
ce105a908262c6cee2b0b81e7f212a6bcdbaa876 16-Jul-2009 Jack Palevich <jackpal@google.com> If the compile failed, return NULL from symbol lookups.
/system/core/libacc/acc.cpp
d1f57e689b703faa46d26decb1758a6f0330e9ec 16-Jul-2009 Jack Palevich <jackpal@google.com> Improve error handling

Don't segfault if the right-hand operand of a binary operator is missing.
Don't segfault if a semicolon is missing at the end of a forward
declaration.
/system/core/libacc/acc.cpp
2aaf21f1beefeaa91de8f21a96223c739f48cf88 16-Jul-2009 Jack Palevich <jackpal@google.com> Improve numerical constant parsing.
/system/core/libacc/acc.cpp
8c246a9dc294760f2a981cf5144fe4939d1554e6 15-Jul-2009 Jack Palevich <jackpal@google.com> Add accRegisterSymbolCallback API to control external symbol linkage.

Until now dlsym was used to lookup external symbols. Now you can
register your own function to be called when an undefined symbol is
used.
/system/core/libacc/acc.cpp
37c54bd22e2ac5ca8601416701e14b546ce5b6f1 15-Jul-2009 Jack Palevich <jackpal@google.com> Make forward declarations of external symbols really work.

Until now we had always been treating external variables as "int",
and external functions as int (...);
/system/core/libacc/acc.cpp
7ecc5556aee0145a48f096cb1e015034e59bc67a 15-Jul-2009 Jack Palevich <jackpal@google.com> Remove unused variable.
/system/core/libacc/acc.cpp
a8f427f60620d766b201c9a84c457fa5dbaf95d4 14-Jul-2009 Jack Palevich <jackpal@google.com> Implement pointer arithmetic.
/system/core/libacc/acc.cpp
25c0ccaed43e8ecd1827248890c57c97d0ce80c7 14-Jul-2009 Jack Palevich <jackpal@google.com> Implement support for "char" local and global variables.
/system/core/libacc/acc.cpp
45431bc2528246f829383abda8c2cd72c57fcb65 14-Jul-2009 Jack Palevich <jackpal@google.com> Implement general casts and pointer dereferencing.

Prior to this casts and pointer dereferencing were special-cased.
/system/core/libacc/acc.cpp
b7718b973cefe74b3bdc221351145f657306e326 10-Jul-2009 Jack Palevich <jackpal@google.com> Implement floating point for ARM.
/system/core/libacc/acc.cpp
bab80642035c2fe8565ccbadf18883b7d1df6437 09-Jul-2009 Jack Palevich <jackpal@google.com> Add x86 floating point test.
/system/core/libacc/acc.cpp
2a4e1a9f88dd249047da6589a8a6a66b1c870e6d 09-Jul-2009 Jack Palevich <jackpal@google.com> Finish implementing x86 floating point

Support floating-point if/while statements: if(1.0) { ... }
Support reading values from float and double pointers.

And some additional error checking.
Detect malformed "return" statements
Detect passing the results of "void" functions as arguments.
/system/core/libacc/acc.cpp
a39749f641f49ed1c6380bfaedad98a036a0f4a6 09-Jul-2009 Jack Palevich <jackpal@google.com> Implement x86 floating point operations

+ unary floating point operation -
+ unary floating point compare: !
+ binary floating point operations +-*/
+ binary floating point comparisons: < <= == != >= >
/system/core/libacc/acc.cpp
eea5ae9cebf3d2fcdae7cfa669a4b0c7ca014bd3 09-Jul-2009 Marco Nelissen <marcone@google.com> Class with virtual methods should have virtual destructors too.
/system/core/libacc/acc.cpp
9cbd22696039bce6a4692a7e378f126c6f44c6e4 09-Jul-2009 Jack Palevich <jackpal@google.com> Implement global, local, and stack based float and double variables.
/system/core/libacc/acc.cpp
128ad2d20497afb6ed1f2f11cfdae020f08f798c 08-Jul-2009 Jack Palevich <jackpal@google.com> Implement x86 int <--> float.
/system/core/libacc/acc.cpp
1a539db23c90cc4b0e9c43bd37ee873fc34390dd 08-Jul-2009 Jack Palevich <jackpal@google.com> Some x86 floating point code works.

We now check the types and number of arguments to a function.
/system/core/libacc/acc.cpp
8df4619e09b8944c1aa3b743b556a63a283d8768 07-Jul-2009 Jack Palevich <jackpal@google.com> Start tracking types in expressions.
/system/core/libacc/acc.cpp
1aeb87b52b70a7c568713d1a6524645383c54507 07-Jul-2009 Jack Palevich <jackpal@google.com> Parse floating point (and double) constants.
/system/core/libacc/acc.cpp
9eed7a2c7b3748f4aa10e1dc60875bf72a18c275 07-Jul-2009 Jack Palevich <jackpal@google.com> Start teaching the code generator about types.

Remove the concept of "R1" from the code generator API, R1 is used
internally as needed.
/system/core/libacc/acc.cpp
95727a0b057fb6d7117e70cf0e9621892ec781c3 06-Jul-2009 Jack Palevich <jackpal@google.com> Initial support for float, double.
/system/core/libacc/acc.cpp
3f22649d980717aa8bb0160c9a1d436bc813f05d 02-Jul-2009 Jack Palevich <jackpal@google.com> Implement our hard casts using our type system.

Doesn't add any new capabilities, but we now generate error
messages if you attempt casts we don't support,
and we also found and fixed some bugs in declaration parsing.
/system/core/libacc/acc.cpp
40600de143c3f0f07e03c8f69cd3d32f49c123eb 02-Jul-2009 Jack Palevich <jackpal@google.com> Clean up expression code.

Concatenate adjacent string literals.
/system/core/libacc/acc.cpp
8635198c57b8a913f0f9d3b07139f8b2af7cb30f 01-Jul-2009 Jack Palevich <jackpal@google.com> Add a type system.

We now track the declared type of variables and functions.
/system/core/libacc/acc.cpp
569f135862b7a00a1ec59d1f000e376cef9648f5 29-Jun-2009 Jack Palevich <jackpal@google.com> Implement a token table and an arena allocator.

+ Tokens are now simple IDs, rather than ids or maybe pointers.
+ We can now allocate data that's freed automatically when
compilation end or when a block goes out of scope.
+ Renamed our Array utility class to Vector, and made its
api work a little more like the STL vector template class.
/system/core/libacc/acc.cpp
422972cb127c229a38e79bb5d2d8df44aebeeeea 18-Jun-2009 -b master <jackpal@google.com> Align ARM stack pointer to an 8-byte boundary when calling functions.

This is required by the ARM EABI standard.
/system/core/libacc/acc.cpp
a1804ddebaf8f54f922716dcfe83d9726dd18493 12-Jun-2009 Jack Palevich <jackpal@google.com> Allow local variables to be declared anywhere in a block.
/system/core/libacc/acc.cpp
d7461a7342e706bece657172799ea8db9a104237 12-Jun-2009 Jack Palevich <jackpal@google.com> Support variable initialization.

Global variables can only be initialized to integer constants.

Local variables can be initialized to arbitrary expressions.
/system/core/libacc/acc.cpp
f1728bec74f952763a02a4c7d38c33b20d700870 12-Jun-2009 Jack Palevich <jackpal@google.com> Reserve all C99 keywords.

And improve checks/error messages around using non-symbols where a
symbol is expected.
/system/core/libacc/acc.cpp
22e3e8e1a63ba947cae52e143f650df679fd46ba 12-Jun-2009 Jack Palevich <jackpal@google.com> Handle end-of-file inside of comments, local declarations.
/system/core/libacc/acc.cpp
b4758ff1defaf01f381bce1630607ad1763f72ec 12-Jun-2009 Jack Palevich <jackpal@google.com> Implement string and character backslash constants.

Until now we only supported '\n'. Now we support everything, including
octal ('\033') and hex '\x27' constants.
/system/core/libacc/acc.cpp
2ccc40d096ef18ca595f95c6c52532400be34807 12-Jun-2009 Jack Palevich <jackpal@google.com> Make #define work again. (Had accidentally omitted the keyword.)
/system/core/libacc/acc.cpp
a6baa23f0831f98e84ee4afbfb6cdb3ac5c1f5ea 12-Jun-2009 Jack Palevich <jackpal@google.com> Improve symbol-related error checking

+ Duplicate symbols.
+ Undefined variables;
+ Forward-referenced functions that were never defined.
/system/core/libacc/acc.cpp
b67b18f7c2217ae83e9ffc808cb9a58b233ec5bc 12-Jun-2009 Jack Palevich <jackpal@google.com> Add code generator tracer.
/system/core/libacc/acc.cpp
303d8ffca9c508a6b25408fc3b2e80ead252e1ed 12-Jun-2009 Jack Palevich <jackpal@google.com> Improve local variable scoping.

Until now we faked local variables -- they only worked correctly if
there was no overlap between local variables and global variables.

Use a symbol table stack instead of a string list.

Fix bug with looking up undefined symbols.
/system/core/libacc/acc.cpp
2db168f12feb0e25209b4aee385af074ef87157a 11-Jun-2009 Jack Palevich <jackpal@google.com> Use a separate table for keywords.
/system/core/libacc/acc.cpp
0a280a0dde38444398da102c17f260270a0a4c4e 11-Jun-2009 Jack Palevich <jackpal@google.com> Remove use of setjmp/longjmp from libacc compiler.

It makes it harder to deal with memory allocation.

Also fix bug in the otcc-ansi.c test, where the wrong part of the
code buffer was being mprotected, so that if the code buffer happened
to be allocated across a page boundary, some code would no receive
execute permission.
/system/core/libacc/acc.cpp
8dc662efe9e0c820eb001d66315bc32b2358fc57 10-Jun-2009 Jack Palevich <jackpal@google.com> Make otcc code work in x64 based system with 32-bit chroot.

Set execute permission on code before running it.
Handle negative relative offsets for global variables.
Add printfs to report the progress of nested compiles.
Change way we detect whether we can run the host compiler
or not. We used to check if we were running on a 32-bit
Linux. Now we check if the executable is a 32-bit Linux
executable.
/system/core/libacc/acc.cpp
36d9414f72b629dacc2c972e93d16cec08ef44b6 09-Jun-2009 Jack Palevich <jackpal@google.com> Make a host version of acc for testing.

Don't run the code we've compiled unless the -R option is present.
/system/core/libacc/acc.cpp
2d11dfba277b2f9d98f00a32510d612e779ba757 08-Jun-2009 Jack Palevich <jackpal@google.com> Move macros into their own table.

Catch attempts to define macros with parens (not supported.)
/system/core/libacc/acc.cpp
b7c81e99522fbc5256f20e826eae18f2a33ea76a 05-Jun-2009 Jack Palevich <jackpal@google.com> Switch to ANSI C style C function declarations.

main(argc, argv) --> int main(int argc, char** argv)

Although we accept int, void, and char types, and pointers to same,
we actually still treat everything as an int.
/system/core/libacc/acc.cpp
eedf9d20832f1af3a4bd362819be6eace54240b5 05-Jun-2009 Jack Palevich <jackpal@google.com> Add support for #pragma foo(bar)

Report unsupported/unknown preprocessor directives.
Report line number of error rather than character offset.
/system/core/libacc/acc.cpp
f1f39cca305f6f3d2d91b88736b7b2b520d59e2e 30-May-2009 Jack Palevich <jackpal@google.com> Make sure we don't overflow various internal compiler buffers.

We may replace some of these tables with dynamically growing data
structures, but in the meantime we will not trash memory.
/system/core/libacc/acc.cpp
ac0e95eb60fc8f8ef3281f9183630d1515bd12a7 29-May-2009 Jack Palevich <jackpal@google.com> Improve ACC error reporting.

Now return an error code and an error message, rather than just
printing to stderr or calling exit().

Check to see we don't exceed our code size.
/system/core/libacc/acc.cpp
653f42da9249a2f576d1ff50ee22bf6a67ff90b1 29-May-2009 Jack Palevich <jackpal@google.com> Pointer-ize the acc front end.

The ACC compiler used to be able to compile itself. This was a neat
feature, but because ACC only supports ints, pointers are stored as
ints, and cast to pointers when used.

This checkin turns many ints that are really pointers back into
pointers, so that the code is clearer.

int ch;
char* glo;
char* sym_stack;
char* dstk;
char* dptr;
int dch;
char* last_id;
/system/core/libacc/acc.cpp
09555c7a18342390556132f7d050a410d02206ef 27-May-2009 Jack Palevich <jackpal@google.com> Fix symbol lookup logic, squelch LOG output.
/system/core/libacc/acc.cpp
1cdef20774b2cd30f1a509227c86845337f63f11 22-May-2009 Jack Palevich <jackpal@google.com> Convert libacc into a shared library.

Document internal CodeGenerator interface

Move license to a separate license file.

Define a public API for calling libacc.

Update the "acc" test program to use the public API.
Move "main.cpp" and test scripts into the tests subdirectory.
Move test data from tests to tests/data
Remove stale test data.
/system/core/libacc/acc.cpp
8b0624c3d30e7b8b0d748301c0c2175bbb01acd6 20-May-2009 Jack Palevich <jackpal@google.com> Fix x64 int / pointer warnings.
/system/core/libacc/acc.cpp
e7b590666dba83c72b7f7bf210dad7239ab04b4f 20-May-2009 Jack Palevich <jackpal@google.com> Implement architecture-dependent defaults.

If libacc is built on x86, then x86 is the default code generator.
If libacc is built on arm. then ARM is the default code generator
And so on for future architectures.

The 64-bit x64 machine has no working code generator currently.
We may add one to support the simulator builds.

Improved the test program so we don't try to run tests if the
compile failed. Also avoid running tests that don't work on
a given platform.
/system/core/libacc/acc.cpp
3d474a74a7aad537f596d3978be7ec0cb79d4e64 16-May-2009 Jack Palevich <jackpal@google.com> ACC ARM codegen: implement /, %
/system/core/libacc/acc.cpp
7810bc9abd7c2c415d87b62dea1ff75d5fdc7397 15-May-2009 Jack Palevich <jackpal@google.com> ACC ARM codegen: Implement calling indirect functions.
/system/core/libacc/acc.cpp
4d93f30befb6e3adf37198c6c7f6727d1e570b94 15-May-2009 Jack Palevich <jackpal@google.com> ACC ARM code gen: Implement global variables.

Collapsed the inc/dec codegen into the loadEAX function, because it
allows us to generate better code for inc/dec'ing a global variable
on ARM, because we don't have to load the variable's address twice.
/system/core/libacc/acc.cpp
bd894904f70827a131b24bb2e8f8a32707e586df 15-May-2009 Jack Palevich <jackpal@google.com> ACC: Arm code gen improvements ++/--, &, odds and ends

Added C++-style "//..end-of-line" comments, since I kept trying to use them when writing
test programs.

The biggest known missing piece is global variables.
/system/core/libacc/acc.cpp
8de461dc9e400daac883477fcab0d6d07ac1918a 15-May-2009 Jack Palevich <jackpal@google.com> Implement <, >, ==, !=, >= <=, &&, and ||.
/system/core/libacc/acc.cpp
69796b6c847dd15bdbc1d0a563e421562c2c56f3 15-May-2009 Jack Palevich <jackpal@google.com> ACC ARM code gen: Implement local variables, function args

+ Fix prolog and epilog code.
/system/core/libacc/acc.cpp
cb1c9ef38c9db11db927096a45b10cda52786481 14-May-2009 Jack Palevich <jackpal@google.com> ACC ARM code gen improvements. printf("Hello, world\n"); works!

+ Improved li to handle all 32-bit values.
+ Implemented push/pop of temp registers during evaluation
+ Implemented the unary and binary easy math operators (+,-,*,<<,>>,|,&,^,~)
+ Implemented global function calling.
/system/core/libacc/acc.cpp
a65356109772b04283d18d21dd5455e825ba8c25 14-May-2009 Jack Palevich <jackpal@google.com> ARM codegen: Add disassembler, implement return

This program works:

main() { return 42; }

The disassembler was borrowed from codeflinger, and just modified enough to compile
under C++ without warnings.

Implemented gsym
Implemented a hack verison of li, only works for -256..255
Implemented gjmp
/system/core/libacc/acc.cpp
546b2249eff4d95622c4bab0698ebf290c9ed836 14-May-2009 Jack Palevich <jackpal@google.com> Begin filling in ARM code generator.

We can now call functions that have no arguments (and return from them too!)
/system/core/libacc/acc.cpp
2230513fc0ba455c6de39525dded4274dfb0146b 13-May-2009 Jack Palevich <jackpal@google.com> Add stub Arm code generator.
/system/core/libacc/acc.cpp
bf42c9c163cfd63a2895a0bbb38013c8a0024c2e 12-May-2009 Jack Palevich <jackpal@google.com> Move all x86-specific knowlege into the X86CodeGenerator.
/system/core/libacc/acc.cpp
21a15a2416b4b138bf509186106525944e78ad08 11-May-2009 Jack Palevich <jackpal@google.com> Various C++ improvements

+ Changed indentation, causes the stats to say there's a lot of lines changed.
+ Should be able to compile multiple times with the same compiler object.
+ Create a CodeBuffer class to hold the code.
+ Create a CodeGenerator class to encapsulate knowlege of the CPU instruction set.
+ Started filling in the code generator.
/system/core/libacc/acc.cpp
bbf8ab504a68f7e971b7fa47b0bee3c3e022a480 11-May-2009 Jack Palevich <jackpal@google.com> Added command-line option "-t" to allow run-time switching between running and dumping.

Fixed some C++ warnings reported by g++ .
Verified that the compiler actually works when run on 32-bit Linux.
/system/core/libacc/acc.cpp
77ae76eea9df695b66834b8df2a1060c7dad3eca 11-May-2009 Jack Palevich <jackpal@google.com> converted to C++

Base address of constant table changed, so had to update the "-orig" files.
/system/core/libacc/acc.cpp