1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 23:42:43 +01:00

Use Value::misc to store strings

This allows strings < 23 characters (up from 16) to be stored directly
in Value. On a NixOS 19.03 system configuration evaluation, this
allows 1060588 out of 1189295 (89%) strings to be stored in Value.
This commit is contained in:
Eelco Dolstra 2019-04-23 12:54:12 +02:00
parent 742a8046de
commit a38a7b495c
4 changed files with 25 additions and 12 deletions

View file

@ -51,17 +51,16 @@ struct Object
friend class GC;
public:
constexpr static unsigned int miscBits = 58;
private:
unsigned long misc:58;
constexpr static size_t miscBytes = 7;
public: // FIXME
Tag type:5;
Tag type:7;
private:
bool marked:1;
unsigned long misc:56;
void unmark()
{
marked = false;
@ -69,7 +68,7 @@ private:
protected:
Object(Tag type, unsigned long misc) : misc(misc), type(type), marked(false) { }
Object(Tag type, unsigned long misc) : type(type), marked(false), misc(misc) { }
bool isMarked()
{
@ -90,6 +89,11 @@ protected:
{
return misc;
}
char * getMiscData() const
{
return ((char *) this) + 1;
}
};
template<class T>