[WIP/RFC] Pointer indirection #196

Merged
pks-t merged 15 commits from pointer-indirection into master 2015-05-30 15:23:23 -05:00

15 Commits

Author SHA1 Message Date
Patrick Steinhardt e8531dd5c3 diff: only untrack notify payload when it is set 2015-05-22 10:01:50 +02:00
Patrick Steinhardt c43afaf9c4 tree: use correct C callback signature 2015-05-22 09:56:21 +02:00
Patrick Steinhardt 1bd338af5e handles: do not store handles by uintptr
If we store values by uintptrs the GC may try to inspect their
values when it kicks in. As the pointers are most likely invalid,
this will result in an invalid pointer dereference, causing the
program to panic. We can fix this by storing values by an int
index value instead, returning pointers to those indices as
handles instead.
2015-05-22 09:50:16 +02:00
Patrick Steinhardt d95932c84a handles: panic when we cannot retrieve handle data 2015-05-22 09:02:39 +02:00
Patrick Steinhardt a843b7247f packbuilder: use HandleList for C function callbacks. 2015-05-22 09:02:24 +02:00
Patrick Steinhardt 83f9e6a705 blob: use HandleList for C function callbacks. 2015-05-22 09:02:24 +02:00
Patrick Steinhardt fe902f56a8 diff: use HandleList for C function callbacks. 2015-05-22 09:02:24 +02:00
Patrick Steinhardt 7ee534d0c5 handles: print pointer handle on panic. 2015-05-22 09:02:24 +02:00
Patrick Steinhardt e919653755 odb: use HandleList for C function callbacks. 2015-05-22 09:02:24 +02:00
Patrick Steinhardt 9bbec34885 index: use HandleList for C function callbacks. 2015-05-22 09:02:24 +02:00
Patrick Steinhardt 0a336e4abd handles: start slot indices with 1
Using 0 as the first slot indice leads to not being able to
differentiate between a handle to the first element or a
NULL-handle. As current code may check whether the pointer is
NULL, change the first indice to be 1 instead.
2015-05-22 09:02:24 +02:00
Patrick Steinhardt de45a4b8ed submodule: use HandleList for C function callbacks 2015-05-22 09:02:24 +02:00
Patrick Steinhardt be3a626f2e tree: use HandleList for C function callbacks. 2015-05-22 09:02:24 +02:00
Patrick Steinhardt bde012f3d4 handles: correctly initialize all members 2015-05-22 09:02:24 +02:00
Carlos Martín Nieto 7750e85fd1 Introduce an indirection layer for pointers
As the Go runtime can move stacks at any point and the C code runs
concurrently with the rest of the system, we cannot assume that the
payloads we give to the C code will stay valid for any particular
duration.

We must therefore give the C code handles which we can then look up in
our own list when the callbacks get called.
2015-05-22 09:02:24 +02:00