示例#1
0
 protected sunRelocation(sunBinary binary)
 {
     if (binary == null)
     {
         throw new ArgumentNullException("binary");
     }
     mBinary = binary;
     mPoint  = mBinary.Offset;
 }
示例#2
0
 protected sunSymbolRelocation(sunBinary binary, TSymbol symbol)
     : base(binary)
 {
     if (symbol == null)
     {
         throw new ArgumentNullException("symbol");
     }
     mSymbol = symbol;
 }
示例#3
0
文件: compiler.cs 项目: RenolY2/ssc
        public sunCompilerResults Compile(string name, sunBinary binary, sunImportResolver resolver)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (binary == null)
            {
                throw new ArgumentNullException("binary");
            }
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }
            var results = new sunCompilerResults();
            var timer   = Stopwatch.StartNew();

            try {
                mBinary   = binary;
                mResolver = resolver;
                mContext.Clear();
                mBinary.Open();
                mBinary.BeginText();
                CompileBody(name);
                CompileFunctions();
#if SSC_CLEAN_SYMBOLS
                CleanSymbols();
#endif
                CompileRelocations();
                mBinary.EndText();
                mBinary.BeginData();
                CompileData();
                mBinary.EndData();
                mBinary.BeginSymbol();
                CompileSymbols();
                mBinary.EndSymbol();
                mBinary.Close();

                results.Data    = mContext.DataTable.ToArray();
                results.Symbols = mContext.SymbolTable.Select(i => new sunSymbolInfo(i.Type, i.Name)).ToArray();
            }
            catch (sunCompilerException ex) {
                results.Error = ex;
            }
            timer.Stop();
            results.CompileTime = timer.Elapsed;
            return(results);
        }
示例#4
0
 public sunVariableSetSite(sunBinary binary, sunVariableSymbol symbol)
     : base(binary, symbol)
 {
     mBinary.WriteASS(0, 0);
 }
示例#5
0
 public sunFunctionCallSite(sunBinary binary, sunFunctionSymbol symbol, int argCount)
     : base(binary, symbol)
 {
     mArgCount = argCount;
     mBinary.WriteCALL(0, 0);
 }
示例#6
0
 public sunBuiltinCallSite(sunBinary binary, sunBuiltinSymbol symbol, int argCount)
     : base(binary, symbol)
 {
     mArgCount = argCount;
     mBinary.WriteFUNC(0, 0);
 }
示例#7
0
 public sunJumpSite(sunBinary binary)
     : base(binary)
 {
     mBinary.WriteJMP(0);
 }
示例#8
0
 public sunJumpNotEqualSite(sunBinary binary)
     : base(binary)
 {
     mBinary.WriteJNE(0);
 }
示例#9
0
 public sunVariableDecSite(sunBinary binary, sunVariableSymbol symbol)
     : base(binary, symbol)
 {
     mBinary.WriteDEC(0, 0);
 }