Hello all,

I have a custom impl. of V8 here (not node or chromium) and im trying to 
use the WebAssembly backend of V8.

Well its all good and working fine.. but i had to manually change the v8 
source i have here because theres some
bad allocation policy here pushing a impossible amount of memory to be 
allocated by the custom ArrayBufferAllocator.

I dont know if the problem its fixed already, but in case its not, here it 
goes: 

in wasm-js.cc::WebAssemblyMemory it figures 'int64_t initial' correctly 
and then calls wasm::NewArrayBuffer(...)

The 'problem' here is that 'i::FLAG_wasm_guard_pages' evaluates to true 
(and my 'fix' was forcing a false here)

on 'NewArrayBuffer'

> enable_guard_regions = enable_guard_regions && kGuardRegionsSupported; 
(evaluated to true)

(the real problem was here) -> TryAllocateBackingStore(.. 
enable_guard_regions ..);

on 'TryAllocateBackingStore'

if (enable_guard_regions && kGuardRegionsSupported) {
 ...
 isolate->array_buffer_allocator()->Reserve(allocation_length); <-- HERE: 
'allocation_lenght' asks for a impossible ammount of memory number.. 
 like 18 tb or 180 gb..
 
} else { // by forcing enable_guard_regions to false it goes here now, and 
the ammount to allocate is fine
  ... 
  isolate->array_buffer_allocator()->Allocate(size);
   // here 'size' is fine.. it evaluated to 16MB in my case with a '256' 
memory number on js side
}

Note: im my custom pipeline im using the sync versions wasm::SyncCompile 
and wasm::SyncInstantiate on the C side.. not using the js api.
I just hand back to js runtime the handle for the final instance

I dont know if this was already fixed, but i tought it worth warning the 
v8-dev team so you guys can handle accordingly.


-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to