示例#1
0
        /// <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);
        }
示例#2
0
		/// <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);
		}
示例#3
0
        /// <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);
        }
示例#5
0
        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);
        }
示例#8
0
        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));
            }
        }
示例#9
0
    // 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();
        }
    }
示例#10
0
        /// <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);
        }
示例#11
0
        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);
        }
示例#12
0
        /// <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);
        }
示例#13
0
        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);
        }
示例#14
0
        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);
        }
示例#15
0
        /// <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);
        }
示例#16
0
        /// <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);
        }
示例#17
0
        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);
        }
示例#18
0
        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]");
        }
示例#19
0
    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();
    }
示例#20
0
        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]");
        }
示例#21
0
        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]");
        }
示例#22
0
        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);
        }
示例#23
0
    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();
    }
示例#24
0
        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);
        }
示例#28
0
        private void LoadSignExtend32x64(Context context)
        {
            LoadStore.OrderOperands(context, MethodCompiler);

            context.SetInstruction(X64.MovzxLoad32, context.Result, context.Operand1, context.Operand2);
        }
示例#29
0
        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);
        }