remove allocator and switch to immutable value boxing#22
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request removes the custom memory allocator and related preloading logic for Lua number and integer values, simplifying the codebase and reducing complexity. All references to the allocator have been removed, and number/integer boxing is now handled by straightforward helper functions. The registry and state management code have been updated to reflect this change, and related tests and benchmarks have been refactored accordingly.
Reduction of actor size. Avg actor size is ~7kb.
Key changes include:
Removal of custom allocator and preloading logic
allocatortype and all related functions, including preloading arrays and memory management logic inalloc.go. ([alloc.goL1-L97](https://github.com/wippyai/go-lua/pull/22/files#diff-e85db5abe063d800fbae17d8fbc529bf6298f99072e56be699b1cce9a5d7a582L1-L97))alloc_test.go. ([alloc_test.goL1-L217](https://github.com/wippyai/go-lua/pull/22/files#diff-dd924401d7e62c7a20c3d67b474354f13e5411e198d8363ad7b3d6db06e83478L1-L217))Refactoring of registry and value boxing
registrystruct and its constructor inregistry.goto remove the allocator field and parameter. All number/integer boxing now uses helper functions instead of the allocator. ([[1]](https://github.com/wippyai/go-lua/pull/22/files#diff-638576cf5913c90c8eb77dadc04e6834ec3061ae4873d3ed7eeca0a2908a1c63L13-R17),[[2]](https://github.com/wippyai/go-lua/pull/22/files#diff-638576cf5913c90c8eb77dadc04e6834ec3061ae4873d3ed7eeca0a2908a1c63L269-R268))[[1]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L17-R17),[[2]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L54-R53),[[3]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L83-R81),[[4]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L104-R101),[[5]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L126-R122),[[6]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L150-R145),[[7]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L179-R173),[[8]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L203-R196),[[9]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L228-R220),[[10]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L252-R245),[[11]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L269-R259),[[12]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L284-R273),[[13]](https://github.com/wippyai/go-lua/pull/22/files#diff-edb24508617964ec78bbd08114140588702e64b9d1f8fce9540cf3162f0c38f3L298-R286))Updates to state management
LStateinitialization and pooling logic instate.go, including the removal of allocator resets and constructor arguments. ([[1]](https://github.com/wippyai/go-lua/pull/22/files#diff-320959764bfa2277e0bdd4eaa741f02891d123c42150d4ccb76de0bdbf6e591aL448-R449),[[2]](https://github.com/wippyai/go-lua/pull/22/files#diff-320959764bfa2277e0bdd4eaa741f02891d123c42150d4ccb76de0bdbf6e591aL464-R471),[[3]](https://github.com/wippyai/go-lua/pull/22/files#diff-320959764bfa2277e0bdd4eaa741f02891d123c42150d4ccb76de0bdbf6e591aL497),[[4]](https://github.com/wippyai/go-lua/pull/22/files#diff-320959764bfa2277e0bdd4eaa741f02891d123c42150d4ccb76de0bdbf6e591aL506),[[5]](https://github.com/wippyai/go-lua/pull/22/files#diff-320959764bfa2277e0bdd4eaa741f02891d123c42150d4ccb76de0bdbf6e591aL519-R512),[[6]](https://github.com/wippyai/go-lua/pull/22/files#diff-320959764bfa2277e0bdd4eaa741f02891d123c42150d4ccb76de0bdbf6e591aL1426-R1419))Refactoring of integer boxing in tests
integer_test.goto use the new helper function instead of the allocator. ([[1]](https://github.com/wippyai/go-lua/pull/22/files#diff-b25f7f3eeaa5c29ba9b293a2901dcd671fa7df412c4ef4faf107110c1310b30fL33-R35),[[2]](https://github.com/wippyai/go-lua/pull/22/files#diff-b25f7f3eeaa5c29ba9b293a2901dcd671fa7df412c4ef4faf107110c1310b30fL48-R49))