There were a number of table access functions with a code argument, which was used as an index into the table entry array to access the desired entry member. There also a number of access functions with a token pointer argument, but the token argument was only used to obtain the code (index). All of these functions (except one) were replaced with in-line table entry access functions.
The table access function of the token is used to access the table access functions. Like the existing token type and data type access functions that access the table, has flag and precedence functions were added to the token class so that the intermediate table function call is not needed. Since all of the functions are in-line members, the resulting code is just as efficient.
The table class was also made a friend class of the table entry class so that the static table members are directly accessible. The table entry class was already made a friend class of the table class. Eventually these two classes will be combined as the new table model takes shape.
There were a number of other locations where use of a code was replaced with a table entry pointer. The table entries were made private since all are now covered with access functions. However, this required a table entry constructor (to initialize all of the members) so that the current static table entry array can still be initialized. This is temporary until the new table entry class hierarchy is implemented. See the commit log for other changes that were made.
[branch table commit 2f013da528]
Saturday, January 10, 2015
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)