Exemplo n.º 1
0
        public static int CreateJavaStringLiteral(string @string)
        {
            HeapArray  charArray   = new HeapArray(@string.ToCharArray(), ClassObjectManager.GetClassObjectAddr("char"));
            int        charArrAddr = Heap.AddItem(charArray);
            HeapObject stringObj   = new HeapObject(ClassFileManager.GetClassFile("java/lang/String"));

            stringObj.SetField("value", "[C", new FieldReferenceValue(charArrAddr));
            int stringObjAddr = Heap.AddItem(stringObj);

            return(StringPool.Intern(stringObjAddr));
        }
Exemplo n.º 2
0
        public HeapArray(Array array, int itemTypeClassObjAddr) : base(ClassFileManager.GetClassFile("java/lang/Object"))
        {
            Array = array;
            ItemTypeClassObjAddr = itemTypeClassObjAddr;

            int doubleClassObject = ClassObjectManager.GetClassObjectAddr("double");
            int longClassObject   = ClassObjectManager.GetClassObjectAddr("long");

            itemSize = itemTypeClassObjAddr == doubleClassObject || itemTypeClassObjAddr == longClassObject ? 8 : 4;
            //data = new Memory<byte>(new byte[]);
            NumOfBytes = 8 + 8 + itemSize * array.GetLength(0);
            Address    = Heap.AllocateMemory(NumOfBytes);
            //ydata = Heap.GetMemorySlice(Address, size);
            ((long)Array.GetLength(0)).AsByteArray().CopyTo(Heap.GetMemorySlice(Address + 8, 8));
            //SetField("length", "I", );
        }