Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] add kbtree_t and use it for bufhl #5266

Merged
merged 8 commits into from Jun 24, 2017
Merged

[RFC] add kbtree_t and use it for bufhl #5266

merged 8 commits into from Jun 24, 2017

Conversation

bfredl
Copy link
Member

@bfredl bfredl commented Aug 28, 2016

As discussed in #5031 this is a separate for PR to cleanup and integrate kbtree_t. Also use it for bufhl to get some coverage. Fixed compiler warnings (though the const warnings might have a better solution than remove const everywhere, I removed them for now as make output is impossible to parse otherwise), though remaining style issues.

@timeyyy for extmark there is two things to note:

The "eliminate unneccesary heap allocation" commit does that. kbtree_t is a zero/calloc-initializable struct just like kvec_t. The changes for extmark is hopefully analogous to the bufhl changes in the same commit. (include the struct directly in buf_T, no explicit initialization needed, kbtree functions need an extra &)

bufhl_mark_adjust shows a way to handle :move (only operation where marks can switch order, currently)

@marvim marvim added the WIP label Aug 28, 2016
@timeyyy
Copy link
Contributor

timeyyy commented Oct 23, 2016

I want to start using the work here, how should i go about incorporating it into my pull request? should i cherry pick the commits ? That would produce the most straight forward commit history. Otherwise if this gets merged into master i can rebase?

@bfredl
Copy link
Member Author

bfredl commented Oct 24, 2016

You can cherry-pick commits. Later when this is merged, and you rebase this, git will silently drop those commits and if it doesn't, you should be able to silently ignore the conflicts (as long as you don't add separate new changes to kb_tree.h)

I hope to look into this again soon after the 0.1.6 release, first I need to focus on some api versioning work needed for/after 0.1.6 release.

@@ -0,0 +1,396 @@
#ifndef __AC_KBTREE_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the lawyer but it looks illegal to use this source code without the original copyright. For example khash.h, klist.h and kvec.h have their respective copyrights.

Copy link
Member Author

@bfredl bfredl Nov 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, thanks. I will fix it in the next rebase. Fixed

@timeyyy
Copy link
Contributor

timeyyy commented Jan 18, 2017

Can we merge this? It's working well for me. We have a few todo such as kb_itr_interval but we can leave that for the future. I have added the license back in the extmarks branch so it will be included.

@justinmk
Copy link
Member

This is still marked WIP and needs at least a rebase with the license change, plus an OK from @bfredl ...

@bfredl
Copy link
Member Author

bfredl commented Mar 4, 2017

Sorry for the delay, I've been away from all development due to illness. This should be mostly done, I hope to fix the rebase and mark it ready "soon".

@timeyyy
Copy link
Contributor

timeyyy commented Mar 4, 2017

sorry to hear about the illness, are you back on your feet now? we missed you buddy ^^

@bfredl bfredl force-pushed the kbtree branch 8 times, most recently from 45143eb to 41c3e0b Compare March 14, 2017 13:52
@bfredl
Copy link
Member Author

bfredl commented Mar 14, 2017

rebased and fixed some style issues and a memory leak.

@bfredl bfredl changed the title [WIP] Kbtree_t [RFC] add kbtree_t and use it for bufhl Mar 14, 2017
@marvim marvim added RFC and removed WIP labels Mar 14, 2017
@timeyyy
Copy link
Contributor

timeyyy commented Mar 14, 2017

will i have to apply the same fix to extended marks? If so could you mark it.


/* The following is *DEPRECATED*!!! Use the iterator interface instead! */

#if 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, guess we should remove it, as we've refactored the library anyway.

@bfredl
Copy link
Member Author

bfredl commented Mar 14, 2017

@timeyyy in extmark_free_all you will need to call kb_init and kv_init after the destroy methods just like in bufhl_clear_all, otherwise a use-after-free if a buffer is deleted and then revived.

@justinmk
Copy link
Member

Would it be worth porting https://github.com/attractivechaos/klib/blob/master/test/kbtree_test.c to a lua unit test?

@bfredl
Copy link
Member Author

bfredl commented Mar 14, 2017

That looks more like a benchmark than a unit test?

@timeyyy
Copy link
Contributor

timeyyy commented Mar 14, 2017

@bfredl what do you mean by revived? did the error only happen after using :move ?

@bfredl bfredl force-pushed the kbtree branch 2 times, most recently from 50d63ff to 36748da Compare June 13, 2017 06:14
@bfredl
Copy link
Member Author

bfredl commented Jun 13, 2017

Hmm, I have no changes in deps. Some hidden depenency on branch name, PR number or commit metadata?

@justinmk
Copy link
Member

justinmk commented Jun 13, 2017

The recent upgrade of luarocks is most likely the reason.

Cleared travis cache and restarted build.

@bfredl
Copy link
Member Author

bfredl commented Jun 14, 2017

I had no idea Travis cached things indefinitely per PR...

@justinmk
Copy link
Member

The failed travis build isn't related to this PR, it detected a loop_close hang. The QB failure also is known/unrelated.

@Shougo
Copy link
Contributor

Shougo commented Jun 21, 2017

This feature is ready to merge?
It is needed by #5031.

@bfredl
Copy link
Member Author

bfredl commented Jun 21, 2017

Let's make at least most of the travis builds pass again. (I given up the hope of seeing a green build anytime soon).

@bfredl
Copy link
Member Author

bfredl commented Jun 21, 2017

The qb release build complains:

02:37:23,120 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/bufhl_defs.h: In function ‘kb_del_itr_bufhl’:
02:37:23,120 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/lib/kbtree.h:238:28: error: array subscript is below array bounds [-Werror=array-bounds]
02:37:23,120 WARN  - kp = __KB_KEY(key_t, x)[i]; \
02:37:23,120 WARN  - ^

At least the first one is clearly wrong, which makes me suspect all are. Can -Werror=array-bounds be turned off for a segment of code?

@justinmk
Copy link
Member

could use a pragma, we're doing that in at least assert.h, I also temporarily used it here though that was later replaced.

@bfredl
Copy link
Member Author

bfredl commented Jun 23, 2017

Compiles cleanly now everywhere.

@justinmk Are you planning to release 0.2.1 soon-ish? Then maybe this should wait, would be best to be used a bit on master before shipped in a release.

@Shougo
Copy link
Contributor

Shougo commented Jun 23, 2017

@bfredl
Copy link
Member Author

bfredl commented Jun 23, 2017

@Shougo IIRC for "patch" level releases, they don't need to cover everything in a milestone, they just need to be a stable enough point with some new features/bug fixes. Rather the milestone will just be renamed to 0.2.2, which as you see don't exist yet.

@Shougo
Copy link
Contributor

Shougo commented Jun 23, 2017

OK.

@justinmk
Copy link
Member

When TUI settles down 0.2.1 is probably a good idea. Soon I hope.

@bfredl
Copy link
Member Author

bfredl commented Jun 24, 2017

Sound that will take a while. Let's merge this, if tests passes once more...

@bfredl bfredl merged commit ca385db into neovim:master Jun 24, 2017
@jszakmeister jszakmeister removed the RFC label Jun 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants