Commit Graph

19 Commits

Author SHA1 Message Date
H. Peter Anvin
9b49c49e00 tokhash.pl: fix comment
Correct filename in comment
2008-05-27 14:43:48 -07:00
H. Peter Anvin
7065309739 Formatting: kill off "stealth whitespace"
"Stealth whitespace" makes it harder to read diffs, and just generally
cause unwanted weirdness.  Do a source-wide pass to get rid of it.
2007-10-19 14:42:29 -07:00
H. Peter Anvin
fe501957c0 Portability fixes
Concentrate compiler dependencies to compiler.h; make sure compiler.h
is included first in every .c file (since some prototypes may depend
on the presence of feature request macros.)

Actually use the conditional inclusion of various functions (totally
broken in previous releases.)
2007-10-02 21:53:51 -07:00
H. Peter Anvin
a59795c986 Use the crc64 we already use as the perfect hash function prehash
Use the same crc64 that we already use for the symbol table hash as
the perfect hash function prehash.  We appear to get radically faster
convergence this way, and the crc64 is probably *faster*, since the
table likely to be resident in memory.
2007-10-02 17:40:00 -07:00
H. Peter Anvin
dc467ba8af Support __float*__ for floating-point numbers in expressions
Add special operators to allow the use of floating-point constants in
contexts other than DW/DD/DQ/DT/DO.

As part of this checkin, make MAX_KEYWORD generated by tokhash.pl,
since it knows what all the keywords are so it can tell which one is
the longest.
2007-09-24 12:30:54 -07:00
H. Peter Anvin
0c3e395cc1 tokhash: allow a bit smarter pattern matching
Allow constants to match only part of the token string.
2007-09-24 10:50:23 -07:00
H. Peter Anvin
bf9a24f464 Slightly optimize the interface to nasm_token_hash()
Instead of returning -1 from nasm_token_hash, set tv->t_type to
TOKEN_ID and return TOKEN_ID, since that's what stdscan.c wants to do
with it anyway.  This allows us to simply tailcall nasm_token_hash().
2007-09-18 22:54:40 -07:00
H. Peter Anvin
5255fd1f36 Change the token prehash function for better convergence
Combining arithmetric (add) and bitwise (xor) mixing seems to give
better result than either.

With the new prehash function, we find a valid hash much quicker.
2007-09-18 12:38:07 -07:00
H. Peter Anvin
16b0a33cea Use enumerations where practical to ease debugging
We have a lot of enumerations; by declaring fields as such, we make it
easier when debugging, since the debugger can display the enumerations
in cleartext.  However, make sure exceptional values (like -1) are
included in the enumeration, since the compiler otherwise may not
include it in the valid range of the enumeration.
2007-09-12 20:27:41 -07:00
H. Peter Anvin
309a8ba340 tokhash: correct duplicate-token test 2007-09-10 18:59:01 +00:00
H. Peter Anvin
d555a64a7f tokhash: adjust table types to reduce size
Adjust the sizes of data types to reduce the total size of the tokhash
data structure.
2007-09-10 18:58:40 +00:00
H. Peter Anvin
b938e043ca phash: don't rely on the build platform Perl version of rand()
rand() in Perl can vary between platforms, so don't use it.  Instead,
remove a completely pointless level of indirection (it introduced a
permutation which cancelled itself out) and provide a canned set of
random numbers for the rest.  This guarantees we will always use the
same numbers.
2007-08-31 18:10:23 +00:00
H. Peter Anvin
96a810256f tokhash.pl: formatting changes for readability
No functional change
2007-08-31 07:31:51 +00:00
H. Peter Anvin
91a86cdb31 tokhash: Speed up the rejection of unhashed values
Speed up the rejection of unhashed values (typically identifiers) by
filling unused hash slots with a large value (but not so large that
it is likely to overflow.)  This means those values will be rejected
already by the range check, not needing strcmp().
2007-08-31 07:23:31 +00:00
H. Peter Anvin
535af831f1 tokhash.pl: "ix" should have the same width as the "hash" arrays
For correctness in case of a very "linear" graph, "ix" needs to have
the same width as the "hash" arrays.
2007-08-31 06:06:17 +00:00
H. Peter Anvin
9e4dba2f47 Add "do not edit" comment to tokhash.c 2007-08-31 00:28:35 +00:00
H. Peter Anvin
29b1bc4603 Make the token hash a bit smaller by using 16-bit hash tables 2007-08-31 00:23:40 +00:00
H. Peter Anvin
74cc5e569c Finishing touches on perfect hash tokenizer; actually turn the thing on
Finish the perfect hash tokenizer, and actually enable it.

Move stdscan() et al to a separate file, since it's not needed in any
of the clients of nasmlib other than nasm itself.

Run make alldeps.
2007-08-30 22:35:34 +00:00
H. Peter Anvin
e9d1a97b88 Generate a perfect hash for the token parser 2007-08-30 21:45:56 +00:00