mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-29 00:36:32 +00:00
dbf8647d59
Added top & right borders to RawDr. Improved spacing in some debug and compiler reporting. Fixed RawPutChar and EdLite tab width. Fixed Ui missing '0x' prefix syntax highlighter bug. Added 32BitPaint demo.
404 lines
37 KiB
HTML
Executable file
404 lines
37 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.08">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParsePush</span><span class=cF0>(</span><span class=cF9>CParseStack</span><span class=cF0> *ps,</span><span class=cF9>I64</span><span class=cF0> val)
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> ps->stack[++ps->ptr] = val;
|
|
<a name="l4"></a>}
|
|
<a name="l5"></a>
|
|
<a name="l6"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>ParsePop</span><span class=cF0>(</span><span class=cF9>CParseStack</span><span class=cF0> *ps)
|
|
<a name="l7"></a>{
|
|
<a name="l8"></a> </span><span class=cF1>return</span><span class=cF0> ps->stack[ps->ptr--];
|
|
<a name="l9"></a>}
|
|
<a name="l10"></a>
|
|
<a name="l11"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParsePush2</span><span class=cF0>(</span><span class=cF9>CParseStack</span><span class=cF0> *ps, </span><span class=cF9>I64</span><span class=cF0> val)
|
|
<a name="l12"></a>{
|
|
<a name="l13"></a> ps->stack2[++ps->ptr2] = val;
|
|
<a name="l14"></a>}
|
|
<a name="l15"></a>
|
|
<a name="l16"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>ParsePop2</span><span class=cF0>(</span><span class=cF9>CParseStack</span><span class=cF0> *ps)
|
|
<a name="l17"></a>{
|
|
<a name="l18"></a> </span><span class=cF1>return</span><span class=cF0> ps->stack2[ps->ptr2--];
|
|
<a name="l19"></a>}
|
|
<a name="l20"></a>
|
|
<a name="l21"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParsePopDeref</span><span class=cF0>(</span><span class=cF9>CParseStack</span><span class=cF0> *ps)
|
|
<a name="l22"></a>{
|
|
<a name="l23"></a> </span><span class=cF9>I64</span><span class=cF0> i = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
|
|
<a name="l24"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
|
|
<a name="l25"></a>
|
|
<a name="l26"></a> </span><span class=cF1>if</span><span class=cF0> (i.u16[</span><span class=cFE>0</span><span class=cF0>] != </span><span class=cF3>IC_DEREF</span><span class=cF0>)
|
|
<a name="l27"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l28"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, tmpc);
|
|
<a name="l29"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, i);
|
|
<a name="l30"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l31"></a>}
|
|
<a name="l32"></a>
|
|
<a name="l33"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ParseKeyWord</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l34"></a>{</span><span class=cF2>//Convert cur token to </span><a href="https://tomawezome.github.io/ZealOS/Compiler/OpCodes.DD.html#l147"><span class=cF4>KEYWORD</span></a><span class=cF2> or -1.</span><span class=cF0>
|
|
<a name="l35"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
|
|
<a name="l36"></a>
|
|
<a name="l37"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF3>TK_IDENT</span><span class=cF0> &&</span><span class=cF7>(</span><span class=cF0>tmph = cc->hash_entry</span><span class=cF7>)</span><span class=cF0> && tmph->type & </span><span class=cF3>HTT_KEYWORD</span><span class=cF0>)
|
|
<a name="l38"></a> </span><span class=cF1>return</span><span class=cF0> tmph->user_data0;
|
|
<a name="l39"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l40"></a> </span><span class=cF1>return</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l41"></a>}
|
|
<a name="l42"></a>
|
|
<a name="l43"></a></span><span class=cF9>CHashClass</span><span class=cF0> *</span><span class=cFD>ParseClassNew</span><span class=cF0>()
|
|
<a name="l44"></a>{</span><span class=cF2>/*Ptrs to classes are handled by</span><span class=cF0>
|
|
<a name="l45"></a></span><span class=cF2>allocating 5 structures for each</span><span class=cF0>
|
|
<a name="l46"></a></span><span class=cF2>new class and representing a pointer</span><span class=cF0>
|
|
<a name="l47"></a></span><span class=cF2>to a class by advancing 1 struct forward</span><span class=cF0>
|
|
<a name="l48"></a></span><span class=cF2>for one * and two forward for two **.</span><span class=cF0>
|
|
<a name="l49"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l50"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l51"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *res = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashClass</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF3>PTR_STARS_NUM</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>->code_heap), *tmpc = res;
|
|
<a name="l52"></a>
|
|
<a name="l53"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i <= </span><span class=cF3>PTR_STARS_NUM</span><span class=cF0>; i++)
|
|
<a name="l54"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l55"></a> tmpc->type = </span><span class=cF3>HTT_CLASS</span><span class=cF0>;
|
|
<a name="l56"></a> tmpc->raw_type = </span><span class=cF3>RT_PTR</span><span class=cF0>;
|
|
<a name="l57"></a> tmpc->size = </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *);
|
|
<a name="l58"></a> tmpc->ptr_stars_count = i;
|
|
<a name="l59"></a> tmpc++;
|
|
<a name="l60"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l61"></a> res->last_in_member_list = &res->member_list_and_root;
|
|
<a name="l62"></a> res->size = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l63"></a>
|
|
<a name="l64"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l65"></a>}
|
|
<a name="l66"></a>
|
|
<a name="l67"></a></span><span class=cF9>CHashFun</span><span class=cF0> *</span><span class=cFD>ParseFunNew</span><span class=cF0>()
|
|
<a name="l68"></a>{
|
|
<a name="l69"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l70"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *res = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashFun</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF3>PTR_STARS_NUM</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>->code_heap), *tmpf = res;
|
|
<a name="l71"></a>
|
|
<a name="l72"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i <= </span><span class=cF3>PTR_STARS_NUM</span><span class=cF0>; i++)
|
|
<a name="l73"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l74"></a> tmpf->type = </span><span class=cF3>HTT_FUN</span><span class=cF0>;
|
|
<a name="l75"></a> tmpf->raw_type = </span><span class=cF3>RT_PTR</span><span class=cF0>;
|
|
<a name="l76"></a> tmpf->size = </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *);
|
|
<a name="l77"></a> tmpf->ptr_stars_count = i;
|
|
<a name="l78"></a> tmpf++;
|
|
<a name="l79"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l80"></a> res->last_in_member_list = &res->member_list_and_root;
|
|
<a name="l81"></a> res->size = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l82"></a>
|
|
<a name="l83"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l84"></a>}
|
|
<a name="l85"></a>
|
|
<a name="l86"></a></span><span class=cF9>CIntermediateCode</span><span class=cF0> *</span><span class=cFD>ICAdd</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> opcode_and_precedence, </span><span class=cF9>I64</span><span class=cF0> arg, </span><span class=cF9>CHashClass</span><span class=cF0> *c, </span><span class=cF9>I64</span><span class=cF0> flags=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l87"></a>{
|
|
<a name="l88"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CIntermediateCode</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l89"></a>
|
|
<a name="l90"></a> tmpi->ic_code = opcode_and_precedence.u16[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l91"></a> tmpi->ic_precedence = opcode_and_precedence.u16[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l92"></a> tmpi->ic_data = arg;
|
|
<a name="l93"></a> tmpi->ic_class = c;
|
|
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (cc->pass_trace)
|
|
<a name="l95"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l96"></a> </span><span class=cF5>Bts</span><span class=cF0>(&cc->flags, </span><span class=cF3>CCf_PASS_TRACE_PRESENT</span><span class=cF0>);
|
|
<a name="l97"></a> flags |= </span><span class=cF3>ICF_PASS_TRACE</span><span class=cF0>;
|
|
<a name="l98"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (cc->lock_count)
|
|
<a name="l100"></a> flags |= </span><span class=cF3>ICF_LOCK</span><span class=cF0>;
|
|
<a name="l101"></a> tmpi->ic_flags = flags;
|
|
<a name="l102"></a> tmpi->ic_line = cc->last_line_num;
|
|
<a name="l103"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpi, cc->coc.coc_head.last);
|
|
<a name="l104"></a> </span><span class=cF1>return</span><span class=cF0> tmpi;
|
|
<a name="l105"></a>}
|
|
<a name="l106"></a>
|
|
<a name="l107"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>COCInit</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l108"></a>{
|
|
<a name="l109"></a> </span><span class=cF9>CCodeCtrl</span><span class=cF0> *tmpcbh = &cc->coc;
|
|
<a name="l110"></a>
|
|
<a name="l111"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&tmpcbh->coc_head.next);
|
|
<a name="l112"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&tmpcbh->coc_next_misc);
|
|
<a name="l113"></a> tmpcbh->coc_head.ic_code = </span><span class=cF3>IC_END</span><span class=cF0>;
|
|
<a name="l114"></a>}
|
|
<a name="l115"></a>
|
|
<a name="l116"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>COCPush</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l117"></a>{
|
|
<a name="l118"></a> </span><span class=cF9>CCodeCtrl</span><span class=cF0> *tmpcbh = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CCodeCtrl</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l119"></a>
|
|
<a name="l120"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(tmpcbh, &cc->coc, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CCodeCtrl</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l121"></a> cc->coc.coc_next = tmpcbh;
|
|
<a name="l122"></a>}
|
|
<a name="l123"></a>
|
|
<a name="l124"></a></span><span class=cF9>CCompCtrl</span><span class=cF0> *</span><span class=cFD>COCPopNoFree</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l125"></a>{
|
|
<a name="l126"></a> </span><span class=cF9>CCodeCtrl</span><span class=cF0> *tmpcbh = cc->coc.coc_next;
|
|
<a name="l127"></a>
|
|
<a name="l128"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&cc->coc, tmpcbh, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CCodeCtrl</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l129"></a>
|
|
<a name="l130"></a> </span><span class=cF1>return</span><span class=cF0> tmpcbh;
|
|
<a name="l131"></a>}
|
|
<a name="l132"></a>
|
|
<a name="l133"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>COCPop</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l134"></a>{
|
|
<a name="l135"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFD>COCPopNoFree</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l136"></a>}
|
|
<a name="l137"></a>
|
|
<a name="l138"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>COCAppend</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CCodeCtrl</span><span class=cF0> *tmpcbh)
|
|
<a name="l139"></a>{
|
|
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (tmpcbh->coc_head.next != &cc->coc.coc_head.next)
|
|
<a name="l141"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l142"></a> cc->coc.coc_head.last->next = tmpcbh->coc_head.next;
|
|
<a name="l143"></a> tmpcbh->coc_head.next->last = cc->coc.coc_head.last;
|
|
<a name="l144"></a> cc->coc.coc_head.last = tmpcbh->coc_head.last;
|
|
<a name="l145"></a> tmpcbh->coc_head.last->next = &cc->coc.coc_head.next;
|
|
<a name="l146"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (tmpcbh->coc_next_misc != &cc->coc.coc_next_misc)
|
|
<a name="l148"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l149"></a> cc->coc.coc_last_misc->next = tmpcbh->coc_next_misc;
|
|
<a name="l150"></a> tmpcbh->coc_next_misc->last = cc->coc.coc_last_misc;
|
|
<a name="l151"></a> cc->coc.coc_last_misc = tmpcbh->coc_last_misc;
|
|
<a name="l152"></a> tmpcbh->coc_last_misc->next = &cc->coc.coc_next_misc;
|
|
<a name="l153"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l154"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpcbh);
|
|
<a name="l155"></a>}
|
|
<a name="l156"></a>
|
|
<a name="l157"></a></span><span class=cF9>CCodeMisc</span><span class=cF0> *</span><span class=cFD>COCMiscNew</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> ty)
|
|
<a name="l158"></a>{
|
|
<a name="l159"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *res = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CCodeMisc</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l160"></a>
|
|
<a name="l161"></a> res->addr = </span><span class=cF3>INVALID_PTR</span><span class=cF0>;
|
|
<a name="l162"></a> res->type = ty;
|
|
<a name="l163"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(res, cc->coc.coc_last_misc);
|
|
<a name="l164"></a>
|
|
<a name="l165"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l166"></a>}
|
|
<a name="l167"></a>
|
|
<a name="l168"></a></span><span class=cF9>CCodeMisc</span><span class=cF0> *</span><span class=cFD>COCGoToLabelFind</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF1>U8</span><span class=cF0> *name)
|
|
<a name="l169"></a>{
|
|
<a name="l170"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *cm = cc->coc.coc_next_misc;
|
|
<a name="l171"></a>
|
|
<a name="l172"></a> </span><span class=cF1>while</span><span class=cF0> (cm != &cc->coc.coc_next_misc)
|
|
<a name="l173"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l174"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>cm->type == </span><span class=cF3>CMT_GOTO_LABEL</span><span class=cF0> || cm->type == </span><span class=cF3>CMT_ASM_LABEL</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>cm->str, name</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l175"></a> </span><span class=cF1>return</span><span class=cF0> cm;
|
|
<a name="l176"></a> cm = cm->next;
|
|
<a name="l177"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l178"></a>
|
|
<a name="l179"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l180"></a>}
|
|
<a name="l181"></a>
|
|
<a name="l182"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>COCFloatConstFind</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF1>F64</span><span class=cF0> d)
|
|
<a name="l183"></a>{
|
|
<a name="l184"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l185"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *cm = cc->coc.coc_next_misc;
|
|
<a name="l186"></a>
|
|
<a name="l187"></a> </span><span class=cF1>while</span><span class=cF0> (cm != &cc->coc.coc_next_misc)
|
|
<a name="l188"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l189"></a> </span><span class=cF1>if</span><span class=cF0> (cm->type == </span><span class=cF3>CMT_FLOAT_CONSTS</span><span class=cF0>)
|
|
<a name="l190"></a> {
|
|
<a name="l191"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < cm->num_consts; i++)
|
|
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (cm->float_consts[i] == d)
|
|
<a name="l193"></a> </span><span class=cF1>return</span><span class=cF0> cm->addr + i * </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF1>F64</span><span class=cF0>);
|
|
<a name="l194"></a> </span><span class=cF1>if</span><span class=cF0> (cm->num_consts < </span><span class=cF3>CM_CONSTS_NUM</span><span class=cF0>)
|
|
<a name="l195"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l196"></a> cm->float_consts[cm->num_consts++] = d;
|
|
<a name="l197"></a> </span><span class=cF1>return</span><span class=cF0> cm->addr + i * </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF1>F64</span><span class=cF0>);
|
|
<a name="l198"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l199"></a> }
|
|
<a name="l200"></a> cm = cm->next;
|
|
<a name="l201"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l202"></a> cm = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_FLOAT_CONSTS</span><span class=cF0>);
|
|
<a name="l203"></a> cm->float_consts = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF3>CM_CONSTS_NUM</span><span class=cF0> * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>F64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l204"></a> cm->float_consts[cm->num_consts++] = d;
|
|
<a name="l205"></a>
|
|
<a name="l206"></a> </span><span class=cF1>return</span><span class=cF0> cm->addr;
|
|
<a name="l207"></a>}
|
|
<a name="l208"></a>
|
|
<a name="l209"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>COCDel</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CCodeCtrl</span><span class=cF0> *coc)
|
|
<a name="l210"></a>{
|
|
<a name="l211"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *cm, *cm1;
|
|
<a name="l212"></a> </span><span class=cF1>U8</span><span class=cF0> *undef = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l213"></a>
|
|
<a name="l214"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&coc->coc_head.next);
|
|
<a name="l215"></a> cm = coc->coc_next_misc;
|
|
<a name="l216"></a> </span><span class=cF1>while</span><span class=cF0> (cm != &coc->coc_next_misc)
|
|
<a name="l217"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l218"></a> cm1 = cm->next;
|
|
<a name="l219"></a> </span><span class=cF1>switch</span><span class=cF0> (cm->type)
|
|
<a name="l220"></a> {
|
|
<a name="l221"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CMT_GOTO_LABEL</span><span class=cF0>:
|
|
<a name="l222"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CMT_ASM_LABEL</span><span class=cF0>:
|
|
<a name="l223"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cm->flags & </span><span class=cF3>CMF_DEFINED</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l224"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l225"></a> undef = cm->str;
|
|
<a name="l226"></a> cm->str = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l227"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l228"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!cm->use_count)
|
|
<a name="l229"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l230"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Unused label %s\n"</span><span class=cF0>, cm->str);
|
|
<a name="l231"></a> </span><span class=cF5>LexWarn</span><span class=cF0>(cc, </span><span class=cF6>"Unused label at "</span><span class=cF0>);
|
|
<a name="l232"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l233"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l234"></a>
|
|
<a name="l235"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CMT_JMP_TABLE</span><span class=cF0>:
|
|
<a name="l236"></a> </span><span class=cF5>Free</span><span class=cF0>(cm->jmp_table);
|
|
<a name="l237"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l238"></a>
|
|
<a name="l239"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CMT_FLOAT_CONSTS</span><span class=cF0>:
|
|
<a name="l240"></a> </span><span class=cF5>Free</span><span class=cF0>(cm->float_consts);
|
|
<a name="l241"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l242"></a>
|
|
<a name="l243"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CMT_ARRAY_DIM</span><span class=cF0>:
|
|
<a name="l244"></a> </span><span class=cF5>LinkedListDel</span><span class=cF0>(cm->dim);
|
|
<a name="l245"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l246"></a>
|
|
<a name="l247"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CMT_HASH_ENTRY</span><span class=cF0>:
|
|
<a name="l248"></a> </span><span class=cF5>HashDel</span><span class=cF0>(cm->h);
|
|
<a name="l249"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l250"></a> }
|
|
<a name="l251"></a> </span><span class=cF5>Free</span><span class=cF0>(cm->str);
|
|
<a name="l252"></a> </span><span class=cF5>Free</span><span class=cF0>(cm);
|
|
<a name="l253"></a> cm = cm1;
|
|
<a name="l254"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l255"></a> </span><span class=cF1>if</span><span class=cF0> (undef)
|
|
<a name="l256"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l257"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Undefined goto label %s\n"</span><span class=cF0>, undef);
|
|
<a name="l258"></a> </span><span class=cF5>Free</span><span class=cF0>(undef);
|
|
<a name="l259"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Undefined goto label at "</span><span class=cF0>);
|
|
<a name="l260"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l261"></a>}
|
|
<a name="l262"></a>
|
|
<a name="l263"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> pass, </span><span class=cF1>Bool</span><span class=cF0> put)
|
|
<a name="l264"></a>{
|
|
<a name="l265"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi;
|
|
<a name="l266"></a>
|
|
<a name="l267"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->flags, </span><span class=cF3>CCf_PASS_TRACE_PRESENT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l268"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l269"></a> </span><span class=cF1>if</span><span class=cF0> (put)
|
|
<a name="l270"></a> {
|
|
<a name="l271"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->saved_pass_trace, pass - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l272"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l273"></a> </span><span class=cF6>"$IV,1$Pass %d:$IV,0$\n"</span><span class=cF0>, pass - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l274"></a> tmpi = cc->coc.coc_head.next;
|
|
<a name="l275"></a> </span><span class=cF1>while</span><span class=cF0> (tmpi->ic_code)
|
|
<a name="l276"></a> {
|
|
<a name="l277"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->ic_flags & </span><span class=cF3>ICF_PASS_TRACE</span><span class=cF0>)
|
|
<a name="l278"></a> </span><span class=cFD>ICPut</span><span class=cF0>(cc, tmpi);
|
|
<a name="l279"></a> tmpi = tmpi->next;
|
|
<a name="l280"></a> }
|
|
<a name="l281"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l282"></a> }
|
|
<a name="l283"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->saved_pass_trace, pass</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l284"></a> </span><span class=cF6>"$IV,1$Pass %d:$IV,0$\n"</span><span class=cF0>, pass;
|
|
<a name="l285"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l286"></a> cc->pass = pass;
|
|
<a name="l287"></a>}
|
|
<a name="l288"></a>
|
|
<a name="l289"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cFD>COCCompile</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> *_code_size, </span><span class=cF9>CDebugInfo</span><span class=cF0> **_debug, </span><span class=cF9>I64</span><span class=cF0> *_type)
|
|
<a name="l290"></a>{
|
|
<a name="l291"></a> </span><span class=cF1>U8</span><span class=cF0> *res;
|
|
<a name="l292"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb;
|
|
<a name="l293"></a> </span><span class=cF9>I64</span><span class=cF0> i, code_size, last_code_size;
|
|
<a name="l294"></a>
|
|
<a name="l295"></a> </span><span class=cF9>COptReg</span><span class=cF0> reg_offsets[</span><span class=cF3>REG_REGS_NUM</span><span class=cF0>];
|
|
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (_debug)
|
|
<a name="l297"></a> *_debug = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l298"></a> cc->pass = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l299"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l300"></a> </span><span class=cFD>OptPass012</span><span class=cF0>(cc);
|
|
<a name="l301"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l302"></a> </span><span class=cFD>OptPass012</span><span class=cF0>(cc);
|
|
<a name="l303"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>3</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l304"></a> </span><span class=cFD>OptPass3</span><span class=cF0>(cc, reg_offsets);
|
|
<a name="l305"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>4</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l306"></a> </span><span class=cFD>OptPass4</span><span class=cF0>(cc, reg_offsets, _type);
|
|
<a name="l307"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>5</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l308"></a> </span><span class=cFD>OptPass5</span><span class=cF0>(cc);
|
|
<a name="l309"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>6</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l310"></a> </span><span class=cFD>OptPass6</span><span class=cF0>(cc);
|
|
<a name="l311"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>7</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l312"></a>
|
|
<a name="l313"></a> lb = cc->coc.coc_next_misc;
|
|
<a name="l314"></a> </span><span class=cF1>while</span><span class=cF0> (lb != &cc->coc.coc_next_misc)
|
|
<a name="l315"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l316"></a> </span><span class=cF1>if</span><span class=cF0> (lb->type == </span><span class=cF3>CMT_JMP_TABLE</span><span class=cF0>)
|
|
<a name="l317"></a> {
|
|
<a name="l318"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < lb->range; i++)
|
|
<a name="l319"></a> lb->jmp_table[i] = </span><span class=cFD>OptLabelFwd</span><span class=cF0>(lb->jmp_table[i]);
|
|
<a name="l320"></a> lb-></span><span class=cF1>default</span><span class=cF0> = </span><span class=cFD>OptLabelFwd</span><span class=cF0>(lb-></span><span class=cF1>default</span><span class=cF0>);
|
|
<a name="l321"></a> }
|
|
<a name="l322"></a> lb = lb->next;
|
|
<a name="l323"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l324"></a>
|
|
<a name="l325"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>7</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l326"></a> </span><span class=cFD>OptPass789A</span><span class=cF0>(cc, reg_offsets, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l327"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>8</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l328"></a> </span><span class=cFD>OptPass789A</span><span class=cF0>(cc, reg_offsets, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l329"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>9</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l330"></a> code_size = </span><span class=cFD>OptPass789A</span><span class=cF0>(cc, reg_offsets, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l331"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l332"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l333"></a> last_code_size = code_size;
|
|
<a name="l334"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>9</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l335"></a> code_size = </span><span class=cFD>OptPass789A</span><span class=cF0>(cc, reg_offsets, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l336"></a> </span><span class=cF1>if</span><span class=cF0> (code_size > last_code_size)
|
|
<a name="l337"></a> {
|
|
<a name="l338"></a> </span><span class=cF6>"Pass:9 Code Size\n"</span><span class=cF0>;
|
|
<a name="l339"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Compiler Optimization Error at "</span><span class=cF0>);
|
|
<a name="l340"></a> }
|
|
<a name="l341"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l342"></a> </span><span class=cF1>while</span><span class=cF0> (code_size < last_code_size);
|
|
<a name="l343"></a>
|
|
<a name="l344"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l345"></a> res = </span><span class=cF5>MAlloc</span><span class=cF0>(code_size);
|
|
<a name="l346"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l347"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l348"></a> res = </span><span class=cF5>MAlloc</span><span class=cF0>(code_size, </span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l349"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun)
|
|
<a name="l350"></a> </span><span class=cF5>Fs</span><span class=cF0>->last_fun = cc->htc.fun;
|
|
<a name="l351"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l352"></a> </span><span class=cFD>COCHeaderPut</span><span class=cF0>(cc, </span><span class=cFE>10</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l353"></a> code_size = </span><span class=cFD>OptPass789A</span><span class=cF0>(cc, reg_offsets, res, _debug);
|
|
<a name="l354"></a>
|
|
<a name="l355"></a> </span><span class=cFD>COCDel</span><span class=cF0>(cc, &cc->coc);
|
|
<a name="l356"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->opts, </span><span class=cF3>OPTf_TRACE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l357"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l359"></a> {
|
|
<a name="l360"></a> </span><span class=cF1>if</span><span class=cF0> (cc->aotc->seg_size == </span><span class=cFE>16</span><span class=cF0>)
|
|
<a name="l361"></a> </span><span class=cF5>Un</span><span class=cF0>(res, code_size, </span><span class=cFE>16</span><span class=cF0>);
|
|
<a name="l362"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->aotc->seg_size == </span><span class=cFE>64</span><span class=cF0>)
|
|
<a name="l363"></a> </span><span class=cF5>Un</span><span class=cF0>(res, code_size, </span><span class=cFE>64</span><span class=cF0>);
|
|
<a name="l364"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l365"></a> </span><span class=cF5>Un</span><span class=cF0>(res, code_size, </span><span class=cFE>32</span><span class=cF0>);
|
|
<a name="l366"></a> }
|
|
<a name="l367"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l368"></a> </span><span class=cF5>Un</span><span class=cF0>(res,code_size, </span><span class=cFE>64</span><span class=cF0>);
|
|
<a name="l369"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l370"></a> </span><span class=cF1>if</span><span class=cF0> (_code_size)
|
|
<a name="l371"></a> *_code_size = code_size;
|
|
<a name="l372"></a> cc->saved_pass_trace = cc->pass_trace;
|
|
<a name="l373"></a>
|
|
<a name="l374"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l375"></a>}
|
|
</span></pre></body>
|
|
</html>
|