Example #1
0
        public void LoadConst(IAsm a)
        {
            StringBuilder sb    = new StringBuilder(Io.MAXSTR);
            int           value = Convert.ToInt32(a.getInsn());

            sb.Append("\tldc.i4");
            if (value > 127 || value < -128)
            {
                sb.Append(" ");
            }
            else if (value > 8 || value < -1)
            {
                sb.Append(".s ");
            }
            else
            {
                sb.Append(".");
            }
            sb.Append(a.getInsn());
            sb.Append("\t\t\t\t\t//");
            sb.Append(a.getICount());
            sb.Append("\r\n");

            io.Out(sb.ToString());
        }
Example #2
0
        public void FieldDef(IAsm a)
        {
            Var    e      = a.getVar();
            String prefix = "";

            switch (e.getClassId())
            {
            case Tok.T_STATIC:
                prefix = "\t.field ";
                break;

            case Tok.T_AUTO:
            case Tok.T_DEFCLASS:
                prefix = "\t.field ";
                break;

            default:
                io.Abort("PL0407: unhandled field def type");
                break;
            }

            StringBuilder sb = new StringBuilder(Io.MAXSTR);

            sb.Append(prefix);
            sb.Append(genDataTypeSig(e));
            sb.Append(" ");
            sb.Append(e.getName());
            sb.Append("\r\n");
            io.Out(sb.ToString());
        }
Example #3
0
        public void LoadConst(IAsm a)
        {
            int value = Convert.ToInt32(a.getInsn());

            if (value > 127 || value < -128)
            {
                il.Emit(OpCodes.Ldc_I4, value);
            }
            else if (value > 8 || value < -1)
            {
                il.Emit(OpCodes.Ldc_I4_S, Convert.ToSByte(value));
            }
            else if (value == -1)
            {
                il.Emit(OpCodes.Ldc_I4_M1);
            }
            else
            {
                Object o = opcodehash["ldc.i4." + a.getInsn()];
                if (o == null)
                {
                    io.ICE("could not find opcode for (ldc.i4." + a.getInsn() + ")");
                }
                il.Emit((OpCode)o);
            }
        }
Example #4
0
        public void Label(IAsm a)
        {
            StringBuilder sb = new StringBuilder(Io.MAXSTR);

            sb.Append(a.getLabel());
            sb.Append(":\r\n");
            io.Out(sb.ToString());
        }
Example #5
0
File: exe.cs Project: master/plil
        public void Branch(IAsm a)
        {
            Object o = opcodehash[a.getInsn()];

            if (o == null) io.ICE("instruction branch opcode (" + a.getInsn() + ") not found in hash");

            il.Emit((OpCode) o, (Label) getILLabel(a));
        }
Example #6
0
        public void Ret(IAsm a)
        {
            StringBuilder sb = new StringBuilder(Io.MAXSTR);

            sb.Append("\tret\t\t\t\t\t//");
            sb.Append(a.getICount());
            sb.Append("\r\n");
            io.Out(sb.ToString());
        }
Example #7
0
        public void Insn(IAsm a)
        {
            Object o = opcodehash[a.getInsn()];

            if (o == null)
            {
                io.ICE("instruction opcode (" + a.getInsn() + ") not found in hash");
            }
            il.Emit((OpCode)o);
        }
Example #8
0
        public void Branch(IAsm a)
        {
            Object o = opcodehash[a.getInsn()];

            if (o == null)
            {
                io.ICE("instruction branch opcode (" + a.getInsn() + ") not found in hash");
            }

            il.Emit((OpCode)o, (Label)getILLabel(a));
        }
Example #9
0
        private Object getILLabel(IAsm a)
        {
            String s = a.getLabel();
            Object l = labelhash[s];

            if (l == null)
            {
                l            = (Object)il.DefineLabel();
                labelhash[s] = l;
            }
            return(l);
        }
Example #10
0
File: asm.cs Project: master/plil
 public void Branch(IAsm a)
 {
     StringBuilder sb = new StringBuilder(Io.MAXSTR);
     sb.Append("\t");
     sb.Append(a.getInsn());
     sb.Append(" ");
     sb.Append(a.getLabel());
     sb.Append("\t\t\t\t\t//");
     sb.Append(a.getICount());
     sb.Append("\r\n");
     io.Out(sb.ToString());
 }
Example #11
0
        public void Call(IAsm a)
        {
            Var     func = a.getVar();
            LibFunc lfunc;

            String funcsig = genDataTypeSig(a.getVar());

            VarList x        = func.getParams();
            String  paramsig = "";

            if (x.Length() > 0)
            {
                int           max = x.Length();
                StringBuilder t   = new StringBuilder(Io.MAXSTR);
                for (int i = 0; i < max; i++)
                {
                    Var e = x.FindByIndex(i);
                    t.Append(genDataTypeSig(e));
                    if (i < max - 1)
                    {
                        t.Append(",");
                    }
                }
                paramsig = t.ToString();
            }

            StringBuilder sb = new StringBuilder(Io.MAXSTR);

            sb.Append("\tcall ");
            sb.Append(funcsig);
            sb.Append(" ");

            lfunc = lib.lookup_func(a.getVar().getName());
            if (lfunc != null)
            {
                sb.Append(lfunc.nameFull);
            }
            else
            {
                sb.Append(io.GetClassname());
                sb.Append("::");
                sb.Append(func.getName());
                sb.Append("(");
                sb.Append(paramsig);
                sb.Append(")");
            }

            sb.Append("\t\t\t\t\t//");
            sb.Append(a.getICount());
            sb.Append("\r\n");
            io.Out(sb.ToString());
        }
Example #12
0
        public void Branch(IAsm a)
        {
            StringBuilder sb = new StringBuilder(Io.MAXSTR);

            sb.Append("\t");
            sb.Append(a.getInsn());
            sb.Append(" ");
            sb.Append(a.getLabel());
            sb.Append("\t\t\t\t\t//");
            sb.Append(a.getICount());
            sb.Append("\r\n");
            io.Out(sb.ToString());
        }
Example #13
0
File: exe.cs Project: master/plil
        public void Call(IAsm a)
        {
            Var func = a.getVar();
            Object o = func.getMethodBuilder();

            LibFunc lfunc = lib.lookup_func(a.getVar().getName());

            if (lfunc != null) {
                il.Emit(OpCodes.Call, lfunc.methodInfo);
            } else {
                if (o == null) io.ICE("no previous extern for (" + func.getName() + ")");
                MethodBuilder mb = (MethodBuilder) o;
                il.Emit(OpCodes.Call, mb);
            }
        }
Example #14
0
        public void Load(IAsm a)
        {
            StringBuilder sb = new StringBuilder(Io.MAXSTR);
            Var           e  = a.getVar();

            if (e == null)
            {
                io.Abort("PL0402: load instruction with no variable ptr");
            }
            switch (e.getClassId())
            {
            case Tok.T_STATIC:
                sb.Append("\tldsfld ");
                sb.Append(genFieldRef(e));
                sb.Append("\t\t\t\t\t//");
                sb.Append(a.getICount());
                sb.Append(", ");
                sb.Append(e.getName());
                sb.Append("\r\n");
                break;

            case Tok.T_AUTO:
            case Tok.T_DEFCLASS:
                sb.Append("\tldloc ");
                sb.Append(e.getIndex());
                sb.Append("\t\t\t\t\t//");
                sb.Append(a.getICount());
                sb.Append(", ");
                sb.Append(e.getName());
                sb.Append("\r\n");
                break;

            case Tok.T_PARAM:
                sb.Append("\tldarg ");
                sb.Append(e.getIndex());
                sb.Append("\t\t\t\t\t//");
                sb.Append(a.getICount());
                sb.Append(", ");
                sb.Append(e.getName());
                sb.Append("\r\n");
                break;

            default:
                io.Abort("PL0403: instruction load of unknown class (" + e.getClassId() + ")");
                break;
            }
            io.Out(sb.ToString());
        }
Example #15
0
        public void FieldDef(IAsm a)
        {
            Var             e    = a.getVar();
            FieldAttributes attr = FieldAttributes.Private;

            if (e.getClassId() == Tok.T_STATIC)
            {
                attr |= FieldAttributes.Static;
            }

            Type t = genDataTypeSig(e);                         /* gen type info */

            FieldBuilder f = eclass.DefineField(e.getName(), t, attr);

            e.setFieldBuilder((Object)f);
        }
Example #16
0
        void NextInsn(int incr)
        {
            int ncount = 0;

            if (iroot == null)
            {
                icur = iroot = new IAsm();
            }
            else
            {
                ncount = icur.getICount() + incr;
                icur.setNext(new IAsm());
                icur = icur.getNext();
            }
            icur.setICount(ncount);
        }
Example #17
0
File: asm.cs Project: master/plil
        public void Call(IAsm a)
        {
            Var func = a.getVar();
            LibFunc lfunc;

            String funcsig = genDataTypeSig(a.getVar());

            VarList x = func.getParams();
            String paramsig = "";
            if (x.Length() > 0) {
                int max = x.Length();
                StringBuilder t = new StringBuilder(Io.MAXSTR);
                for (int i = 0; i < max; i++) {
                    Var e = x.FindByIndex(i);
                    t.Append(genDataTypeSig(e));
                    if (i < max-1) t.Append(",");
                }
                paramsig = t.ToString();
            }

            StringBuilder sb = new StringBuilder(Io.MAXSTR);
            sb.Append("\tcall ");
            sb.Append(funcsig);
            sb.Append(" ");

            lfunc = lib.lookup_func(a.getVar().getName());
            if (lfunc != null) {
                sb.Append(lfunc.nameFull);
            } else {
                sb.Append(io.GetClassname());
                sb.Append("::");
                sb.Append(func.getName());
                sb.Append("(");
                sb.Append(paramsig);
                sb.Append(")");
            }

            sb.Append("\t\t\t\t\t//");
            sb.Append(a.getICount());
            sb.Append("\r\n");
            io.Out(sb.ToString());
        }
Example #18
0
        public void Call(IAsm a)
        {
            Var    func = a.getVar();
            Object o    = func.getMethodBuilder();

            LibFunc lfunc = lib.lookup_func(a.getVar().getName());

            if (lfunc != null)
            {
                il.Emit(OpCodes.Call, lfunc.methodInfo);
            }
            else
            {
                if (o == null)
                {
                    io.ICE("no previous extern for (" + func.getName() + ")");
                }
                MethodBuilder mb = (MethodBuilder)o;
                il.Emit(OpCodes.Call, mb);
            }
        }
Example #19
0
        public void FuncBegin(IAsm a)
        {
            Var    func    = a.getVar();
            String funcsig = genDataTypeSig(a.getVar());

            VarList x        = func.getParams();
            String  paramsig = "";

            if (x.Length() > 0)
            {
                int           max = x.Length();
                StringBuilder t   = new StringBuilder(Io.MAXSTR);
                for (int i = 0; i < max; i++)
                {
                    Var e = x.FindByIndex(i);
                    t.Append(genDataTypeSig(e));
                    if (i < max - 1)
                    {
                        t.Append(",");
                    }
                }
                paramsig = t.ToString();
            }
            StringBuilder sb = new StringBuilder(Io.MAXSTR);

            sb.Append("\t.method public ");
            sb.Append("static ");
            sb.Append(funcsig);
            sb.Append(" ");
            sb.Append(func.getName());
            sb.Append("(");
            sb.Append(paramsig);
            sb.Append(") {\r\n");
            io.Out(sb.ToString());

            if (func.getName().ToLower().Equals("main"))
            {
                io.Out("\t.entrypoint\r\n");
            }
        }
Example #20
0
        public void FuncBegin(IAsm a)
        {
            Var  func    = a.getVar();
            Type funcsig = genDataTypeSig(a.getVar());

            VarList paramlist = func.getParams();

            Type[] paramTypes = null;

            if (paramlist.Length() > 0)
            {
                int max = paramlist.Length();
                paramTypes = new Type[max];
                for (int i = 0; i < max; i++)
                {
                    Var e = paramlist.FindByIndex(i);
                    paramTypes[i] = genDataTypeSig(e);
                }
            }

            emethod = eclass.DefineMethod(func.getName(),
                                          MethodAttributes.Static | MethodAttributes.Public,
                                          funcsig, paramTypes);
            func.setMethodBuilder(emethod);

            for (int i = 0; i < paramlist.Length(); i++)
            {
                emethod.DefineParameter(i + 1, 0, paramlist.FindByIndex(i).getName());
            }

            il = emethod.GetILGenerator();

            if (func.getName().ToLower().Equals("main"))
            {
                appbuild.SetEntryPoint(emethod);
            }
            //    emodule.SetUserEntryPoint(emethod);

            labelhash = new Hashtable();
        }
Example #21
0
        private bool IsNextNonInsnGen(IAsm a)
        {
            IAsm cur = a.getNext();

            if (cur == null)
            {
                return(true);
            }

            int type = cur.getIType();

            while (type == IAsm.I_LABEL)
            {
                cur  = cur.getNext();
                type = cur.getIType();
            }

            if (type == IAsm.I_COMMENT)
            {
                return(true);
            }

            return(false);
        }
Example #22
0
File: vma.cs Project: master/plil
 public void setNext(IAsm n)
 {
     next = n;
 }
Example #23
0
File: asm.cs Project: master/plil
 public void Ret(IAsm a)
 {
     StringBuilder sb = new StringBuilder(Io.MAXSTR);
     sb.Append("\tret\t\t\t\t\t//");
     sb.Append(a.getICount());
     sb.Append("\r\n");
     io.Out(sb.ToString());
 }
Example #24
0
File: asm.cs Project: master/plil
 public void Label(IAsm a)
 {
     StringBuilder sb = new StringBuilder(Io.MAXSTR);
     sb.Append(a.getLabel());
     sb.Append(":\r\n");
     io.Out(sb.ToString());
 }
Example #25
0
File: emt.cs Project: master/plil
 void NextInsn(int incr)
 {
     int ncount = 0;
     if (iroot == null) {
         icur = iroot = new IAsm();
     } else {
         ncount = icur.getICount() + incr;
         icur.setNext(new IAsm());
         icur = icur.getNext();
     }
     icur.setICount(ncount);
 }
Example #26
0
File: exe.cs Project: master/plil
        public void LoadConst(IAsm a)
        {
            int value = Convert.ToInt32(a.getInsn());

            if (value > 127 || value < -128) {
                il.Emit(OpCodes.Ldc_I4, value);
            } else if (value > 8 || value < -1) {
                il.Emit(OpCodes.Ldc_I4_S, Convert.ToSByte(value));
            } else if (value == -1) {
                il.Emit(OpCodes.Ldc_I4_M1);
            } else {
                Object o = opcodehash["ldc.i4."+a.getInsn()];
                if (o == null) io.ICE("could not find opcode for (ldc.i4." + a.getInsn() + ")");
                il.Emit((OpCode) o);
            }
        }
Example #27
0
File: exe.cs Project: master/plil
 public void Load(IAsm a)
 {
     Var e = a.getVar();
     genLoad(e);
 }
Example #28
0
        public void Store(IAsm a)
        {
            if (a.getVar() == null)
            {
                io.ICE("store instruction with no variable ptr");
            }
            Var e = localvars.FindByName(a.getVar().getName());

            if (e == null)
            {
                e = a.getVar();
            }
            int id = e.getClassId();

            if (e.getLocalToken() != null)
            {
                LocalBuilder lt = (LocalBuilder)e.getLocalToken();
                il.Emit(OpCodes.Stloc, lt);
            }
            else
            {
                if (e.getFieldBuilder() != null)
                {
                    FieldBuilder fb = (FieldBuilder)e.getFieldBuilder();
                    if (id == Tok.T_STATIC)
                    {
                        il.Emit(OpCodes.Stsfld, fb);
                    }
                    else
                    {
                        il.Emit(OpCodes.Stfld, fb);
                    }
                }
                else
                {
                    int index = e.getIndex();
                    if (id == Tok.T_PARAM)
                    {
                        if (index <= 256)
                        {
                            il.Emit(OpCodes.Starg_S, index);
                        }
                        else
                        {
                            il.Emit(OpCodes.Starg, index);
                        }
                    }
                    else
                    {
                        if (id == Tok.T_AUTO || id == Tok.T_DEFCLASS)
                        {
                            il.Emit(OpCodes.Stloc, index);
                        }
                        else
                        {
                            io.ICE("instruction load of unknown class (" + e.getClassId() + ")");
                        }
                    }
                }
            }
        }
Example #29
0
        public void LIST()
        {
            IAsm a = iroot;
            IAsm p;
            Asm  x = new Asm(io, lib);

            while (a != null)
            {
                switch (a.getIType())
                {
                case IAsm.I_INSN:
                    x.Insn(a);
                    break;

                case IAsm.I_LABEL:
                    x.Label(a);
                    break;

                case IAsm.I_BRANCH:
                    x.Branch(a);
                    break;

                case IAsm.I_INSN_STORE:
                    x.Store(a);
                    break;

                case IAsm.I_INSN_LOAD:
                    x.Load(a);
                    break;

                case IAsm.I_INSN_LOAD_CONST:
                    x.LoadConst(a);
                    break;

                case IAsm.I_FUNC_BEGIN:
                    x.FuncBegin(a);
                    break;

                case IAsm.I_FUNC_END:
                    x.FuncEnd();
                    break;

                case IAsm.I_CALL:
                    x.Call(a);
                    break;

                case IAsm.I_RET:
                    x.Ret(a);
                    break;

                case IAsm.I_COMMENT:
                    break;

                case IAsm.I_FIELD:
                    x.FieldDef(a);
                    break;

                case IAsm.I_LOCALDEF:
                    x.LocalVars(localvars);
                    break;

                default:
                    io.Abort("PL0302: unhandled instruction type " + a.getIType());
                    break;
                }
                p = a;
                a = a.getNext();
            }
        }
Example #30
0
File: asm.cs Project: master/plil
        public void FieldDef(IAsm a)
        {
            Var e = a.getVar();
            String prefix = "";
            switch (e.getClassId()) {
            case Tok.T_STATIC:
                prefix = "\t.field ";
                break;
            case Tok.T_AUTO:
            case Tok.T_DEFCLASS:
                prefix = "\t.field ";
                break;
            default:
                io.Abort("PL0407: unhandled field def type");
            break;
            }

            StringBuilder sb = new StringBuilder(Io.MAXSTR);
            sb.Append(prefix);
            sb.Append(genDataTypeSig(e));
            sb.Append(" ");
            sb.Append(e.getName());
            sb.Append("\r\n");
            io.Out(sb.ToString());
        }
Example #31
0
File: exe.cs Project: master/plil
        public void FieldDef(IAsm a)
        {
            Var e = a.getVar();
            FieldAttributes attr = FieldAttributes.Private;

            if (e.getClassId() == Tok.T_STATIC)
                attr |= FieldAttributes.Static;

            Type t = genDataTypeSig(e);		/* gen type info */

            FieldBuilder f = eclass.DefineField(e.getName(), t, attr);
            e.setFieldBuilder((Object) f);
        }
Example #32
0
 public void Ret(IAsm a)
 {
     il.Emit(OpCodes.Ret);
 }
Example #33
0
 public void setNext(IAsm n)
 {
     next = n;
 }
Example #34
0
File: emt.cs Project: master/plil
 public void Finish()
 {
     iroot = icur = null;
 }
Example #35
0
File: exe.cs Project: master/plil
 public void Ret(IAsm a)
 {
     il.Emit(OpCodes.Ret);
 }
Example #36
0
File: asm.cs Project: master/plil
        public void FuncBegin(IAsm a)
        {
            Var func = a.getVar();
            String funcsig = genDataTypeSig(a.getVar());

            VarList x = func.getParams();
            String paramsig = "";

            if (x.Length() > 0) {
                int max = x.Length();
                StringBuilder t = new StringBuilder(Io.MAXSTR);
                for (int i = 0; i < max; i++) {
                    Var e = x.FindByIndex(i);
                    t.Append(genDataTypeSig(e));
                    if (i < max-1) t.Append(",");
                }
                paramsig = t.ToString();
            }
            StringBuilder sb = new StringBuilder(Io.MAXSTR);
            sb.Append("\t.method public ");
            sb.Append("static ");
            sb.Append(funcsig);
            sb.Append(" ");
            sb.Append(func.getName());
            sb.Append("(");
            sb.Append(paramsig);
            sb.Append(") {\r\n");
            io.Out(sb.ToString());

            if (func.getName().ToLower().Equals("main"))
                io.Out("\t.entrypoint\r\n");
        }
Example #37
0
File: exe.cs Project: master/plil
        public void Store(IAsm a)
        {
            if (a.getVar() == null) io.ICE("store instruction with no variable ptr");
            Var e = localvars.FindByName(a.getVar().getName());
            if (e == null) e = a.getVar();
            int id = e.getClassId();
            if (e.getLocalToken() != null) {

                LocalBuilder lt = (LocalBuilder) e.getLocalToken();
                il.Emit(OpCodes.Stloc, lt);

            } else {

                if (e.getFieldBuilder() != null) {

                    FieldBuilder fb = (FieldBuilder) e.getFieldBuilder();
                    if (id == Tok.T_STATIC) il.Emit(OpCodes.Stsfld, fb);
                    else il.Emit(OpCodes.Stfld, fb);

                } else {

                    int index = e.getIndex();
                    if (id == Tok.T_PARAM) {

                        if (index <= 256) il.Emit(OpCodes.Starg_S, index);
                        else il.Emit(OpCodes.Starg, index);
                    } else {

                        if (id == Tok.T_AUTO || id == Tok.T_DEFCLASS) il.Emit(OpCodes.Stloc, index);
                        else io.ICE("instruction load of unknown class (" + e.getClassId()+")");
                    }
                }
            }
        }
Example #38
0
File: asm.cs Project: master/plil
        public void LoadConst(IAsm a)
        {
            StringBuilder sb = new StringBuilder(Io.MAXSTR);
            int value = Convert.ToInt32(a.getInsn());

            sb.Append("\tldc.i4");
            if (value > 127 || value < -128) {
                sb.Append(" ");
            } else if (value > 8 || value < -1) {
                sb.Append(".s ");
            } else {
                sb.Append(".");
            }
            sb.Append(a.getInsn());
            sb.Append("\t\t\t\t\t//");
            sb.Append(a.getICount());
            sb.Append("\r\n");

            io.Out(sb.ToString());
        }
Example #39
0
File: exe.cs Project: master/plil
        private Object getILLabel(IAsm a)
        {
            String s = a.getLabel();
            Object l = labelhash[s];

            if (l == null) {
                l = (Object) il.DefineLabel();
                labelhash[s] = l;
            }
            return l;
        }
Example #40
0
File: asm.cs Project: master/plil
 public void Store(IAsm a)
 {
     StringBuilder sb = new StringBuilder(Io.MAXSTR);
     Var e = a.getVar();
     if (e == null) {
         io.Abort("PL0404: store instruction with no variable ptr");
     }
     switch (e.getClassId()) {
     case Tok.T_STATIC:
         sb.Append("\tstsfld ");
         sb.Append(genFieldRef(e));
         sb.Append("\t\t\t\t\t//");
         sb.Append(a.getICount());
         sb.Append(", ");
         sb.Append(e.getName());
         sb.Append("\r\n");
         break;
     case Tok.T_AUTO:
     case Tok.T_DEFCLASS:
         sb.Append("\tstloc ");
         sb.Append(e.getIndex());
         sb.Append("\t\t\t\t\t//");
         sb.Append(a.getICount());
         sb.Append(", ");
         sb.Append(e.getName());
         sb.Append("\r\n");
         break;
     case Tok.T_PARAM:
         sb.Append("\tstarg ");
         sb.Append(e.getIndex());
         sb.Append("\t\t\t\t\t//");
         sb.Append(a.getICount());
         sb.Append(", ");
         sb.Append(e.getName());
         sb.Append("\r\n");
         break;
     default:
         io.Abort("PL0405: instruction load of unknown class (" + e.getClassId() + ")");
         break;
     }
     io.Out(sb.ToString());
 }
Example #41
0
File: exe.cs Project: master/plil
        private bool IsNextNonInsnGen(IAsm a)
        {
            IAsm cur = a.getNext();
            if (cur == null) return true;

            int type = cur.getIType();

            while (type == IAsm.I_LABEL) {
                cur = cur.getNext();
                type = cur.getIType();
            }

            if (type == IAsm.I_COMMENT)	return true;

            return false;
        }
Example #42
0
File: exe.cs Project: master/plil
        public void FuncBegin(IAsm a)
        {
            Var func = a.getVar();
            Type funcsig = genDataTypeSig(a.getVar());

            VarList paramlist = func.getParams();
            Type[] paramTypes = null;

            if (paramlist.Length() > 0) {
                int max = paramlist.Length();
                paramTypes = new Type[max];
                for (int i = 0; i < max; i++) {
                    Var e = paramlist.FindByIndex(i);
                    paramTypes[i] = genDataTypeSig(e);
                }
            }

            emethod = eclass.DefineMethod(func.getName(),
                MethodAttributes.Static|MethodAttributes.Public,
                funcsig, paramTypes);
            func.setMethodBuilder(emethod);

            for (int i = 0; i < paramlist.Length(); i++)
                emethod.DefineParameter(i+1, 0, paramlist.FindByIndex(i).getName());

            il = emethod.GetILGenerator();

            if (func.getName().ToLower().Equals("main"))
                appbuild.SetEntryPoint(emethod);
            //    emodule.SetUserEntryPoint(emethod);

            labelhash = new Hashtable();
        }
Example #43
0
 public void Label(IAsm a)
 {
     il.MarkLabel((Label)getILLabel(a));
 }
Example #44
0
 public void Finish()
 {
     iroot = icur = null;
 }
Example #45
0
File: exe.cs Project: master/plil
        public void Insn(IAsm a)
        {
            Object o = opcodehash[a.getInsn()];

            if (o == null) io.ICE("instruction opcode (" + a.getInsn() + ") not found in hash");
            il.Emit((OpCode) o);
        }
Example #46
0
File: exe.cs Project: master/plil
 public void Label(IAsm a)
 {
     il.MarkLabel((Label) getILLabel(a));
 }
Example #47
0
        public void Load(IAsm a)
        {
            Var e = a.getVar();

            genLoad(e);
        }