예제 #1
0
        public static IshtarObject *ToIshtarObject(nint dotnet_value, CallFrame frame = null, IshtarObject **node = null)
        {
            var obj = IshtarGC.AllocObject(TYPE_RAW.AsRuntimeClass(), node);

            obj->vtable = (void **)dotnet_value;
            return(obj);
        }
예제 #2
0
        public static IshtarObject *ToIshtarObject(string str, CallFrame frame = null, IshtarObject **node = null)
        {
            var arg   = IshtarGC.AllocObject(TYPE_STRING.AsRuntimeClass(), node);
            var clazz = IshtarUnsafe.AsRef <RuntimeIshtarClass>(arg->clazz);

            arg->vtable[clazz.Field["!!value"].vtable_offset] = StringStorage.Intern(str);
            return(arg);
        }
예제 #3
0
        public static IshtarObject *ToIshtarObject(float dotnet_value, CallFrame frame = null, IshtarObject **node = null)
        {
            var obj   = IshtarGC.AllocObject(TYPE_I8.AsRuntimeClass(), node);
            var clazz = IshtarUnsafe.AsRef <RuntimeIshtarClass>(obj->clazz);

            obj->vtable[clazz.Field["!!value"].vtable_offset] = (int *)BitConverter.SingleToInt32Bits(dotnet_value);

            return(obj);
        }
예제 #4
0
        public static IshtarObject *ToIshtarObject(long dotnet_value, CallFrame frame = null, IshtarObject **node = null)
        {
            var obj   = IshtarGC.AllocObject(TYPE_I8.AsRuntimeClass(), node);
            var clazz = IshtarUnsafe.AsRef <RuntimeIshtarClass>(obj->clazz);

            obj->vtable[clazz.Field["!!value"].vtable_offset] = (long *)dotnet_value;

            return(obj);
        }
예제 #5
0
        public void ThrowException(RuntimeIshtarClass @class, string message)
        {
            this.exception = new CallFrameException()
            {
                value = IshtarGC.AllocObject(@class)
            };

            if (@class.FindField("message") is null)
            {
                throw new InvalidOperationException($"Class '{@class.FullName}' is not contained 'message' field.");
            }

            this.exception.value->vtable[@class.Field["message"].vtable_offset]
                = IshtarMarshal.ToIshtarObject(message);
        }
예제 #6
0
 public void ThrowException(RuntimeIshtarClass @class) =>
 this.exception = new CallFrameException()
 {
     value = IshtarGC.AllocObject(@class)
 };