-
Notifications
You must be signed in to change notification settings - Fork 215
Closed
Labels
area-NativeAOT-LLVMLLVM generation for Native AOT compilation (including Web Assembly)LLVM generation for Native AOT compilation (including Web Assembly)
Description
The functions need real implementations. Opening an issue for tracking purposes.
Code references:
runtimelab/src/coreclr/tools/Common/TypeSystem/IL/ILImporter.cs
Lines 953 to 969 in 8284a6d
| // 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; | |
| } |
runtimelab/src/coreclr/jit/llvmcodegen.cpp
Lines 23 to 32 in 8284a6d
| // 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; | |
| } |
Metadata
Metadata
Assignees
Labels
area-NativeAOT-LLVMLLVM generation for Native AOT compilation (including Web Assembly)LLVM generation for Native AOT compilation (including Web Assembly)