-
Notifications
You must be signed in to change notification settings - Fork 489
remove lua.h dependency from vtableinterpose.h #5628
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,11 +33,9 @@ distribution. | |
| #include <unordered_map> | ||
| #include <variant> | ||
| #include <vector> | ||
| #include <variant> | ||
| #include <filesystem> | ||
|
|
||
| #include "DataDefs.h" | ||
| #include "LuaWrapper.h" | ||
|
|
||
| namespace std { | ||
| class condition_variable; | ||
|
|
@@ -393,6 +391,10 @@ namespace df | |
| }; | ||
| #endif | ||
|
|
||
| type_identity* lua_touserdata_(lua_State* state); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are the trailing underscores necessary? can we not just fully-qualify the names when needed (or would that require changing too many places)?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are forwarding functions (intended for the real
I don't think they're necessary? |
||
| void* get_object_internal_(lua_State* state, type_identity*, int val_index, bool); | ||
| [[noreturn]] void field_error_(lua_State *state, int index, const char* err, const char* mode); | ||
|
|
||
| template<class T> | ||
| class stl_container_identity : public container_identity { | ||
| const char *name; | ||
|
|
@@ -424,8 +426,8 @@ namespace df | |
| { | ||
| using VT = typename T::value_type; | ||
| VT tmp{}; | ||
| auto id = (type_identity*)lua_touserdata(state, DFHack::LuaWrapper::UPVAL_ITEM_ID); | ||
| auto pitem = DFHack::LuaWrapper::get_object_internal(state, id, val_index, false); | ||
| auto id = lua_touserdata_(state); | ||
| auto pitem = get_object_internal_(state, id, val_index, false); | ||
| bool useTemporary = (!pitem && id->isPrimitive()); | ||
|
|
||
| if (useTemporary) | ||
|
|
@@ -435,7 +437,7 @@ namespace df | |
| } | ||
|
|
||
| if (id != item || !pitem) | ||
| DFHack::LuaWrapper::field_error(state, fname_idx, "incompatible object type", "insert"); | ||
| field_error_(state, fname_idx, "incompatible object type", "insert"); | ||
|
|
||
| return insert(ptr, idx, pitem); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These introduce potential pessimizations by preventing the compiler from inlining these at their call sites. Since at least two of these functions are used in potentially high-velocity code paths, I'm reluctant to approve this without runtime profiling
that said, i just tested dfhack compiled with LTCG and it seems to work on Windows, which would obviate this concern if we can confirm that using LTCG doesn't break dfhack, and someone can figure out how to do the same thing for linux users