/// <summary> /// Replaces the intrinsic call site /// </summary> /// <param name="context">The context.</param> /// <param name="methodCompiler">The method compiler.</param> /// <exception cref="InvalidCompilerException"></exception> void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler) { const InstructionSize size = InstructionSize.Size64; BaseIRInstruction instruction = IRInstruction.LoadZeroExtended; if (methodCompiler.Architecture.NativeIntegerSize == 64) { instruction = IRInstruction.LoadInteger; } if (context.OperandCount == 1) { context.SetInstruction(IRInstruction.LoadZeroExtended, size, context.Result, context.Operand1, methodCompiler.ConstantZero); } else if (context.OperandCount == 2) { context.SetInstruction(IRInstruction.LoadZeroExtended, size, context.Result, context.Operand1, context.Operand2); } else { throw new InvalidCompilerException(); } LoadStore.OrderLoadOperands(context.Node, methodCompiler); }
/// <summary> /// Replaces the intrinsic call site /// </summary> /// <param name="context">The context.</param> /// <param name="methodCompiler">The method compiler.</param> /// <exception cref="CompilerException"></exception> void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, MethodCompiler methodCompiler) { if (context.OperandCount == 2) { var instruction = !context.Operand2.Is64BitInteger ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64; if (context.Operand2.IsR4) instruction = IRInstruction.StoreFloatR4; else if (context.Operand2.IsR8) instruction = IRInstruction.StoreFloatR8; context.SetInstruction(instruction, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2); } else if (context.OperandCount == 3) { var instruction = !context.Operand3.Is64BitInteger ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64; if (context.Operand3.IsR4) instruction = IRInstruction.StoreFloatR4; else if (context.Operand3.IsR8) instruction = IRInstruction.StoreFloatR8; context.SetInstruction(instruction, null, context.Operand1, context.Operand2, context.Operand3); } else { throw new CompilerException(); } LoadStore.OrderStoreOperands(context.Node, methodCompiler); }
/// <summary> /// Visitation function for LoadZeroExtended instruction. /// </summary> /// <param name="node">The node.</param> private void LoadZeroExtended(InstructionNode node) { Debug.Assert(node.Size == InstructionSize.Size8 || node.Size == InstructionSize.Size16); LoadStore.OrderLoadOperands(node, MethodCompiler); node.SetInstruction(X86.MovzxLoad, node.Size, node.Result, node.Operand1, node.Operand2); }
private void LoadZeroExtend8x32(Context context) { Debug.Assert(!context.Result.IsR4); Debug.Assert(!context.Result.IsR8); LoadStore.OrderOperands(context, MethodCompiler); TransformLoad(context, ARMv8A32.Ldr8, context.Result, StackFrame, context.Operand1); }
private void LoadInt32(InstructionNode node) { Debug.Assert(!node.Result.IsR4); Debug.Assert(!node.Result.IsR8); LoadStore.OrderLoadOperands(node, MethodCompiler); node.SetInstruction(X86.MovLoad32, node.Result, node.Operand1, node.Operand2); }
private void LoadInt32(Context context) { Debug.Assert(!context.Result.IsR4); Debug.Assert(!context.Result.IsR8); LoadStore.OrderLoadOperands(context, MethodCompiler); context.SetInstruction(X64.MovLoad32, context.Result, context.Operand1, context.Operand2); }
private void Load32(Context context) { Debug.Assert(!context.Result.IsR4); Debug.Assert(!context.Result.IsR8); LoadStore.OrderOperands(context, MethodCompiler); TransformLoad(context, ARMv8A32.Ldr32, context.Result, context.Operand1, context.Operand2); }
private static IRouteResponse Load(LoadStore store) { Console.WriteLine($"Load store {store.StoreName} for user {store.UserId}"); using (var conn = OpenConnection()) { CheckForTable(conn, store.StoreName); var data = LoadStore(conn, store.StoreName, store.UserId); return(RouteResponse.OK(data)); } }
// method to buy item of the game public IEnumerator buyItem() { // find buyButton gameObject to change the scale Transform _button = transform.FindChild("BlackSquare").FindChild("BuyButton"); StoreAudioButton.shared().playAudio(); _button.localScale = new Vector3(1.05f, 1.05f, 1.0f); // wait some seconds to change back the scale yield return(new WaitForSeconds(0.1f)); _button.localScale = new Vector3(1.0f, 1.0f, 1.0f); // removes the price from money manager if the money is enough if (MoneyTeeth.removeTeeth(storeItem.Price)) { // load new teeth amount LoadStore.shareLoadStore().loadTeethAmount(); // to receive the items bought ArrayList _cloakRoomList = new ArrayList(); // check if there are if (SaveSystem.hasObject("CloakRoom_List")) { _cloakRoomList = (ArrayList)SaveSystem.load("CloakRoom_List", typeof(ArrayList)); } // add the new item bought _cloakRoomList.Add(storeItem); // save the new list SaveSystem.save("CloakRoom_List", _cloakRoomList); // remove all objects in the scene LoadStore.shareLoadStore().clearStoreItems(); // and load again LoadStore.shareLoadStore().loadStoreItems(); } else // if the money isn't enough, show message { Message.sharedMessage().setText("Dente insuficiente").show(); } }
/// <summary> /// Replaces the intrinsic call site /// </summary> /// <param name="context">The context.</param> /// <param name="methodCompiler">The method compiler.</param> /// <exception cref="CompilerException"></exception> void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, MethodCompiler methodCompiler) { if (context.OperandCount == 1) { context.SetInstruction(IRInstruction.LoadInt64, context.Result, context.Operand1, methodCompiler.ConstantZero); } else if (context.OperandCount == 2) { context.SetInstruction(IRInstruction.LoadInt64, context.Result, context.Operand1, context.Operand2); } else { throw new CompilerException(); } LoadStore.OrderLoadOperands(context.Node, methodCompiler); }
private static void StoreR4(Context context, MethodCompiler methodCompiler) { if (context.OperandCount == 2) { context.SetInstruction(IRInstruction.StoreR4, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2); } else if (context.OperandCount == 3) { context.SetInstruction(IRInstruction.StoreR4, null, context.Operand1, context.Operand2, context.Operand3); } else { throw new CompilerException(); } LoadStore.OrderOperands(context, methodCompiler); }
/// <summary> /// Replaces the intrinsic call site /// </summary> /// <param name="context">The context.</param> /// <param name="methodCompiler">The method compiler.</param> /// <exception cref="CompilerException"></exception> void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, MethodCompiler methodCompiler) { if (context.OperandCount == 2) { context.SetInstruction(IRInstruction.StoreInt8, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2); } else if (context.OperandCount == 3) { context.SetInstruction(IRInstruction.StoreInt8, null, context.Operand1, context.Operand2, context.Operand3); } else { throw new CompilerException(); } LoadStore.OrderStoreOperands(context.Node, methodCompiler); }
private static void Load64(Context context, MethodCompiler methodCompiler) { if (context.OperandCount == 1) { context.SetInstruction(IRInstruction.Load64, context.Result, context.Operand1, methodCompiler.ConstantZero); } else if (context.OperandCount == 2) { context.SetInstruction(IRInstruction.Load64, context.Result, context.Operand1, context.Operand2); } else { throw new CompilerException(); } LoadStore.OrderLoadOperands(context, methodCompiler); }
private static void StorePointer(Context context, MethodCompiler methodCompiler) { var instruction = methodCompiler.Architecture.Is32BitPlatform ? (BaseInstruction)IRInstruction.Store32 : IRInstruction.Store64; if (context.OperandCount == 2) { context.SetInstruction(instruction, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2); } else if (context.OperandCount == 3) { context.SetInstruction(instruction, null, context.Operand1, context.Operand2, context.Operand3); } else { throw new CompilerException(); } LoadStore.OrderOperands(context, methodCompiler); }
/// <summary> /// Replaces the intrinsic call site /// </summary> /// <param name="context">The context.</param> /// <param name="methodCompiler">The method compiler.</param> /// <exception cref="CompilerException"></exception> void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, MethodCompiler methodCompiler) { var instruction = methodCompiler.Architecture.Is32BitPlatform ? (BaseInstruction)IRInstruction.LoadZeroExtend16x32 : IRInstruction.LoadZeroExtend16x64; if (context.OperandCount == 1) { context.SetInstruction(instruction, context.Result, context.Operand1, methodCompiler.ConstantZero); } else if (context.OperandCount == 2) { context.SetInstruction(instruction, context.Result, context.Operand1, context.Operand2); } else { throw new CompilerException(); } LoadStore.OrderLoadOperands(context.Node, methodCompiler); }
/// <summary> /// Replaces the intrinsic call site /// </summary> /// <param name="context">The context.</param> /// <param name="methodCompiler">The method compiler.</param> /// <exception cref="InvalidCompilerException"></exception> void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler) { const InstructionSize size = InstructionSize.Size32; if (context.OperandCount == 2) { context.SetInstruction(IRInstruction.StoreInteger, size, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2); } else if (context.OperandCount == 3) { context.SetInstruction(IRInstruction.StoreInteger, size, null, context.Operand1, context.Operand2, context.Operand3); } else { throw new InvalidCompilerException(); } LoadStore.OrderStoreOperands(context.Node, methodCompiler); }
private static void LoadPointer(Context context, MethodCompiler methodCompiler) { var instruction = methodCompiler.Is32BitPlatform ? (BaseInstruction)IRInstruction.Load32 : IRInstruction.LoadZeroExtend32x64; if (context.OperandCount == 1) { context.SetInstruction(instruction, context.Result, context.Operand1, methodCompiler.ConstantZero); } else if (context.OperandCount == 2) { context.SetInstruction(instruction, context.Result, context.Operand1, context.Operand2); } else { throw new CompilerException(); } LoadStore.OrderOperands(context, methodCompiler); }
public void DecExecLS_Imm_Load_Success() { //Test 2 LOAD : e51b3008 ldr r3, [fp, #-8] uint u = 0xe51b3008; int r = Convert.ToInt32(~u); r = ~r; Memory regs = new Memory(regsize), RAM = new Memory(12); regs.WriteWord(Reg.R11, 8); RAM.WriteWord(0, 23); LoadStore inst = new LoadStore(r, ref regs, ref RAM); inst.Decode(); inst.Execute(); Assert.IsTrue(regs.ReadWord(Reg.R3) == 23); Assert.IsTrue(inst.ToString() == "ldr r3, [fp, #-8]"); }
void iOS_purchaseSucceededEvent(StoreKitTransaction transaction) { if (transaction.productIdentifier == BillingItemsIDs.teeth_01) { MoneyTeeth.addTeeth(1000f); } else if (transaction.productIdentifier == BillingItemsIDs.teeth_02) { MoneyTeeth.addTeeth(10000f); } else if (transaction.productIdentifier == BillingItemsIDs.teeth_03) { MoneyTeeth.addTeeth(100000f); } else if (transaction.productIdentifier == BillingItemsIDs.teeth_04) { MoneyTeeth.addTeeth(1000000f); } LoadStore.shareLoadStore().loadTeethAmount(); }
public void DecExecLS_RegImm_Store_Success() { // STORE : e78210c4 str r1, [r2, r4, asr #1] uint u = 0xe78210c4; int r = Convert.ToInt32(~u); r = ~r; Memory regs = new Memory(regsize), RAM = new Memory(12); regs.WriteWord(Reg.R2, 4); regs.WriteWord(Reg.R4, 8); //8 regs.WriteWord(Reg.R1, 23); LoadStore inst = new LoadStore(r, ref regs, ref RAM); inst.Decode(); inst.Execute(); Assert.IsTrue(RAM.ReadWord(8) == 23); Assert.IsTrue(inst.ToString() == "str r1, [r2, r4, asr #1]"); }
public void DecExecLS_RegImm_Store_Load_Success() { //Test 2 LOAD : e79290c4 ldr r9, [r2, r4, asr #1] uint u = 0xe79290c4; int r = Convert.ToInt32(~u); r = ~r; Memory regs = new Memory(regsize), RAM = new Memory(12); regs.WriteWord(Reg.R2, 4); regs.WriteWord(Reg.R4, 8); //8 RAM.WriteWord(8, 23); LoadStore inst = new LoadStore(r, ref regs, ref RAM); inst.Decode(); inst.Execute(); Assert.IsTrue(regs.ReadWord(Reg.R9) == 23); Assert.IsTrue(inst.ToString() == "ldr r9, [r2, r4, asr #1]"); }
private static void Store(Context context, MethodCompiler methodCompiler) { if (context.OperandCount == 2) { var instruction = !context.Operand2.Is64BitInteger ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64; if (context.Operand2.IsR4) { instruction = IRInstruction.StoreFloatR4; } else if (context.Operand2.IsR8) { instruction = IRInstruction.StoreFloatR8; } context.SetInstruction(instruction, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2); } else if (context.OperandCount == 3) { var instruction = !context.Operand3.Is64BitInteger ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64; if (context.Operand3.IsR4) { instruction = IRInstruction.StoreFloatR4; } else if (context.Operand3.IsR8) { instruction = IRInstruction.StoreFloatR8; } context.SetInstruction(instruction, null, context.Operand1, context.Operand2, context.Operand3); } else { throw new CompilerException(); } LoadStore.OrderStoreOperands(context, methodCompiler); }
void android_purchaseSucceededEvent(GooglePurchase purchase) { if (purchase.productId == BillingItemsIDs.teeth_01) { MoneyTeeth.addTeeth(1000f); } else if (purchase.productId == BillingItemsIDs.teeth_02) { MoneyTeeth.addTeeth(10000f); } else if (purchase.productId == BillingItemsIDs.teeth_03) { MoneyTeeth.addTeeth(100000f); } else if (purchase.productId == BillingItemsIDs.teeth_04) { MoneyTeeth.addTeeth(1000000f); } BillingManager.consumeItem(purchase.productId); LoadStore.shareLoadStore().loadTeethAmount(); }
private void StoreInt8(InstructionNode node) { LoadStore.OrderStoreOperands(node, MethodCompiler); node.SetInstruction(X86.MovStore8, null, node.Operand1, node.Operand2, node.Operand3); }
private void LoadSignExtend16x64(InstructionNode node) { LoadStore.OrderLoadOperands(node, MethodCompiler); node.SetInstruction(X64.MovsxLoad16, node.Result, node.Operand1, node.Operand2); }
private void StoreInt8(Context context) { LoadStore.OrderStoreOperands(context, MethodCompiler); context.SetInstruction(X64.MovStore8, null, context.Operand1, context.Operand2, context.Operand3); }
private void LoadZeroExtend8x32(Context context) { LoadStore.OrderLoadOperands(context, MethodCompiler); context.SetInstruction(X64.MovzxLoad8, context.Result, context.Operand1, context.Operand2); }
private void LoadSignExtend32x64(Context context) { LoadStore.OrderOperands(context, MethodCompiler); context.SetInstruction(X64.MovzxLoad32, context.Result, context.Operand1, context.Operand2); }
private void LoadZeroExtend8x32(InstructionNode node) { LoadStore.OrderLoadOperands(node, MethodCompiler); node.SetInstruction(X86.MovzxLoad8, node.Result, node.Operand1, node.Operand2); }
private void LoadSignExtend16x32(Context context) { LoadStore.OrderLoadOperands(context, MethodCompiler); context.SetInstruction(X86.MovsxLoad16, context.Result, context.Operand1, context.Operand2); }