Exemple #1
0
		// this method is called from <GhostType>.IsInstanceArray()
		internal static bool IsGhostArrayInstance(object obj, RuntimeTypeHandle typeHandle, int rank)
		{
			TypeWrapper tw1 = GhostTag.GetTag(obj);
			if(tw1 != null)
			{
				TypeWrapper tw2 = ClassLoaderWrapper.GetWrapperFromType(Type.GetTypeFromHandle(typeHandle)).MakeArrayType(rank);
				return tw1.IsAssignableTo(tw2);
			}
			return false;
		}
Exemple #2
0
		public static object multianewarray_ghost(RuntimeTypeHandle typeHandle, int[] lengths)
		{
			Type type = Type.GetTypeFromHandle(typeHandle);
			int rank = 0;
			while(ReflectUtil.IsVector(type))
			{
				rank++;
				type = type.GetElementType();
			}
			object obj = multianewarray(ArrayTypeWrapper.MakeArrayType(typeof(object), rank).TypeHandle, lengths);
			GhostTag.SetTag(obj, typeHandle);
			return obj;
		}
Exemple #3
0
        public static object DynamicMultianewarray(int[] lengths, java.lang.Class clazz)
        {
#if FIRST_PASS
            return(null);
#else
            Profiler.Count("DynamicMultianewarray");
            TypeWrapper wrapper = TypeWrapper.FromClass(clazz);
            object      obj     = multianewarray(wrapper.TypeAsArrayType.TypeHandle, lengths);
            if (wrapper.IsGhostArray)
            {
                GhostTag.SetTag(obj, wrapper);
            }
            return(obj);
#endif
        }
Exemple #4
0
        public static object DynamicNewarray(int length, java.lang.Class clazz)
        {
#if FIRST_PASS
            return(null);
#else
            Profiler.Count("DynamicNewarray");
            if (length < 0)
            {
                throw new java.lang.NegativeArraySizeException();
            }
            TypeWrapper wrapper = TypeWrapper.FromClass(clazz);
            Array       obj     = Array.CreateInstance(wrapper.TypeAsArrayType, length);
            if (wrapper.IsGhost || wrapper.IsGhostArray)
            {
                GhostTag.SetTag(obj, wrapper.MakeArrayType(1));
            }
            return(obj);
#endif
        }
Exemple #5
0
 public static T[] anewarray_ghost <T>(int length, RuntimeTypeHandle typeHandle)
 {
     T[] obj = new T[length];
     GhostTag.SetTag(obj, typeHandle);
     return(obj);
 }