Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

HvSTATIC #111

Closed
rurban opened this issue Mar 19, 2016 · 1 comment
Closed

HvSTATIC #111

rurban opened this issue Mar 19, 2016 · 1 comment

Comments

@rurban
Copy link
Member

rurban commented Mar 19, 2016

See #62 AvSTATIC. Do it for hashes analog to static arrays:

Add a HvSTATIC bit for the alloc ptrs, to protect them from free on scope exit, and global destruction.

This allows the compiler to statically allocate the HvARRAY array, and add COW or COG (copy-on-write, copy-on-grow)

We have 3 options in the compiler:

COW: put the static SV** array as const into the .rodata segment. writes trigger cow, set SVf_READONLY and HvSTATIC flags
COG: put the static SV** array not as const into the .data segment. writes are ok, extends trigger cow. HvSTATIC flag only.
no static SV** array, dynamic alloc in the compiler init, (preferably with ptmalloc3 _independent_comalloc and -fav-init2), no cow. no SVf_READONLY, no HvSTATIC.

One compiler branch already does this (cowbanga_remake).
Problems with HvSTATIC overall:
A hash specific seed needs to be baked into every static hash. If not, using a global compiled seed, we need a Hash flood prevention scheme, which is not doable for a compiler with perl5 upstream. Or only with insecure not public-facing binaries or JSON.

For the hash problem easiest would be to add a fast hv_insert() API to add a static HEK and value to a dynamic bucket, at the top, ignoring any special cases, like magic, lvalue, ...

@rurban
Copy link
Member Author

rurban commented May 4, 2017

Added with cd229dd to v5.22.2c

@rurban rurban closed this as completed May 4, 2017
@ghost ghost removed the ready label May 4, 2017
rurban added a commit that referenced this issue Aug 27, 2018
4.06 2018-08-22 (rurban)
        - Fix overloaded eq/ne comparisons (GH #116 by demerphq, GH #117 by Graham Knopp):
          detect strings, protect from endless recursion. false is now ne "True".
          clarify eq/ne rules in the docs.

4.05 2018-08-19 (rurban)
        - Set decoded type (PR #115 by Pali)
        - Add json_type_weaken (PR #114 by Pali)
        - Fix tests for 5.6 (rurban, pali)

4.04 2018-06-22 (rurban)
        - Fix bignum NaN/inf handling (#78 reported by Slaven Rezic)
        - Move author tests to xt/ as suggested in #106, added a make xtest target.
          Fixes a test fail with ASAN.

4.03 2018-06-21 (rurban)
        - Add sereal cpanel_json_xs type (#110 James Rouzier)
        - Fix bencode/bdecode methods in cpanel_json_xs (#111 Fulvio Scapin)
        - Overload ne operator for JSON::PP::Boolean (#107 tevfik1903)
        - Add a missing semicolon to a documentation example (#104 E. Choroba)

4.02 2018-02-27 (rurban)
        - Add encoder indent_length method (#103 rouzier), previously
          hard-coded to 3.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant