虚幻4 蓝图被编译成的蓝图汇编代码

xiaoxiao2021-02-28  73

\Engine\Source\Editor\KismetCompiler\Public\BlueprintCompiledStatement.h

// // FBlueprintCompiledStatement enum EKismetCompiledStatementType { KCST_Nop = 0, KCST_CallFunction = 1, // [wiring =] TargetObject->FunctionToCall(wiring) KCST_Assignment = 2, // TargetObject->TargetProperty = [wiring] KCST_CompileError = 3, // One of the other types with a compilation error during statement generation KCST_UnconditionalGoto = 4, // goto TargetLabel KCST_PushState = 5, // FlowStack.Push(TargetLabel) KCST_GotoIfNot = 6, // [if (!TargetObject->TargetProperty)] goto TargetLabel KCST_Return = 7, // return TargetObject->TargetProperty KCST_EndOfThread = 8, // if (FlowStack.Num()) { NextState = FlowStack.Pop; } else { return; } KCST_Comment = 9, // /* Comment */ KCST_ComputedGoto = 10, // NextState = LHS; KCST_EndOfThreadIfNot = 11, // [if (!TargetObject->TargetProperty)] { same as KCST_EndOfThread; } KCST_DebugSite = 12, // NOP with recorded address KCST_CastObjToInterface = 13, // TargetInterface(TargetObject) KCST_DynamicCast = 14, // Cast<TargetClass>(TargetObject) KCST_ObjectToBool = 15, // (TargetObject != None) KCST_AddMulticastDelegate = 16, // TargetDelegate->Add(EventDelegate) KCST_ClearMulticastDelegate = 17, // TargetDelegate->Clear() KCST_WireTraceSite = 18, // NOP with recorded address (never a step target) KCST_BindDelegate = 19, // Creates simple delegate KCST_RemoveMulticastDelegate = 20, // TargetDelegate->Remove(EventDelegate) KCST_CallDelegate = 21, // TargetDelegate->Broadcast(...) KCST_CreateArray = 22, // Creates and sets an array literal term KCST_CrossInterfaceCast = 23, // TargetInterface(Interface) KCST_MetaCast = 24, // Cast<TargetClass>(TargetObject) KCST_AssignmentOnPersistentFrame = 25, // KCST_CastInterfaceToObj = 26, // Cast<TargetClass>(TargetInterface) KCST_GotoReturn = 27, // goto ReturnLabel KCST_GotoReturnIfNot = 28, // [if (!TargetObject->TargetProperty)] goto TargetLabel KCST_SwitchValue = 29, // Kismet instrumentation extensions KCST_InstrumentedPureNodeEntry, // Instrumented pure node entry KCST_InstrumentedWireEntry, // Instrumented wiretrace entry KCST_InstrumentedWireExit, // Instrumented wiretrace exit KCST_InstrumentedStatePush, // Instrumented state push KCST_InstrumentedStateRestore, // Instrumented state restore KCST_InstrumentedStateReset, // Instrumented state reset KCST_InstrumentedStateSuspend, // Instrumented state suspend KCST_InstrumentedStatePop, // Instrumented state pop // KCST_ArrayGetByRef, };

C++最后编译为汇编,蓝图最后编译的字节码  可以叫 蓝图汇编,所有的功能编译为下面的这个枚举所列举的功能。

\Engine\Source\Runtime\CoreUObject\Public\UObject\Script.h

使用

IMPLEMENT_VM_FUNCTION

宏在解释函数数组中填充函数,然后编译完成的字节码直接作为下标,在函数数组中取出函数执行。

// // Evaluatable expression item types. // enum EExprToken { // Variable references. EX_LocalVariable = 0x00, // A local variable. EX_InstanceVariable = 0x01, // An object variable. EX_DefaultVariable = 0x02, // Default variable for a class context. // = 0x03, EX_Return = 0x04, // Return from function. // = 0x05, EX_Jump = 0x06, // Goto a local address in code. EX_JumpIfNot = 0x07, // Goto if not expression. // = 0x08, EX_Assert = 0x09, // Assertion. // = 0x0A, EX_Nothing = 0x0B, // No operation. // = 0x0C, // = 0x0D, // = 0x0E, EX_Let = 0x0F, // Assign an arbitrary size value to a variable. // = 0x10, // = 0x11, EX_ClassContext = 0x12, // Class default object context. EX_MetaCast = 0x13, // Metaclass cast. EX_LetBool = 0x14, // Let boolean variable. EX_EndParmValue = 0x15, // end of default value for optional function parameter EX_EndFunctionParms = 0x16, // End of function call parameters. EX_Self = 0x17, // Self object. EX_Skip = 0x18, // Skippable expression. EX_Context = 0x19, // Call a function through an object context. EX_Context_FailSilent = 0x1A, // Call a function through an object context (can fail silently if the context is NULL; only generated for functions that don't have output or return values). EX_VirtualFunction = 0x1B, // A function call with parameters. EX_FinalFunction = 0x1C, // A prebound function call with parameters. EX_IntConst = 0x1D, // Int constant. EX_FloatConst = 0x1E, // Floating point constant. EX_StringConst = 0x1F, // String constant. EX_ObjectConst = 0x20, // An object constant. EX_NameConst = 0x21, // A name constant. EX_RotationConst = 0x22, // A rotation constant. EX_VectorConst = 0x23, // A vector constant. EX_ByteConst = 0x24, // A byte constant. EX_IntZero = 0x25, // Zero. EX_IntOne = 0x26, // One. EX_True = 0x27, // Bool True. EX_False = 0x28, // Bool False. EX_TextConst = 0x29, // FText constant EX_NoObject = 0x2A, // NoObject. EX_TransformConst = 0x2B, // A transform constant EX_IntConstByte = 0x2C, // Int constant that requires 1 byte. EX_NoInterface = 0x2D, // A null interface (similar to EX_NoObject, but for interfaces) EX_DynamicCast = 0x2E, // Safe dynamic class casting. EX_StructConst = 0x2F, // An arbitrary UStruct constant EX_EndStructConst = 0x30, // End of UStruct constant EX_SetArray = 0x31, // Set the value of arbitrary array EX_EndArray = 0x32, // = 0x33, EX_UnicodeStringConst = 0x34, // Unicode string constant. EX_Int64Const = 0x35, // 64-bit integer constant. EX_UInt64Const = 0x36, // 64-bit unsigned integer constant. // = 0x37, EX_PrimitiveCast = 0x38, // A casting operator for primitives which reads the type as the subsequent byte // = 0x39, // = 0x3A, // = 0x3B, // = 0x3C, // = 0x3D, // = 0x3E, // = 0x3F, // = 0x40, // = 0x41, EX_StructMemberContext = 0x42, // Context expression to address a property within a struct EX_LetMulticastDelegate = 0x43, // Assignment to a multi-cast delegate EX_LetDelegate = 0x44, // Assignment to a delegate // = 0x45, // = 0x46, // CST_ObjectToInterface // = 0x47, // CST_ObjectToBool EX_LocalOutVariable = 0x48, // local out (pass by reference) function parameter // = 0x49, // CST_InterfaceToBool EX_DeprecatedOp4A = 0x4A, EX_InstanceDelegate = 0x4B, // const reference to a delegate or normal function object EX_PushExecutionFlow = 0x4C, // push an address on to the execution flow stack for future execution when a EX_PopExecutionFlow is executed. Execution continues on normally and doesn't change to the pushed address. EX_PopExecutionFlow = 0x4D, // continue execution at the last address previously pushed onto the execution flow stack. EX_ComputedJump = 0x4E, // Goto a local address in code, specified by an integer value. EX_PopExecutionFlowIfNot = 0x4F, // continue execution at the last address previously pushed onto the execution flow stack, if the condition is not true. EX_Breakpoint = 0x50, // Breakpoint. Only observed in the editor, otherwise it behaves like EX_Nothing. EX_InterfaceContext = 0x51, // Call a function through a native interface variable EX_ObjToInterfaceCast = 0x52, // Converting an object reference to native interface variable EX_EndOfScript = 0x53, // Last byte in script code EX_CrossInterfaceCast = 0x54, // Converting an interface variable reference to native interface variable EX_InterfaceToObjCast = 0x55, // Converting an interface variable reference to an object // = 0x56, // = 0x57, // = 0x58, // = 0x59, EX_WireTracepoint = 0x5A, // Trace point. Only observed in the editor, otherwise it behaves like EX_Nothing. EX_SkipOffsetConst = 0x5B, // A CodeSizeSkipOffset constant EX_AddMulticastDelegate = 0x5C, // Adds a delegate to a multicast delegate's targets EX_ClearMulticastDelegate = 0x5D, // Clears all delegates in a multicast target EX_Tracepoint = 0x5E, // Trace point. Only observed in the editor, otherwise it behaves like EX_Nothing. EX_LetObj = 0x5F, // assign to any object ref pointer EX_LetWeakObjPtr = 0x60, // assign to a weak object pointer EX_BindDelegate = 0x61, // bind object and name to delegate EX_RemoveMulticastDelegate = 0x62, // Remove a delegate from a multicast delegate's targets EX_CallMulticastDelegate = 0x63, // Call multicast delegate EX_LetValueOnPersistentFrame = 0x64, EX_ArrayConst = 0x65, EX_EndArrayConst = 0x66, EX_AssetConst = 0x67, EX_CallMath = 0x68, // static pure function from on local call space EX_SwitchValue = 0x69, EX_InstrumentationEvent = 0x6A, // Instrumentation event EX_ArrayGetByRef = 0x6B, EX_Max = 0x100, };

转载请注明原文地址: https://www.6miu.com/read-53098.html

最新回复(0)