by mraleph · 12y ago · 0 comments
Truly efficient FFI has to be part of the VM, you can't implement efficient FFI from outside.
> - I access data (by physical address) allocated externally
Do you really mean "physical address" here?
External data is created precisely to efficiently access data allocated externally, because it allows direct raw access to a given region of memory (sans bounds checking).
>> External data is created precisely to efficiently access data allocated externally, because it allows direct raw access to a given region of memory (sans bounds checking).
Serach in code "Unsafe." and you understand what means "physical address" as a base and offset.
Eg.
Unsafe.memorySet(base, offset, 0, size);
Unsafe.memoryAllocate(size);
Unsafe.writeInt8(base, offset, value);
https://gist.github.com/mezoni/f85b04bf19dab8333abfEvil of the "Truly efficient FFI" in that the it in many cases does not exists as such.
Benefit of "NOT Truly efficient FFI" in that the it in many cases it may be considered as acceptable in many cases (and exist in reality).
>> Do you really mean "physical address" here?
See here.