ZealOS/docs/Compiler/CMain.CC.html
2021-12-04 05:03:02 -05:00

840 lines
86 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.06">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>LexStatement2Bin</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> *_type, </span><span class=cF9>I64</span><span class=cF0> comp_flags=</span><span class=cFE>0</span><span class=cF0>)
<a name="l2"></a>{</span><span class=cF2>//Compile one cc statement to bin code.</span><span class=cF0>
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> size, i, j, k, *res = </span><span class=cF3>INVALID_PTR</span><span class=cF0>;
<a name="l4"></a> </span><span class=cF9>CCodeCtrl</span><span class=cF0> *tmpcbh;
<a name="l5"></a>
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (_type)
<a name="l7"></a> *_type = </span><span class=cF3>RT_I64</span><span class=cF0>;
<a name="l8"></a> </span><span class=cF5>Btr</span><span class=cF0>(&amp;cc-&gt;flags, </span><span class=cF3>CCf_PASS_TRACE_PRESENT</span><span class=cF0>);
<a name="l9"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;aot_depth == </span><span class=cFE>2</span><span class=cF0>)
<a name="l10"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
<a name="l11"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseStatement</span><span class=cF7>(</span><span class=cF0>cc,,, comp_flags</span><span class=cF7>)</span><span class=cF0>)
<a name="l13"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;coc.coc_head.next != &amp;cc-&gt;coc.coc_head)
<a name="l15"></a> {
<a name="l16"></a> cc-&gt;coc.coc_head.last-&gt;ic_flags &amp;= ~</span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF0>;
<a name="l17"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RETURN_VAL2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l18"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RET</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (res = </span><span class=cFD>COCCompile</span><span class=cF7>(</span><span class=cF0>cc, &amp;size, </span><span class=cF3>NULL</span><span class=cF0>, _type</span><span class=cF7>)</span><span class=cF0>)
<a name="l20"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;flags &amp; </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
<a name="l22"></a> {
<a name="l23"></a> j = cc-&gt;aotc-&gt;rip;
<a name="l24"></a> k = (size + </span><span class=cFE>7</span><span class=cF0>) &gt;&gt; </span><span class=cFE>3</span><span class=cF0>;
<a name="l25"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; k; i++)
<a name="l26"></a> </span><span class=cFD>AOTStoreCodeU64</span><span class=cF0>(cc, res[i]);
<a name="l27"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
<a name="l28"></a> res = j;
<a name="l29"></a> }
<a name="l30"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l31"></a> } </span><span class=cF2>//TODO: else del misc?</span><span class=cF0>
<a name="l32"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l33"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF2>//TODO: too dangerous to del Misc?</span><span class=cF0>
<a name="l34"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;cc-&gt;coc.coc_head.next);
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;aot_depth == </span><span class=cFE>2</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l36"></a> tmpcbh = </span><span class=cFD>COCPopNoFree</span><span class=cF0>(cc);
<a name="l37"></a> </span><span class=cFD>COCAppend</span><span class=cF0>(cc, tmpcbh);
<a name="l38"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l39"></a>
<a name="l40"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l41"></a>}
<a name="l42"></a>
<a name="l43"></a></span><span class=cF9>CAOT</span><span class=cF0> *</span><span class=cFD>CompJoin</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> comp_flags, </span><span class=cF1>U8</span><span class=cF0> *map_name=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> mapfile_drive_let=</span><span class=cFE>0</span><span class=cF0>)
<a name="l44"></a>{
<a name="l45"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc, *old_aot = cc-&gt;aotc;
<a name="l46"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, l;
<a name="l47"></a> </span><span class=cF1>U8</span><span class=cF0> *buf;
<a name="l48"></a> </span><span class=cF9>CAOTBinBlk</span><span class=cF0> *tmpbin;
<a name="l49"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie;
<a name="l50"></a> </span><span class=cF1>Bool</span><span class=cF0> okay = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l51"></a> </span><span class=cF9>CLexHashTableContext</span><span class=cF0> *htc = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CLexHashTableContext</span><span class=cF7>)</span><span class=cF0>);
<a name="l52"></a> </span><span class=cF9>CAOT</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>CAOT</span><span class=cF7>)</span><span class=cF0>), *parent;
<a name="l53"></a>
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (parent = cc-&gt;aot)
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l56"></a> res-&gt;parent_aot = parent;
<a name="l57"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(res, parent-&gt;last);
<a name="l58"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l59"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l60"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(res);
<a name="l61"></a> cc-&gt;aot = res;
<a name="l62"></a>
<a name="l63"></a> res-&gt;next_ie = res-&gt;last_ie = &amp;res-&gt;next_ie;
<a name="l64"></a> cc-&gt;aotc = aotc = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTCtrl</span><span class=cF7>)</span><span class=cF0>);
<a name="l65"></a> cc-&gt;aot_depth++;
<a name="l66"></a>
<a name="l67"></a> aotc-&gt;bin = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTBinBlk</span><span class=cF7>)</span><span class=cF0>);
<a name="l68"></a> aotc-&gt;max_align_bits = </span><span class=cFE>0</span><span class=cF0>;
<a name="l69"></a> aotc-&gt;org = </span><span class=cF3>INVALID_PTR</span><span class=cF0>;
<a name="l70"></a>
<a name="l71"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(htc, &amp;cc-&gt;htc, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CLexHashTableContext</span><span class=cF7>)</span><span class=cF0>);
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;htc.fun)
<a name="l73"></a> cc-&gt;htc.global_hash_table = </span><span class=cF5>HashTableNew</span><span class=cF0>(</span><span class=cFE>128</span><span class=cF0>);
<a name="l74"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l75"></a> cc-&gt;htc.global_hash_table = </span><span class=cF5>HashTableNew</span><span class=cF0>(</span><span class=cFE>1024</span><span class=cF0>);
<a name="l76"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;flags &amp; </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
<a name="l77"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l78"></a> cc-&gt;htc.define_hash_table = cc-&gt;htc.global_hash_table;
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;aot_depth &lt;= </span><span class=cFE>1</span><span class=cF0>)
<a name="l80"></a> cc-&gt;htc.global_hash_table-&gt;next = </span><span class=cFB>cmp</span><span class=cF0>.asm_hash;
<a name="l81"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l82"></a> cc-&gt;htc.global_hash_table-&gt;next = htc-&gt;global_hash_table;
<a name="l83"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l84"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l85"></a> cc-&gt;htc.global_hash_table-&gt;next = </span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table;
<a name="l86"></a> cc-&gt;htc.hash_table_list = cc-&gt;htc.local_hash_table = </span><span class=cF5>HashTableNew</span><span class=cF0>(</span><span class=cFE>16</span><span class=cF0>);
<a name="l87"></a> cc-&gt;htc.local_hash_table-&gt;next = cc-&gt;htc.global_hash_table;
<a name="l88"></a> cc-&gt;htc.local_var_list = cc-&gt;htc.fun; </span><span class=cF2>//CosmiC local variables</span><span class=cF0>
<a name="l89"></a> cc-&gt;htc.fun = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l90"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l91"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (comp_flags &amp; </span><span class=cF3>CMPF_LEX_FIRST</span><span class=cF0>)
<a name="l93"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>comp_flags &amp; </span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF7>)</span><span class=cF0>)
<a name="l95"></a> comp_flags |= </span><span class=cF3>CMPF_PRS_SEMICOLON</span><span class=cF0>;
<a name="l96"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;flags &amp; </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
<a name="l97"></a> {
<a name="l98"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token != </span><span class=cF3>TK_EOF</span><span class=cF0>)
<a name="l99"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l100"></a> buf = </span><span class=cF5>LexStatement2Bin</span><span class=cF0>(cc, </span><span class=cF3>NULL</span><span class=cF0>, comp_flags);
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (buf != </span><span class=cF3>INVALID_PTR</span><span class=cF0>)
<a name="l102"></a> {
<a name="l103"></a> tmpie = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTImportExport</span><span class=cF7>)</span><span class=cF0>);
<a name="l104"></a> tmpie-&gt;type = </span><span class=cF3>IET_MAIN</span><span class=cF0>;
<a name="l105"></a> tmpie-&gt;rip = buf;
<a name="l106"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpie, res-&gt;last_ie);
<a name="l107"></a> }
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (comp_flags &amp; </span><span class=cF3>CMPF_ASM_BLK</span><span class=cF0>)
<a name="l109"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l110"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l111"></a> }
<a name="l112"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l113"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc,,, comp_flags);
<a name="l114"></a> </span><span class=cFD>AOTGlobalsResolve</span><span class=cF0>(cc, res);
<a name="l115"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l116"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l117"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;except_ch == </span><span class=cF6>'Compiler'</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>comp_flags &amp; </span><span class=cF3>CMPF_ASM_BLK</span><span class=cF7>)</span><span class=cF0>)
<a name="l119"></a> {
<a name="l120"></a> </span><span class=cF5>LexPutPos</span><span class=cF0>(cc);
<a name="l121"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l122"></a> }
<a name="l123"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l124"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (!okay)
<a name="l126"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;error_count &lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l128"></a> cc-&gt;error_count = </span><span class=cFE>1</span><span class=cF0>;
<a name="l129"></a> cc-&gt;aot = res-&gt;parent_aot;
<a name="l130"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
<a name="l131"></a> </span><span class=cF5>LinkedListDel</span><span class=cF0>(aotc-&gt;bin);
<a name="l132"></a> res = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l133"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l134"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l135"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (map_name)
<a name="l137"></a> </span><span class=cFD>MapFileWrite</span><span class=cF0>(cc-&gt;htc.global_hash_table, map_name, mapfile_drive_let);
<a name="l138"></a> </span><span class=cF5>HashTableDel</span><span class=cF0>(cc-&gt;htc.local_hash_table);
<a name="l139"></a> </span><span class=cF5>HashTableDel</span><span class=cF0>(cc-&gt;htc.global_hash_table);
<a name="l140"></a>
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (!aotc-&gt;num_bin_U8s)
<a name="l142"></a> res-&gt;buf = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l143"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l144"></a> {
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;flags &amp; </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
<a name="l146"></a> res-&gt;buf = </span><span class=cF5>MAlloc</span><span class=cF0>(aotc-&gt;num_bin_U8s);
<a name="l147"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l148"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (aotc-&gt;org == </span><span class=cF3>INVALID_PTR</span><span class=cF0>)
<a name="l150"></a> res-&gt;buf = </span><span class=cF5>MAlloc</span><span class=cF0>(aotc-&gt;num_bin_U8s, </span><span class=cF5>Fs</span><span class=cF0>-&gt;code_heap);
<a name="l151"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l152"></a> res-&gt;buf = aotc-&gt;org;
<a name="l153"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l154"></a> res-&gt;aot_U8s = aotc-&gt;num_bin_U8s;
<a name="l155"></a> tmpbin = aotc-&gt;bin;
<a name="l156"></a> j = </span><span class=cFE>0</span><span class=cF0>;
<a name="l157"></a> l = aotc-&gt;num_bin_U8s;
<a name="l158"></a> </span><span class=cF1>while</span><span class=cF0> (tmpbin)
<a name="l159"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l160"></a> i = l;
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt; </span><span class=cF3>AOT_BIN_BLK_SIZE</span><span class=cF0>)
<a name="l162"></a> i = </span><span class=cF3>AOT_BIN_BLK_SIZE</span><span class=cF0>;
<a name="l163"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(res-&gt;buf + j, tmpbin-&gt;body, i);
<a name="l164"></a> j += i;
<a name="l165"></a> l -= i;
<a name="l166"></a> tmpbin = tmpbin-&gt;next;
<a name="l167"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l168"></a> }
<a name="l169"></a> </span><span class=cF5>LinkedListDel</span><span class=cF0>(aotc-&gt;bin);
<a name="l170"></a> res-&gt;abss = aotc-&gt;abss;
<a name="l171"></a> res-&gt;heap_globals = aotc-&gt;heap_globals;
<a name="l172"></a> res-&gt;max_align_bits = aotc-&gt;max_align_bits;
<a name="l173"></a> res-&gt;org = aotc-&gt;org;
<a name="l174"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l175"></a> cc-&gt;aot = parent;
<a name="l176"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;cc-&gt;htc, htc, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CLexHashTableContext</span><span class=cF7>)</span><span class=cF0>);
<a name="l177"></a> </span><span class=cF5>Free</span><span class=cF0>(htc);
<a name="l178"></a> </span><span class=cF5>Free</span><span class=cF0>(aotc);
<a name="l179"></a> cc-&gt;aotc = old_aot;
<a name="l180"></a> cc-&gt;aot_depth--;
<a name="l181"></a>
<a name="l182"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l183"></a>}
<a name="l184"></a>
<a name="l185"></a></span><span class=cF9>CAOT</span><span class=cF0> *</span><span class=cFD>CompBuf</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF1>U8</span><span class=cF0> *map_name=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> *error_count=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> *warning_count=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> mapfile_drive_let=</span><span class=cFE>0</span><span class=cF0>)
<a name="l186"></a>{
<a name="l187"></a> </span><span class=cF9>CCompCtrl</span><span class=cF0> *cc;
<a name="l188"></a> </span><span class=cF9>CAOT</span><span class=cF0> *res = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l189"></a>
<a name="l190"></a> cc = </span><span class=cF5>CompCtrlNew</span><span class=cF0>(buf, </span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>);
<a name="l191"></a> cc-&gt;flags |= </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>;
<a name="l192"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(cc, </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc);
<a name="l193"></a> res = </span><span class=cFD>CompJoin</span><span class=cF0>(cc, </span><span class=cF3>CMPF_LEX_FIRST</span><span class=cF0>, map_name, mapfile_drive_let);
<a name="l194"></a> </span><span class=cF1>if</span><span class=cF0> (error_count)
<a name="l195"></a> *error_count = cc-&gt;error_count;
<a name="l196"></a> </span><span class=cF1>if</span><span class=cF0> (warning_count)
<a name="l197"></a> *warning_count = cc-&gt;warning_count;
<a name="l198"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(cc);
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (res)
<a name="l200"></a> </span><span class=cF5>CompCtrlDel</span><span class=cF0>(cc);
<a name="l201"></a>
<a name="l202"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l203"></a>}
<a name="l204"></a>
<a name="l205"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>CompFixUpJITAsm</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CAOT</span><span class=cF0> *tmpaot)
<a name="l206"></a>{
<a name="l207"></a> </span><span class=cF9>I64</span><span class=cF0> i, rip2 = tmpaot-&gt;buf + tmpaot-&gt;rip, *str = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l208"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l209"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *g_lb;
<a name="l210"></a> </span><span class=cF9>CAOTAbsAddr</span><span class=cF0> *tmpa, *tmpa1;
<a name="l211"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie, *tmpie1;
<a name="l212"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex;
<a name="l213"></a>
<a name="l214"></a> tmpa = tmpaot-&gt;abss;
<a name="l215"></a> </span><span class=cF1>while</span><span class=cF0> (tmpa)
<a name="l216"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l217"></a> tmpa1 = tmpa-&gt;next;
<a name="l218"></a> ptr = rip2 + tmpa-&gt;rip;
<a name="l219"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpa-&gt;type]
<a name="l220"></a> {
<a name="l221"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_ADD_U8</span><span class=cF0>: *ptr(</span><span class=cF1>U8</span><span class=cF0> *) += rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l222"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_SUB_U8</span><span class=cF0>: *ptr(</span><span class=cF1>U8</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l223"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_ADD_U16</span><span class=cF0>: *ptr(</span><span class=cF9>U16</span><span class=cF0> *) += rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l224"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_SUB_U16</span><span class=cF0>: *ptr(</span><span class=cF9>U16</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l225"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_ADD_U32</span><span class=cF0>: *ptr(</span><span class=cF9>U32</span><span class=cF0> *) += rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l226"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_SUB_U32</span><span class=cF0>: *ptr(</span><span class=cF9>U32</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l227"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_ADD_U64</span><span class=cF0>: *ptr(</span><span class=cF9>I64</span><span class=cF0> *) += rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l228"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_SUB_U64</span><span class=cF0>: *ptr(</span><span class=cF9>I64</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l229"></a> }
<a name="l230"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpa);
<a name="l231"></a> tmpa = tmpa1;
<a name="l232"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l233"></a> tmpie = tmpaot-&gt;next_ie;
<a name="l234"></a> </span><span class=cF1>while</span><span class=cF0> (tmpie != &amp;tmpaot-&gt;next_ie)
<a name="l235"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l236"></a> tmpie1 = tmpie-&gt;next;
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str)
<a name="l238"></a> {
<a name="l239"></a> </span><span class=cF5>Free</span><span class=cF0>(str);
<a name="l240"></a> str = tmpie-&gt;str;
<a name="l241"></a> }
<a name="l242"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpie-&gt;type)
<a name="l243"></a> {
<a name="l244"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL32_EXPORT</span><span class=cF0>:
<a name="l245"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM32_EXPORT</span><span class=cF0>:
<a name="l246"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL64_EXPORT</span><span class=cF0>:
<a name="l247"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM64_EXPORT</span><span class=cF0>:
<a name="l248"></a> tmpex = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashExport</span><span class=cF7>)</span><span class=cF0>);
<a name="l249"></a> tmpex-&gt;str = str;
<a name="l250"></a> str = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l251"></a> tmpex-&gt;type = </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0> | </span><span class=cF3>HTF_IMM</span><span class=cF0>;
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;type == </span><span class=cF3>IET_IMM32_EXPORT</span><span class=cF0> || tmpie-&gt;type == </span><span class=cF3>IET_IMM64_EXPORT</span><span class=cF0>)
<a name="l253"></a> tmpex-&gt;val = tmpie-&gt;rip;
<a name="l254"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l255"></a> tmpex-&gt;val = tmpie-&gt;rip + rip2;
<a name="l256"></a> tmpex-&gt;src_link = tmpie-&gt;src_link;
<a name="l257"></a> tmpie-&gt;src_link = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l258"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpex, </span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table);
<a name="l259"></a> </span><span class=cF5>SysSymImportsResolve</span><span class=cF0>(tmpex-&gt;str);
<a name="l260"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l261"></a>
<a name="l262"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I0</span><span class=cF0>...</span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
<a name="l263"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str)
<a name="l264"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l265"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;flags &amp; </span><span class=cF3>IEF_GOTO_LABEL</span><span class=cF0>)
<a name="l266"></a> {
<a name="l267"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>g_lb = </span><span class=cFD>COCGoToLabelFind</span><span class=cF0>(cc, str)</span><span class=cF7>)</span><span class=cF0>)
<a name="l268"></a> </span><span class=cF6>&quot;Unresolved Reference:%s\n&quot;</span><span class=cF0>, str;
<a name="l269"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l270"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l271"></a> g_lb-&gt;use_count++;
<a name="l272"></a> g_lb = </span><span class=cFD>OptLabelFwd</span><span class=cF0>(g_lb);
<a name="l273"></a> i = g_lb-&gt;addr + tmpaot-&gt;buf;
<a name="l274"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l275"></a> tmpex = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l276"></a> }
<a name="l277"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l278"></a> {
<a name="l279"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpex = </span><span class=cF5>HashFind</span><span class=cF0>(str, </span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table, </span><span class=cF3>HTG_ALL</span><span class=cF0> - </span><span class=cF3>HTT_IMPORT_SYS_SYM</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
<a name="l280"></a> </span><span class=cF6>&quot;Unresolved Reference:%s\n&quot;</span><span class=cF0>, str;
<a name="l281"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l282"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex-&gt;type &amp; </span><span class=cF3>HTT_FUN</span><span class=cF0>)
<a name="l284"></a> i = tmpex(</span><span class=cF9>CHashFun</span><span class=cF0> *)-&gt;exe_addr;
<a name="l285"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpex-&gt;type &amp; </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>)
<a name="l286"></a> i = tmpex(</span><span class=cF9>CHashGlobalVar</span><span class=cF0> *)-&gt;data_addr;
<a name="l287"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l288"></a> i = tmpex-&gt;val;
<a name="l289"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l290"></a> g_lb = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l291"></a> }
<a name="l292"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l293"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex || g_lb)
<a name="l294"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l295"></a> ptr = tmpie-&gt;rip + rip2;
<a name="l296"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpie-&gt;type]
<a name="l297"></a> {
<a name="l298"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I0</span><span class=cF0>:
<a name="l299"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U0</span><span class=cF0>:
<a name="l300"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l301"></a>
<a name="l302"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I8</span><span class=cF0>:
<a name="l303"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>I8_MIN</span><span class=cF0> &lt;= i - ptr - </span><span class=cFE>1</span><span class=cF0> &lt;= </span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l304"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Branch out of range at &quot;</span><span class=cF0>);
<a name="l305"></a> *ptr(</span><span class=cF1>U8</span><span class=cF0> *) = i - ptr - </span><span class=cFE>1</span><span class=cF0>;
<a name="l306"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l307"></a>
<a name="l308"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U8</span><span class=cF0>:
<a name="l309"></a> *ptr(</span><span class=cF1>U8</span><span class=cF0> *) = i;
<a name="l310"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l311"></a>
<a name="l312"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I16</span><span class=cF0>:
<a name="l313"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>I16_MIN</span><span class=cF0> &lt;= i - ptr - </span><span class=cFE>2</span><span class=cF0> &lt;= </span><span class=cF3>I16_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l314"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Branch out of range at &quot;</span><span class=cF0>);
<a name="l315"></a> *ptr(</span><span class=cF9>U16</span><span class=cF0> *) = i - ptr - </span><span class=cFE>2</span><span class=cF0>;
<a name="l316"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l317"></a>
<a name="l318"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U16</span><span class=cF0>:
<a name="l319"></a> *ptr(</span><span class=cF9>U16</span><span class=cF0> *) = i;
<a name="l320"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l321"></a>
<a name="l322"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I32</span><span class=cF0>:
<a name="l323"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>I32_MIN</span><span class=cF0> &lt;= i - ptr - </span><span class=cFE>4</span><span class=cF0> &lt;= </span><span class=cF3>I32_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l324"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Branch out of range at &quot;</span><span class=cF0>);
<a name="l325"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *) = i - ptr - </span><span class=cFE>4</span><span class=cF0>;
<a name="l326"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l327"></a>
<a name="l328"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U32</span><span class=cF0>:
<a name="l329"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *) = i;
<a name="l330"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l331"></a>
<a name="l332"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I64</span><span class=cF0>:
<a name="l333"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *) = i - ptr - </span><span class=cFE>8</span><span class=cF0>;
<a name="l334"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l335"></a>
<a name="l336"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
<a name="l337"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *) = i;
<a name="l338"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l339"></a> }
<a name="l340"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l341"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l342"></a> }
<a name="l343"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;src_link);
<a name="l344"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie);
<a name="l345"></a> tmpie = tmpie1;
<a name="l346"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l347"></a> </span><span class=cF5>Free</span><span class=cF0>(str);
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (!cc-&gt;aot_depth &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;cc-&gt;opts, </span><span class=cF3>OPTf_TRACE</span><span class=cF7>)</span><span class=cF0>)
<a name="l349"></a> </span><span class=cF5>Un</span><span class=cF0>(rip2, tmpaot-&gt;aot_U8s, </span><span class=cFE>64</span><span class=cF0>);
<a name="l350"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpaot);
<a name="l351"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpaot);
<a name="l352"></a>}
<a name="l353"></a>
<a name="l354"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>CompFixUpAOTAsm</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CAOT</span><span class=cF0> *tmpaot)
<a name="l355"></a>{
<a name="l356"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc = cc-&gt;aotc;
<a name="l357"></a> </span><span class=cF9>I64</span><span class=cF0> i, rip2 = tmpaot-&gt;rip + cc-&gt;aotc-&gt;rip;
<a name="l358"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l359"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *g_lb = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l360"></a> </span><span class=cF9>CAOTAbsAddr</span><span class=cF0> *tmpa, *tmpa1;
<a name="l361"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie, *tmpie1;
<a name="l362"></a>
<a name="l363"></a> tmpa = tmpaot-&gt;abss;
<a name="l364"></a> </span><span class=cF1>while</span><span class=cF0> (tmpa)
<a name="l365"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l366"></a> tmpa1 = tmpa-&gt;next;
<a name="l367"></a> tmpa-&gt;next = aotc-&gt;abss;
<a name="l368"></a> ptr = tmpaot-&gt;buf + tmpaot-&gt;rip + tmpa-&gt;rip;
<a name="l369"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpa-&gt;type]
<a name="l370"></a> {
<a name="l371"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_ADD_U8</span><span class=cF0>: *ptr(</span><span class=cF1>U8</span><span class=cF0> *) += rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l372"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_SUB_U8</span><span class=cF0>: *ptr(</span><span class=cF1>U8</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l373"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_ADD_U16</span><span class=cF0>: *ptr(</span><span class=cF9>U16</span><span class=cF0> *) += rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l374"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_SUB_U16</span><span class=cF0>: *ptr(</span><span class=cF9>U16</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l375"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_ADD_U32</span><span class=cF0>: *ptr(</span><span class=cF9>U32</span><span class=cF0> *) += rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l376"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_SUB_U32</span><span class=cF0>: *ptr(</span><span class=cF9>U32</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l377"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_ADD_U64</span><span class=cF0>: *ptr(</span><span class=cF9>I64</span><span class=cF0> *) += rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l378"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AAT_SUB_U64</span><span class=cF0>: *ptr(</span><span class=cF9>I64</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l379"></a> }
<a name="l380"></a> aotc-&gt;abss = tmpa;
<a name="l381"></a> tmpa-&gt;rip += rip2;
<a name="l382"></a> tmpa = tmpa1;
<a name="l383"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l384"></a>
<a name="l385"></a> tmpie = tmpaot-&gt;next_ie;
<a name="l386"></a> </span><span class=cF1>while</span><span class=cF0> (tmpie != &amp;tmpaot-&gt;next_ie)
<a name="l387"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l388"></a> tmpie1 = tmpie-&gt;next;
<a name="l389"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpie);
<a name="l390"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>IET_REL_I0</span><span class=cF0> &lt;= tmpie-&gt;type &lt;= </span><span class=cF3>IET_IMM_I64</span><span class=cF0>)
<a name="l391"></a> {
<a name="l392"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str)
<a name="l393"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l394"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;flags &amp; </span><span class=cF3>IEF_GOTO_LABEL</span><span class=cF0>)
<a name="l395"></a> {
<a name="l396"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>g_lb = </span><span class=cFD>COCGoToLabelFind</span><span class=cF0>(cc, tmpie-&gt;str)</span><span class=cF7>)</span><span class=cF0>)
<a name="l397"></a> </span><span class=cF6>&quot;Unresolved Reference:%s\n&quot;</span><span class=cF0>, tmpie-&gt;str;
<a name="l398"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l399"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l400"></a> g_lb-&gt;use_count++;
<a name="l401"></a> g_lb = </span><span class=cFD>OptLabelFwd</span><span class=cF0>(g_lb);
<a name="l402"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l403"></a> }
<a name="l404"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l405"></a> g_lb = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l406"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l407"></a> }
<a name="l408"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l409"></a> g_lb = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l410"></a>
<a name="l411"></a> ptr = tmpaot-&gt;buf + tmpaot-&gt;rip + tmpie-&gt;rip;
<a name="l412"></a> </span><span class=cF1>if</span><span class=cF0> (g_lb)
<a name="l413"></a> {
<a name="l414"></a> i = g_lb-&gt;addr + tmpaot-&gt;buf;
<a name="l415"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpie-&gt;type]
<a name="l416"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l417"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I0</span><span class=cF0>:
<a name="l418"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U0</span><span class=cF0>:
<a name="l419"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l420"></a>
<a name="l421"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I8</span><span class=cF0>:
<a name="l422"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>I8_MIN</span><span class=cF0> &lt;= i - ptr - </span><span class=cFE>1</span><span class=cF0> &lt;= </span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l423"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Branch out of range at &quot;</span><span class=cF0>);
<a name="l424"></a> *ptr(</span><span class=cF1>U8</span><span class=cF0> *) = i - ptr - </span><span class=cFE>1</span><span class=cF0>;
<a name="l425"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l426"></a>
<a name="l427"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U8</span><span class=cF0>:
<a name="l428"></a> *ptr(</span><span class=cF1>U8</span><span class=cF0> *) = i;
<a name="l429"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l430"></a>
<a name="l431"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I16</span><span class=cF0>:
<a name="l432"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>I16_MIN</span><span class=cF0> &lt;= i - ptr - </span><span class=cFE>2</span><span class=cF0> &lt;= </span><span class=cF3>I16_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l433"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Branch out of range at &quot;</span><span class=cF0>);
<a name="l434"></a> *ptr(</span><span class=cF9>U16</span><span class=cF0> *) = i - ptr - </span><span class=cFE>2</span><span class=cF0>;
<a name="l435"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l436"></a>
<a name="l437"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U16</span><span class=cF0>:
<a name="l438"></a> *ptr(</span><span class=cF9>U16</span><span class=cF0> *) = i;
<a name="l439"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l440"></a>
<a name="l441"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I32</span><span class=cF0>:
<a name="l442"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>I32_MIN</span><span class=cF0> &lt;= i - ptr - </span><span class=cFE>4</span><span class=cF0> &lt;= </span><span class=cF3>I32_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l443"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Branch out of range at &quot;</span><span class=cF0>);
<a name="l444"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *) = i - ptr - </span><span class=cFE>4</span><span class=cF0>;
<a name="l445"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l446"></a>
<a name="l447"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U32</span><span class=cF0>:
<a name="l448"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *) = i;
<a name="l449"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l450"></a>
<a name="l451"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I64</span><span class=cF0>:
<a name="l452"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *) = i - ptr - </span><span class=cFE>8</span><span class=cF0>;
<a name="l453"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l454"></a>
<a name="l455"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
<a name="l456"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *) = i;
<a name="l457"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l458"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l459"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;src_link);
<a name="l460"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie);
<a name="l461"></a> }
<a name="l462"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l463"></a> {
<a name="l464"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpie-&gt;type)
<a name="l465"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l466"></a> </span><span class=cF1>start</span><span class=cF0>:
<a name="l467"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL32_EXPORT</span><span class=cF0>:
<a name="l468"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM32_EXPORT</span><span class=cF0>:
<a name="l469"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL64_EXPORT</span><span class=cF0>:
<a name="l470"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM64_EXPORT</span><span class=cF0>:
<a name="l471"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U0</span><span class=cF0>:
<a name="l472"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U8</span><span class=cF0>:
<a name="l473"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U16</span><span class=cF0>:
<a name="l474"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U32</span><span class=cF0>:
<a name="l475"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
<a name="l476"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I0</span><span class=cF0>:
<a name="l477"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l478"></a>
<a name="l479"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I8</span><span class=cF0>: *ptr(</span><span class=cF1>U8</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l480"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I16</span><span class=cF0>: *ptr(</span><span class=cF9>U16</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l481"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I32</span><span class=cF0>: *ptr(</span><span class=cF9>U32</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l482"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I64</span><span class=cF0>: *ptr(</span><span class=cF9>I64</span><span class=cF0> *) -= rip2; </span><span class=cF1>break</span><span class=cF0>;
<a name="l483"></a> </span><span class=cF1>end</span><span class=cF0>:
<a name="l484"></a> tmpie-&gt;rip += rip2;
<a name="l485"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l486"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l487"></a> tmpie-&gt;aot = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l488"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpie, tmpaot-&gt;parent_aot-&gt;last_ie);
<a name="l489"></a> }
<a name="l490"></a> tmpie = tmpie1;
<a name="l491"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l492"></a>}
<a name="l493"></a>
<a name="l494"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Comp</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename, </span><span class=cF1>U8</span><span class=cF0> *map_name=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *out_name=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> mapfile_drive_let=</span><span class=cFE>0</span><span class=cF0>)
<a name="l495"></a>{</span><span class=cF2>//AOT Compile CC or PRJ file a and output BIN file. Returns err_count.</span><span class=cF0>
<a name="l496"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr, *fbuf = </span><span class=cF3>NULL</span><span class=cF0>, *fbuf2 = </span><span class=cF3>NULL</span><span class=cF0>, *fbuf3 = </span><span class=cF3>NULL</span><span class=cF0>, *patch_table = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFE>0x20000</span><span class=cF0>);
<a name="l497"></a> </span><span class=cF9>CAOT</span><span class=cF0> *tmpaot;
<a name="l498"></a> </span><span class=cF9>I64</span><span class=cF0> i, count, size = </span><span class=cFE>0</span><span class=cF0>, error_count = </span><span class=cFE>0</span><span class=cF0>, warning_count = </span><span class=cFE>0</span><span class=cF0>, aot_U8s = </span><span class=cFE>0</span><span class=cF0>;
<a name="l499"></a> </span><span class=cF9>CBinFile</span><span class=cF0> *bfh;
<a name="l500"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie, *tmpie1;
<a name="l501"></a> </span><span class=cF9>CAOTAbsAddr</span><span class=cF0> *tmpa, *tmpa1;
<a name="l502"></a> </span><span class=cF9>CAOTHeapGlobalRef</span><span class=cF0> *tmphgr, *tmphgr1;
<a name="l503"></a> </span><span class=cF9>CAOTHeapGlobal</span><span class=cF0> *tmphg, *tmphg1;
<a name="l504"></a>
<a name="l505"></a> fbuf = </span><span class=cF5>ExtDefault</span><span class=cF0>(filename, </span><span class=cF6>&quot;PRJ&quot;</span><span class=cF0>);
<a name="l506"></a> fbuf2 = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;#include \&quot;%s\&quot;&quot;</span><span class=cF0>, fbuf);
<a name="l507"></a> </span><span class=cF1>if</span><span class=cF0> (map_name)
<a name="l508"></a> fbuf3 = </span><span class=cF5>ExtDefault</span><span class=cF0>(map_name, </span><span class=cF6>&quot;MAP&quot;</span><span class=cF0>);
<a name="l509"></a>
<a name="l510"></a> </span><span class=cF1>if</span><span class=cF0> (tmpaot = </span><span class=cFD>CompBuf</span><span class=cF7>(</span><span class=cF0>fbuf2, fbuf3, &amp;error_count, &amp;warning_count, mapfile_drive_let</span><span class=cF7>)</span><span class=cF0>)
<a name="l511"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l512"></a> aot_U8s = tmpaot-&gt;aot_U8s;
<a name="l513"></a> ptr = patch_table;
<a name="l514"></a></span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KLoad.CC.html#l208"><span class=cF4>Load</span></a><span class=cF2>()</span><span class=cF0>
<a name="l515"></a> count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l516"></a> tmpa = tmpaot-&gt;abss;
<a name="l517"></a> </span><span class=cF1>while</span><span class=cF0> (tmpa)
<a name="l518"></a> {
<a name="l519"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpa-&gt;type &amp; </span><span class=cF3>IEF_IMM_NOT_REL</span><span class=cF7>)</span><span class=cF0>)
<a name="l520"></a> count++;
<a name="l521"></a> tmpa = tmpa-&gt;next;
<a name="l522"></a> }
<a name="l523"></a> </span><span class=cF1>if</span><span class=cF0> (count)
<a name="l524"></a> {
<a name="l525"></a> *ptr++ = </span><span class=cF3>IET_ABS_ADDR</span><span class=cF0>;
<a name="l526"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++ = count;
<a name="l527"></a> *ptr++ = </span><span class=cFE>0</span><span class=cF0>;
<a name="l528"></a> tmpa = tmpaot-&gt;abss;
<a name="l529"></a> </span><span class=cF1>while</span><span class=cF0> (tmpa)
<a name="l530"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l531"></a> tmpa1 = tmpa-&gt;next;
<a name="l532"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpa-&gt;type &amp; </span><span class=cF3>IEF_IMM_NOT_REL</span><span class=cF7>)</span><span class=cF0>)
<a name="l533"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++ = tmpa-&gt;rip;
<a name="l534"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpa);
<a name="l535"></a> tmpa = tmpa1;
<a name="l536"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l537"></a> }
<a name="l538"></a> tmphg = tmpaot-&gt;heap_globals;
<a name="l539"></a> </span><span class=cF1>while</span><span class=cF0> (tmphg)
<a name="l540"></a> {
<a name="l541"></a> tmphg1 = tmphg-&gt;next;
<a name="l542"></a> count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l543"></a> tmphgr = tmphg-&gt;references;
<a name="l544"></a> </span><span class=cF1>while</span><span class=cF0> (tmphgr)
<a name="l545"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l546"></a> count++;
<a name="l547"></a> tmphgr = tmphgr-&gt;next;
<a name="l548"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l549"></a> </span><span class=cF1>if</span><span class=cF0> (count)
<a name="l550"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l551"></a> *ptr++ = </span><span class=cF3>IET_DATA_HEAP</span><span class=cF0>;
<a name="l552"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++ = count;
<a name="l553"></a> </span><span class=cF1>if</span><span class=cF0> (tmphg-&gt;str)
<a name="l554"></a> {
<a name="l555"></a> i = </span><span class=cF5>StrLen</span><span class=cF0>(tmphg-&gt;str);
<a name="l556"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, tmphg-&gt;str, i + </span><span class=cFE>1</span><span class=cF0>);
<a name="l557"></a> </span><span class=cF5>Free</span><span class=cF0>(tmphg-&gt;str);
<a name="l558"></a> ptr += i + </span><span class=cFE>1</span><span class=cF0>;
<a name="l559"></a> }
<a name="l560"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l561"></a> *ptr++ = </span><span class=cFE>0</span><span class=cF0>;
<a name="l562"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *)++ = tmphg-&gt;size;
<a name="l563"></a> tmphgr = tmphg-&gt;references;
<a name="l564"></a> </span><span class=cF1>while</span><span class=cF0> (tmphgr)
<a name="l565"></a> {
<a name="l566"></a> tmphgr1 = tmphgr-&gt;next;
<a name="l567"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++ = tmphgr-&gt;rip;
<a name="l568"></a> </span><span class=cF5>Free</span><span class=cF0>(tmphgr);
<a name="l569"></a> tmphgr = tmphgr1;
<a name="l570"></a> }
<a name="l571"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l572"></a> </span><span class=cF5>Free</span><span class=cF0>(tmphg);
<a name="l573"></a> tmphg = tmphg1;
<a name="l574"></a> }
<a name="l575"></a>
<a name="l576"></a> </span><span class=cF2>//Do exports first</span><span class=cF0>
<a name="l577"></a> tmpie = tmpaot-&gt;next_ie;
<a name="l578"></a> </span><span class=cF1>while</span><span class=cF0> (tmpie != &amp;tmpaot-&gt;next_ie)
<a name="l579"></a> {
<a name="l580"></a> tmpie1 = tmpie-&gt;next;
<a name="l581"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpie-&gt;type || </span><span class=cF3>IET_REL32_EXPORT</span><span class=cF0> &lt;= tmpie-&gt;type &lt;= </span><span class=cF3>IET_IMM64_EXPORT</span><span class=cF0>)
<a name="l582"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l583"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpie);
<a name="l584"></a> *ptr++ = tmpie-&gt;type;
<a name="l585"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++ = tmpie-&gt;rip;
<a name="l586"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str)
<a name="l587"></a> {
<a name="l588"></a> i = </span><span class=cF5>StrLen</span><span class=cF0>(tmpie-&gt;str);
<a name="l589"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, tmpie-&gt;str, i + </span><span class=cFE>1</span><span class=cF0>);
<a name="l590"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;str);
<a name="l591"></a> ptr += i + </span><span class=cFE>1</span><span class=cF0>;
<a name="l592"></a> }
<a name="l593"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l594"></a> *ptr++ = </span><span class=cFE>0</span><span class=cF0>;
<a name="l595"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;src_link);
<a name="l596"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie);
<a name="l597"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l598"></a> tmpie = tmpie1;
<a name="l599"></a> }
<a name="l600"></a>
<a name="l601"></a> </span><span class=cF2>//Do imports second</span><span class=cF0>
<a name="l602"></a> tmpie = tmpaot-&gt;next_ie;
<a name="l603"></a> </span><span class=cF1>while</span><span class=cF0> (tmpie != &amp;tmpaot-&gt;next_ie)
<a name="l604"></a> {
<a name="l605"></a> tmpie1 = tmpie-&gt;next;
<a name="l606"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpie);
<a name="l607"></a> *ptr++ = tmpie-&gt;type;
<a name="l608"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;aot)
<a name="l609"></a> tmpie-&gt;rip += tmpie-&gt;aot-&gt;rip2;
<a name="l610"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++ = tmpie-&gt;rip;
<a name="l611"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str)
<a name="l612"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l613"></a> i = </span><span class=cF5>StrLen</span><span class=cF0>(tmpie-&gt;str);
<a name="l614"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, tmpie-&gt;str, i + </span><span class=cFE>1</span><span class=cF0>);
<a name="l615"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;str);
<a name="l616"></a> ptr += i + </span><span class=cFE>1</span><span class=cF0>;
<a name="l617"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l618"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l619"></a> *ptr++ = </span><span class=cFE>0</span><span class=cF0>;
<a name="l620"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;src_link);
<a name="l621"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie);
<a name="l622"></a> tmpie = tmpie1;
<a name="l623"></a> }
<a name="l624"></a>
<a name="l625"></a> *ptr++ = </span><span class=cF3>IET_END</span><span class=cF0>;
<a name="l626"></a> </span><span class=cF5>MemSet</span><span class=cF0>(ptr, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>16</span><span class=cF0>);
<a name="l627"></a> i = ptr - patch_table;
<a name="l628"></a></span><span class=cF2>//Needs 16 ALIGN</span><span class=cF0>
<a name="l629"></a> size = (</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CBinFile</span><span class=cF7>)</span><span class=cF0> + aot_U8s + i + </span><span class=cFE>15</span><span class=cF0>) &amp; -</span><span class=cFE>16</span><span class=cF0>;
<a name="l630"></a> bfh = </span><span class=cF5>MAlloc</span><span class=cF0>(size);
<a name="l631"></a> bfh-&gt;jmp = </span><span class=cFE>0xEB</span><span class=cF0> + </span><span class=cFE>256</span><span class=cF0> * (</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CBinFile</span><span class=cF7>)</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>);
<a name="l632"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CBinFile</span><span class=cF0>) - </span><span class=cFE>2</span><span class=cF0> &lt;= </span><span class=cF3>I8_MAX</span><span class=cF0>
<a name="l633"></a> bfh-&gt;reserved = </span><span class=cFE>0</span><span class=cF0>;
<a name="l634"></a> bfh-&gt;bin_signature = </span><span class=cF3>BIN_SIGNATURE_VAL</span><span class=cF0>;
<a name="l635"></a> bfh-&gt;org = tmpaot-&gt;org;
<a name="l636"></a> bfh-&gt;module_align_bits = tmpaot-&gt;max_align_bits;
<a name="l637"></a> bfh-&gt;patch_table_offset = </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CBinFile</span><span class=cF0>)+aot_U8s;
<a name="l638"></a> bfh-&gt;file_size = size;
<a name="l639"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(bfh</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CBinFile</span><span class=cF7>)</span><span class=cF0>, tmpaot-&gt;buf, aot_U8s);
<a name="l640"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(bfh</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CBinFile</span><span class=cF7>)</span><span class=cF0> + aot_U8s, patch_table, size - aot_U8s - </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CBinFile</span><span class=cF7>)</span><span class=cF0>);
<a name="l641"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf2);
<a name="l642"></a> </span><span class=cF1>if</span><span class=cF0> (out_name)
<a name="l643"></a> fbuf2 = </span><span class=cF5>ExtDefault</span><span class=cF0>(out_name, </span><span class=cF6>&quot;BIN&quot;</span><span class=cF0>);
<a name="l644"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l645"></a> fbuf2 = </span><span class=cF5>ExtChange</span><span class=cF0>(fbuf, </span><span class=cF6>&quot;BIN&quot;</span><span class=cF0>);
<a name="l646"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(fbuf2, bfh, size);
<a name="l647"></a> </span><span class=cF5>Free</span><span class=cF0>(bfh);
<a name="l648"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpaot-&gt;buf);
<a name="l649"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(tmpaot);
<a name="l650"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpaot);
<a name="l651"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l652"></a> </span><span class=cF5>Free</span><span class=cF0>(patch_table);
<a name="l653"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf);
<a name="l654"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf2);
<a name="l655"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf3);
<a name="l656"></a> </span><span class=cF5>Print</span><span class=cF0>(</span><span class=cF6>&quot;Errs:%d Warns:%d Code:%X Size:%X\n&quot;</span><span class=cF0>, error_count, warning_count, aot_U8s, size);
<a name="l657"></a>
<a name="l658"></a> </span><span class=cF1>return</span><span class=cF0> error_count;
<a name="l659"></a>}
<a name="l660"></a>
<a name="l661"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ExePutS</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF1>U8</span><span class=cF0> *filename=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> ccf_flags=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>CLexHashTableContext</span><span class=cF0> *htc=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l662"></a>{</span><span class=cF2>//JIT Compile and execute text from a puts(&quot;&quot;).</span><span class=cF0>
<a name="l663"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l664"></a> </span><span class=cF1>Bool</span><span class=cF0> okay = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l665"></a> </span><span class=cF9>CCompCtrl</span><span class=cF0> *cc;
<a name="l666"></a>
<a name="l667"></a> </span><span class=cF1>if</span><span class=cF0> (!filename)
<a name="l668"></a> filename = </span><span class=cFB>blkdev</span><span class=cF0>.tmp_filename;
<a name="l669"></a> cc = </span><span class=cF5>CompCtrlNew</span><span class=cF0>(buf, ccf_flags | </span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>, filename);
<a name="l670"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc != &amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;next_cc)
<a name="l671"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l672"></a> cc-&gt;opts = </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc-&gt;opts;
<a name="l673"></a> </span><span class=cF1>if</span><span class=cF0> (htc)
<a name="l674"></a> {
<a name="l675"></a> cc-&gt;flags = cc-&gt;flags &amp; ~</span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0> | htc-&gt;old_flags &amp; </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>;
<a name="l676"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;cc-&gt;htc, htc, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CLexHashTableContext</span><span class=cF7>)</span><span class=cF0>);
<a name="l677"></a> }
<a name="l678"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l679"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(cc, </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc);
<a name="l680"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l681"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l682"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l683"></a> res = </span><span class=cF5>ExeCmdLine</span><span class=cF0>(cc);
<a name="l684"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l685"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l686"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l687"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;except_ch == </span><span class=cF6>'Compiler'</span><span class=cF0> || </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_ch == </span><span class=cF6>'Break'</span><span class=cF0>)
<a name="l688"></a> {
<a name="l689"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l690"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l691"></a> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l692"></a> }
<a name="l693"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l694"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(cc);
<a name="l695"></a> </span><span class=cF1>if</span><span class=cF0> (okay)
<a name="l696"></a> </span><span class=cF5>CompCtrlDel</span><span class=cF0>(cc); </span><span class=cF2>//TODO: can crash</span><span class=cF0>
<a name="l697"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l698"></a>}
<a name="l699"></a>
<a name="l700"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ExePrint</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l701"></a>{</span><span class=cF2>//JIT Compile and execute text from a printf().</span><span class=cF0>
<a name="l702"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l703"></a> </span><span class=cF1>U8</span><span class=cF0> *buf = </span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, format, argc, argv);
<a name="l704"></a>
<a name="l705"></a> res = </span><span class=cF5>ExePutS</span><span class=cF0>(buf);
<a name="l706"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l707"></a>
<a name="l708"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l709"></a>}
<a name="l710"></a>
<a name="l711"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ExeFile</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF9>I64</span><span class=cF0> ccf_flags=</span><span class=cFE>0</span><span class=cF0>)
<a name="l712"></a>{</span><span class=cF2>//JIT Compile and execute a file.</span><span class=cF0>
<a name="l713"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l714"></a> </span><span class=cF1>U8</span><span class=cF0> *name2 = </span><span class=cF5>ExtDefault</span><span class=cF0>(name, </span><span class=cF6>&quot;CC&quot;</span><span class=cF0>), *st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;#include \&quot;%s\&quot;;&quot;</span><span class=cF0>, name2);
<a name="l715"></a>
<a name="l716"></a> res = </span><span class=cF5>ExePutS</span><span class=cF0>(st, name, ccf_flags);
<a name="l717"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l718"></a> </span><span class=cF5>Free</span><span class=cF0>(name2);
<a name="l719"></a>
<a name="l720"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l721"></a>}
<a name="l722"></a>
<a name="l723"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RunFile</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF9>I64</span><span class=cF0> ccf_flags=</span><span class=cFE>0</span><span class=cF0>, ...)
<a name="l724"></a>{</span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/CMain.CC.html#l711"><span class=cF4>ExeFile</span></a><span class=cF2>() with args using </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/CMisc.CC.html#l48"><span class=cF4>LastFun</span></a><span class=cF2>().</span><span class=cF0>
<a name="l725"></a> </span><span class=cF5>ExeFile</span><span class=cF0>(name, ccf_flags);
<a name="l726"></a>
<a name="l727"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>LastFun</span><span class=cF0>(argc, argv);
<a name="l728"></a>}
<a name="l729"></a>
<a name="l730"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ExePutS2</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF1>U8</span><span class=cF0> *filename=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> ccf_flags=</span><span class=cFE>0</span><span class=cF0>)
<a name="l731"></a>{</span><span class=cF2>//throws exceptions</span><span class=cF0>
<a name="l732"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l733"></a> </span><span class=cF9>CCompCtrl</span><span class=cF0> *cc;
<a name="l734"></a>
<a name="l735"></a> </span><span class=cF1>if</span><span class=cF0> (!filename)
<a name="l736"></a> filename = </span><span class=cFB>blkdev</span><span class=cF0>.tmp_filename;
<a name="l737"></a> cc = </span><span class=cF5>CompCtrlNew</span><span class=cF0>(buf, ccf_flags | </span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>, filename);
<a name="l738"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc != &amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;next_cc)
<a name="l739"></a> cc-&gt;opts = </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc-&gt;opts;
<a name="l740"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(cc, </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc);
<a name="l741"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l742"></a> res = </span><span class=cF5>ExeCmdLine</span><span class=cF0>(cc);
<a name="l743"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(cc);
<a name="l744"></a> </span><span class=cF5>CompCtrlDel</span><span class=cF0>(cc);
<a name="l745"></a>
<a name="l746"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l747"></a>}
<a name="l748"></a>
<a name="l749"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ExePrint2</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l750"></a>{</span><span class=cF2>//throws exceptions</span><span class=cF0>
<a name="l751"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l752"></a> </span><span class=cF1>U8</span><span class=cF0> *buf = </span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, format, argc, argv);
<a name="l753"></a>
<a name="l754"></a> res = </span><span class=cF5>ExePutS2</span><span class=cF0>(buf);
<a name="l755"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l756"></a>
<a name="l757"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l758"></a>}
<a name="l759"></a>
<a name="l760"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ExeFile2</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF9>I64</span><span class=cF0> ccf_flags=</span><span class=cFE>0</span><span class=cF0>)
<a name="l761"></a>{</span><span class=cF2>//throws exceptions</span><span class=cF0>
<a name="l762"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l763"></a> </span><span class=cF1>U8</span><span class=cF0> *name2 = </span><span class=cF5>ExtDefault</span><span class=cF0>(name, </span><span class=cF6>&quot;CC&quot;</span><span class=cF0>), *st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;#include \&quot;%s\&quot;;&quot;</span><span class=cF0>, name2);
<a name="l764"></a>
<a name="l765"></a> res = </span><span class=cF5>ExePutS2</span><span class=cF0>(st, name, ccf_flags);
<a name="l766"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l767"></a> </span><span class=cF5>Free</span><span class=cF0>(name2);
<a name="l768"></a>
<a name="l769"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l770"></a>}
<a name="l771"></a>
<a name="l772"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RunFile2</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF9>I64</span><span class=cF0> ccf_flags=</span><span class=cFE>0</span><span class=cF0>, ...)
<a name="l773"></a>{</span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/CMain.CC.html#l760"><span class=cF4>ExeFile2</span></a><span class=cF2>() with args using </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/CMisc.CC.html#l48"><span class=cF4>LastFun</span></a><span class=cF2>(). throws exceptions.</span><span class=cF0>
<a name="l774"></a> </span><span class=cF5>ExeFile2</span><span class=cF0>(name, ccf_flags);
<a name="l775"></a>
<a name="l776"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>LastFun</span><span class=cF0>(argc, argv);
<a name="l777"></a>}
<a name="l778"></a>
<a name="l779"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>StreamExePrint</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l780"></a>{</span><span class=cF2>//Causes value from stream to be used in an #exe{} block.</span><span class=cF0>
<a name="l781"></a> </span><span class=cF1>U8</span><span class=cF0> *buf = </span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, format, argc, argv);
<a name="l782"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l783"></a> </span><span class=cF9>CLexHashTableContext</span><span class=cF0> *htc;
<a name="l784"></a> </span><span class=cF9>CCompCtrl</span><span class=cF0> *cc = </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc;
<a name="l785"></a>
<a name="l786"></a> </span><span class=cF1>if</span><span class=cF0> (cc == &amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;next_cc)
<a name="l787"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;Not Compiling\n&quot;</span><span class=cF0>);
<a name="l788"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l789"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l790"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc-&gt;flags &amp; </span><span class=cF3>CCF_EXE_BLK</span><span class=cF7>)</span><span class=cF0>)
<a name="l791"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;StreamExePrint only allowed in AOT compiled #exe{} mode.&quot;</span><span class=cF0>);
<a name="l792"></a> </span><span class=cF1>if</span><span class=cF0> (htc = cc-&gt;htc.next)
<a name="l793"></a> res = </span><span class=cF5>ExePutS</span><span class=cF0>(buf,,, htc);
<a name="l794"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l795"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l796"></a>
<a name="l797"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l798"></a>}
<a name="l799"></a>
<a name="l800"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CInit</span><span class=cF0>()
<a name="l801"></a>{
<a name="l802"></a> </span><span class=cFD>CompLoadDefines</span><span class=cF0>;
<a name="l803"></a> </span><span class=cFD>CompFillTables</span><span class=cF0>;
<a name="l804"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;</span><span class=cFB>cmp</span><span class=cF0>.ic_nop);
<a name="l805"></a> </span><span class=cFB>cmp</span><span class=cF0>.ic_nop.ic_class = </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>];
<a name="l806"></a> </span><span class=cFB>cmp</span><span class=cF0>.ic_nop.ic_code = </span><span class=cF3>IC_NOP1</span><span class=cF0>;
<a name="l807"></a> </span><span class=cFD>AsmHashLoad</span><span class=cF0>;
<a name="l808"></a> </span><span class=cFD>UAsmHashLoad</span><span class=cF0>;
<a name="l809"></a>}
<a name="l810"></a>
<a name="l811"></a></span><span class=cF5>CInit</span><span class=cF0>;
</span></pre></body>
</html>