The functions need real implementations. Opening an issue for tracking purposes.
Code references:
|
// TODO-LLVM: look for a WASI random function; investigate ICU and EnumCalendarInfo |
|
public static MethodIL ReplaceStubbedWasmMethods(MethodDesc method, MethodIL methodIL) |
|
{ |
|
// stubs for Unix calls which are not available to this target yet |
|
if ((method.OwningType as EcmaType)?.Name == "Interop" && method.Name == "GetRandomBytes") |
|
{ |
|
// this would normally fill the buffer parameter, but we'll just leave the buffer as is and that will be our "random" data for now |
|
return new ILStubMethodIL(method, new byte[] { (byte)ILOpcode.ret }, Array.Empty<LocalVariableDefinition>(), null); |
|
} |
|
if ((method.OwningType as EcmaType)?.Name == "CalendarData" && method.Name == "EnumCalendarInfo") |
|
{ |
|
// just return false |
|
return new ILStubMethodIL(method, new byte[] { (byte)ILOpcode.ldc_i4_0, (byte)ILOpcode.ret }, Array.Empty<LocalVariableDefinition>(), null); |
|
} |
|
|
|
return methodIL; |
|
} |
|
// mono does this via Javascript (pal_random.js), but prefer not to introduce that dependency as it limits the ability to run out of the browser. |
|
// Copy the temporary workaround from the IL->LLVM generator for now. |
|
if (!strcmp(mangledName, "S_P_CoreLib_Interop__GetRandomBytes")) |
|
{ |
|
// this would normally fill the buffer parameter, but we'll just leave the buffer as is and that will be our "random" data for now |
|
llvm::BasicBlock* llvmBlock = llvm::BasicBlock::Create(_llvmContext, "", _function); |
|
_builder.SetInsertPoint(llvmBlock); |
|
_builder.CreateRetVoid(); |
|
return; |
|
} |