summaryrefslogtreecommitdiff
path: root/inline_invlist.c
Commit message (Collapse)AuthorAgeFilesLines
* Move inline fcn to #included fileKarl Williamson2015-01-211-0/+21
| | | | | Future commits will want this function to be able to be used in more than one core file.
* Silence several -Wunused-parameter warnings about my_perlBrian Fraser2014-06-131-4/+3
| | | | | | | | This meant sprinkling some PERL_UNUSED_CONTEXT invocations, as well as stopping some functions from getting my_perl in the first place; all of the functions in the latter category are internal (S_ prefix and s or i in embed.fnc), so this should be both safe and economical.
* regcomp.c: Add some asserts()Karl Williamson2013-07-231-0/+4
| | | | | | | | | Now that inversion lists are their own scalar types, we can verify that the parameters to their manipulation functions are indeed inversion lists. This adds such assertions to the bottom level code that deals with the bare metal of the scalars. Functions that call these (even if only in other asserts) didn't have asserts added to them, as they call these anyway.
* Remove redundant field from inversion listsKarl Williamson2013-07-161-7/+20
| | | | | | | The number of elements in an inversion list is a simple calculation based on SvCUR(). Prior to this patch there was a field that contained that number directly, and the two values diverged, causing a bug. A single value can't get out-of-sync with itself.
* Reinstate "Use new Svt_INVLIST for inversion lists."Karl Williamson2013-07-161-1/+1
| | | | | | | | | | | This reverts commit 2e0b8fbeab3502bee36f25825c3cdd0d075c4fd3, which reverted e0ce103ae532f9576f54a5938a24d1ee98dfb928, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was: This converts inversion lists to use their own scalar type.
* Reinstate "regcomp.c: Move some #defines to only file that uses them"Karl Williamson2013-07-161-24/+0
| | | | | | | | | | | | | | | This reverts commit 247f9b19318882fd9a52fe49aa31fc8d3d3db4f7, which reverted 05944450e0fc82eb8fc1fb5a4bf63f23785262a0, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was: These were used in a header file to provide synchronization between files. However, the only other file that would need them is a .pl file which doesn't have access to them. So simplify things so that the variables are either removed entirely if only used in a single place, or are #defined in the area where they are used
* Reinstate "regcomp.c: Make C-array inversion lists const"Karl Williamson2013-07-161-1/+1
| | | | | | | | | | | This reverts commit 18505f093a44607b687ae5fe644872f835f66313, which reverted 241136e0ed70738cccd6c4b20ce12b26231f30e5, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was: The inversion lists that are compiled into a C header are now const.
* Reinstate "regcomp.c: Move inversion list hdr field to SV hdr"Karl Williamson2013-07-161-1/+1
| | | | | | | | | | | | | | | | This reverts commit 2eb2feb9f4a226d0fe0fd3d66e2ce341296f0072, which reverted d913fb457b732da4c31d0d1b8c085989a7ecd12d, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was: This moves the final field that can vary from the inversion list data structure into the header of the SV that contains it. With this commit, the body of an inversion list is now const. The field is converted to a U8, to correspond with the header field in the SV type that we currently use to hold inversion lists.
* Reinstate "regcomp.c: Change, variable, fcn name"Karl Williamson2013-07-161-3/+3
| | | | | | | | | | | | | | | This reverts commit 0b58015e05b2ab93b080b7c49a70bf82435363c0, which reverted 875c4e2c5193b5245da578b222e9c93aad31d93b, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was (slightly revised for clarity): These have always been slightly misnamed, but a recent commit made them more so. The old name contained "zero", but now there is a new element which always has zero. The renamed element indicates whether the inversion list is offset, that is if the beginning is the zero element, or if the beginning is the next element beyond the zero element.
* Reinstate "regcomp.c: Move 2 hdr inversion fields to SV hdr"Karl Williamson2013-07-161-9/+5
| | | | | | | | | | | | | | This reverts commit 67434bafe4f2406e7c92e69013aecd446c896a9a, which reverted 4fdeca7844470c929f35857f49078db1fd124dbc, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was: This commit continues the process of separating the header area of inversion lists from the body. 2 more fields are moved out of the header portion of the inversion list, and into the header portion of the SV that contains it.
* Reinstate "regcomp.c: Make inversion lists SVt_PVLV"Karl Williamson2013-07-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit ac7a6f5849b5fd57b2e837f4ddbc18c992610e9c which reverted 2c3365de8c1168f115576a4976d067e3b911c490, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. This commit additionally changes some now-obsolete wording in a pod. This change was not in 2c3365de8c1168f115576a4976d067e3b911c490. The original message for commit 2c3365de8c1168f115576a4976d067e3b911c490 was: This is the 2nd step in separating the inversion list body from header. This commit gives inversion lists the header from a SVt_PVLV, and repurposes one of its fields into being the length of the inversion list. This is a temporary measure, in case binary compatibility is an issue. Future commits will create a new SV type just for inversion lists. This SV type was chosen because it has a sufficient number of fields to accommodate all the header fields from inversion lists.
* Reinstate + fix "Revert "regcomp.c: Add a constant 0 element before ↵Karl Williamson2013-07-161-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | inversion lists" " This reverts commit de353015643cf10b437d714d3483c1209e079916 which reverted 533c4e2f08b42d977e5004e823d4849f7473d2d0, thus reinstating it, plus this commit adds a fix to get it to pass under Address Sanitizer. The root cause of the problem is that there are two measures of the length of an inversion list. One is SvCUR(), and the other is invlist_len(). The original commit caused these to get off-by-one in some cases. The ultimate solution is to only store one value, and return the other one based off that. Rather than redo the whole branch, I've taken an easier way out, which is to add a dummy element at the end of some inversion lists, so that they aren't off-by-one. Then the other patches from the original branch will be applied. Each will be tested with Address Sanitizer. Then the work to fix the underlying problem will be done. The original commit's message was: This commit is the first step to separating the header from the body of inversion lists. Doing so will allow the compiled-in inversion lists to be fully read-only. To invert an inversion list, one simply unshifts a 0 to the front of it if one is not there, and shifts off the 0 if it does have one. The current data structure reserves an element at the beginning of each inversion list that is either 0 or 1. If 0, it means the inversion list begins there; if 1, it means the inversion list starts at the next element. Inverting involves flipping this bit. This commit changes the structure so that there is an additional element just after the element that flips. This new element is always 0, and the flipping element now says whether the inversion list begins at the constant 0 element, or the one after that. Doing this allows the flipping element to be separated in later commits from the body of the inversion list, which will always begin with the constant 0 element. That means that the body of the inversion list can be const.
* Revert "regcomp.c: Add a constant 0 element before inversion lists"Karl Williamson2013-07-041-11/+10
| | | | | | | This reverts commit 533c4e2f08b42d977e5004e823d4849f7473d2d0. This continues the backing out of this topic branch. A bisect shows that the first commit exhibiting an error is the first one in the branch.
* Revert "regcomp.c: Make inversion lists SVt_PVLV"Karl Williamson2013-07-041-2/+2
| | | | | | | This reverts commit 2c3365de8c1168f115576a4976d067e3b911c490. This continues the backing out of this topic branch. A bisect shows that the first commit exhibiting an error is the first one in the branch.
* Revert "regcomp.c: Move 2 hdr inversion fields to SV hdr"Karl Williamson2013-07-041-5/+9
| | | | | | | This reverts commit 4fdeca7844470c929f35857f49078db1fd124dbc. This continues the backing out of this topic branch. A bisect shows that the first commit exhibiting an error is the first one in the branch.
* Revert "regcomp.c: Change, variable, fcn name"Karl Williamson2013-07-041-3/+3
| | | | | | | This reverts commit 875c4e2c5193b5245da578b222e9c93aad31d93b. This continues the backing out of this topic branch. A bisect shows that the first commit exhibiting an error is the first one in the branch.
* Revert "regcomp.c: Move inversion list hdr field to SV hdr"Karl Williamson2013-07-041-1/+1
| | | | | | | This reverts commit d913fb457b732da4c31d0d1b8c085989a7ecd12d. This continues the backing out of this topic branch. A bisect shows that the first commit exhibiting an error is the first one in the branch.
* Revert "regcomp.c: Make C-array inversion lists const"Karl Williamson2013-07-041-1/+1
| | | | | | | This reverts commit 241136e0ed70738cccd6c4b20ce12b26231f30e5. This continues the backing out of this topic branch. A bisect shows that the first commit exhibiting an error is the first one in the branch.
* Revert "regcomp.c: Move some #defines to only file that uses them"Karl Williamson2013-07-041-0/+24
| | | | | | | | This reverts commit 05944450e0fc82eb8fc1fb5a4bf63f23785262a0. Blead won't compile with address sanitizer; commit 7cb47964955167736b2923b008cc8023a9b035e8 reverting an earlier commit failed to fix that. I'm trying two more reversions to get it back working. This is one of those
* Revert "Use new Svt_INVLIST for inversion lists."Karl Williamson2013-07-041-1/+1
| | | | | | This reverts commit e0ce103ae532f9576f54a5938a24d1ee98dfb928. This commit is failing compilations with address sanitizer, and we don't know why. This reverts it while we work that out.
* Use new Svt_INVLIST for inversion lists.Karl Williamson2013-07-031-1/+1
| | | | This converts inversion lists to use their own scalar type.
* regcomp.c: Move some #defines to only file that uses themKarl Williamson2013-07-031-24/+0
| | | | | | | | These were used in a header file to provide synchronization between files. However, the only other file that would need them is a .pl file which doesn't have access to them. So simplify things so that the variables are either removed entirely if only used in a single place, or are #defined in the area where they are used
* regcomp.c: Make C-array inversion lists constKarl Williamson2013-07-031-1/+1
| | | | The inversion lists that are compiled into a C header are now const.
* regcomp.c: Move inversion list hdr field to SV hdrKarl Williamson2013-07-031-1/+1
| | | | | | | | | This moves the final field that can vary from the inversion list data structure into the header of the SV that contains it. With this commit, the body of an inversion list is now const. The field is converted to a U8, to correspond with the header field in the SV type that we currently use to hold inversion lists.
* regcomp.c: Change, variable, fcn nameKarl Williamson2013-07-031-3/+3
| | | | | | | | These have always been slightly misnamed, but a recent commit made them more so. The old name contained "zero", but now there is a new element which always has zero. This element indicates whether the inversion list is offset, that is if the beginning is the zero element, or if the beginning is the next element beyond the zero element.
* regcomp.c: Move 2 hdr inversion fields to SV hdrKarl Williamson2013-07-031-9/+5
| | | | | | | This commit continues the process of separating the header area of inversion lists from the body. 2 more fields are moved out of the header portion of the inversion list, and into the header portion of the SV that contains it.
* regcomp.c: Make inversion lists SVt_PVLVKarl Williamson2013-07-031-2/+2
| | | | | | | | | | | | This is the 2nd step in separating the inversion list body from header. This commit gives inversion lists the header from a SVt_PVLV, and repurposes one of its fields into being the length of the inversion list. This is a temporary measure, in case binary compatibility is an issue. Future commits will create a new SV type just for inversion lists. This SV type was chosen because it has a sufficient number of fields to accommodate all the header fields from inversion lists.
* regcomp.c: Add a constant 0 element before inversion listsKarl Williamson2013-07-031-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | This commit is the first step to separating the header from the body of inversion lists. Doing so will allow the compiled-in inversion lists to be fully read-only. To invert an inversion list, one simply unshifts a 0 to the front of it if one is not there, and shifts off the 0 if it does have one. The current data structure reserves an element at the beginning of each inversion list that is either 0 or 1. If 0, it means the inversion list begins there; if 1, it means the inversion list starts at the next element. Inverting involves flipping this bit. This commit changes the structure so that there is an additional element just after the element that flips. This new element is always 0, and the flipping element now says whether the inversion list begins at the constant 0 element, or the one after that. Doing this allows the flipping element to be separated in later commits from the body of the inversion list, which will always begin with the constant 0 element. That means that the body of the inversion list can be const.
* inline_invlist.c, regcomp.c: Comments-onlys, white-spaceKarl Williamson2013-02-111-6/+1
| | | | | inline_invlist.c had comments that are from a different file. Update them. Also corrects the name in a #error line in regcomp.c
* Add caching to inversion list searchesKarl Williamson2012-08-251-3/+5
| | | | | | | Benchmarking showed some speed-up when the result of the previous search in an inversion list is cached, thus potentially avoiding a search in the next call. This adds a field to each inversion list which caches its previous search result.
* regcomp.c: Move functions to inline_invlist.cKarl Williamson2012-08-251-0/+64
| | | | | | This populates inline_invlist.c with some static inline functions and macro defines. These are the ones that are anticipated to be needed in the near term outside regcomp.c
* Add empty inline_invlist.cKarl Williamson2012-08-251-0/+16
This will be used for things need to handle inversion lists in the three files that currently use them. I'm putting this in a separate hdr, because inversion lists are very internal-only, so should not be grouped in with things that there is an external API for. It is a dot-c file so that the functions can continue to be declared with embed.fnc, and porting/args_assert.t will continue to work, as it looks only in .c files.