Commit graph

25 commits

Author SHA1 Message Date
H. Peter Anvin
5a8c424d0c Use a more optimal value for the UNUSED slot
Instead of ~1/4 the range we can use ~1/3 the range for better
distance.  It is possible that using ~1/2 - 1 might be even better,
but this is a trivial tweak.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2016-01-29 12:05:27 -08:00
H. Peter Anvin
2bbe917ede Add missing prototype in tokhash.c (from tokhash.pl)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-11-25 12:14:52 -08:00
Jin Kyu Song
487f352b62 stdscan: Rework curly brace parsing routines
As recommended by the community, a comma-separated decorators ({k1,z})
and nested braces ({{k1},{z}}) are dropped out. So only standard syntax
is supported from now.

This rework made source code neat and easy to maintain. Most of the codes
for handling corner cases are removed.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
2013-11-27 15:43:33 -08:00
Jin Kyu Song
72018a2b43 AVX-512: Add support for parsing braces
AVX-512 introduced new syntax using braces for decorators.
Opmask, broadcat, rounding control use this new syntax.

http://software.intel.com/sites/default/files/319433-015.pdf

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2013-08-06 09:37:52 +04:00
Victor van den Elzen
bc8522e3a0 Fix Perl deprecation warnings.
Use of defined on aggregates (hashes and arrays) is deprecated.
You should instead use a simple test for size.
2010-11-07 17:20:23 +01:00
H. Peter Anvin
e6ee1a859b Add copyright verbiage to Perl scripts; update LICENSE
This adds copyright verbiage to the Perl scripts.  Scripts that are
known to be clean w.r.t. the 2-clause BSD license are given that
license; unclear ones are given the "LGPL for now".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-28 16:54:44 -07:00
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