Page MenuHomePhabricator

Enable context creation in preallocated memory
ClosedPublic

Authored by deadalnix on Jan 20 2020, 23:39.

Details

Summary
  • Prepare for manual memory management in preallocated memory
    • Determine ALIGNMENT more cleverly and move it to util.h
    • Implement manual_malloc() helper function
  • Add size constants for preallocated memory
  • Switch to a single malloc call
  • Support cloning a context into preallocated memory
  • Check arguments of _preallocated functions
  • Add tests for contexts in preallocated memory
  • Export _preallocated functions
  • Move _preallocated functions to separate header
  • Explain caller's obligations for preallocated memory

This is a backport of secp256k1 PR566

Depends on D5030

Test Plan
ninja check-secp256k1

Diff Detail

Repository
rABC Bitcoin ABC
Branch
secppr566
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 9104
Build 16169: Default Diff Build & Tests
Build 16168: arc lint + arc unit

Event Timeline

Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/secp256k1/include/secp256k1_preallocated.h
17 ↗(On Diff #15695)

excepts => accepts ?

src/secp256k1/src/tests.c
203 ↗(On Diff #15695)

I know it's just like the PR, but really this code is horrible to read...

This revision is now accepted and ready to land.Jan 21 2020, 16:46
src/secp256k1/src/tests.c
203 ↗(On Diff #15695)

Yes, 100%

src/secp256k1/include/secp256k1_preallocated.h
17 ↗(On Diff #15695)

Maybe expects ?

This revision was landed with ongoing or failed builds.Jan 22 2020, 15:25
This revision was automatically updated to reflect the committed changes.