templeos-info/public/Wb/Compiler/CMain.HC.HTML

734 lines
75 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>LexStmt2Bin</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> *_type,</span><span class=cF9>I64</span><span class=cF0> cmp_flags=0)
<a name="l2"></a>{</span><span class=cF2>//Compile one cc stmt 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> </span><span class=cF1>if</span><span class=cF0> (_type) *_type=</span><span class=cF3>RT_I64</span><span class=cF0>;
<a name="l6"></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="l7"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;aot_depth==2)
<a name="l8"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
<a name="l9"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>PrsStmt</span><span class=cF7>(</span><span class=cF0>cc,,,cmp_flags</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;coc.coc_head.next!=&amp;cc-&gt;coc.coc_head) {
<a name="l12"></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="l13"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_RETURN_VAL2</span><span class=cF0>,0,0);
<a name="l14"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_RET</span><span class=cF0>,0,0);
<a name="l15"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l16"></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="l17"></a> j=cc-&gt;aotc-&gt;rip;
<a name="l18"></a> k=(size+7)&gt;&gt;3;
<a name="l19"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;k;i++)
<a name="l20"></a> </span><span class=cFD>AOTStoreCodeU64</span><span class=cF0>(cc,res[i]);
<a name="l21"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
<a name="l22"></a> res=j;
<a name="l23"></a> }
<a name="l24"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l25"></a> } </span><span class=cF2>//TODO: else del misc?</span><span class=cF0>
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0> </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="l27"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&amp;cc-&gt;coc.coc_head.next);
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;aot_depth==2) </span><span class=cF7>{</span><span class=cF0>
<a name="l29"></a> tmpcbh=</span><span class=cFD>COCPopNoFree</span><span class=cF0>(cc);
<a name="l30"></a> </span><span class=cFD>COCAppend</span><span class=cF0>(cc,tmpcbh);
<a name="l31"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l32"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l33"></a>}
<a name="l34"></a>
<a name="l35"></a></span><span class=cF9>CAOT</span><span class=cF0> *</span><span class=cFD>CmpJoin</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> cmp_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_drv_let=0)
<a name="l36"></a>{
<a name="l37"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc,*old_aot=cc-&gt;aotc;
<a name="l38"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,l;
<a name="l39"></a> </span><span class=cF1>U8</span><span class=cF0> *buf;
<a name="l40"></a> </span><span class=cF9>CAOTBinBlk</span><span class=cF0> *tmpbin;
<a name="l41"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie;
<a name="l42"></a> </span><span class=cF1>Bool</span><span class=cF0> okay=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l43"></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="l44"></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="l45"></a> </span><span class=cF1>if</span><span class=cF0> (parent=cc-&gt;aot) </span><span class=cF7>{</span><span class=cF0>
<a name="l46"></a> res-&gt;parent_aot=parent;
<a name="l47"></a> </span><span class=cF5>QueIns</span><span class=cF0>(res,parent-&gt;last);
<a name="l48"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l49"></a> </span><span class=cF5>QueInit</span><span class=cF0>(res);
<a name="l50"></a> cc-&gt;aot=res;
<a name="l51"></a>
<a name="l52"></a> res-&gt;next_ie=res-&gt;last_ie=&amp;res-&gt;next_ie;
<a name="l53"></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="l54"></a> cc-&gt;aot_depth++;
<a name="l55"></a>
<a name="l56"></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="l57"></a> aotc-&gt;max_align_bits=0;
<a name="l58"></a> aotc-&gt;org=</span><span class=cF3>INVALID_PTR</span><span class=cF0>;
<a name="l59"></a>
<a name="l60"></a> </span><span class=cF5>MemCpy</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="l61"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;htc.fun)
<a name="l62"></a> cc-&gt;htc.glbl_hash_table=</span><span class=cF5>HashTableNew</span><span class=cF0>(128);
<a name="l63"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l64"></a> cc-&gt;htc.glbl_hash_table=</span><span class=cF5>HashTableNew</span><span class=cF0>(1024);
<a name="l65"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l66"></a> cc-&gt;htc.define_hash_table=cc-&gt;htc.glbl_hash_table;
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;aot_depth&lt;=1)
<a name="l68"></a> cc-&gt;htc.glbl_hash_table-&gt;next=</span><span class=cFB>cmp</span><span class=cF0>.asm_hash;
<a name="l69"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l70"></a> cc-&gt;htc.glbl_hash_table-&gt;next=htc-&gt;glbl_hash_table;
<a name="l71"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l72"></a> cc-&gt;htc.glbl_hash_table-&gt;next=</span><span class=cF5>Fs</span><span class=cF0>-&gt;hash_table;
<a name="l73"></a> cc-&gt;htc.hash_table_lst=cc-&gt;htc.local_hash_table=</span><span class=cF5>HashTableNew</span><span class=cF0>(16);
<a name="l74"></a> cc-&gt;htc.local_hash_table-&gt;next=cc-&gt;htc.glbl_hash_table;
<a name="l75"></a> cc-&gt;htc.local_var_lst=cc-&gt;htc.fun; </span><span class=cF2>//HolyC local vars</span><span class=cF0>
<a name="l76"></a> cc-&gt;htc.fun=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l77"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (cmp_flags&amp;</span><span class=cF3>CMPF_LEX_FIRST</span><span class=cF0>)
<a name="l79"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cmp_flags&amp;</span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF7>)</span><span class=cF0>)
<a name="l81"></a> cmp_flags|=</span><span class=cF3>CMPF_PRS_SEMICOLON</span><span class=cF0>;
<a name="l82"></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="l83"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token!=</span><span class=cF3>TK_EOF</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l84"></a> buf=</span><span class=cF5>LexStmt2Bin</span><span class=cF0>(cc,</span><span class=cF3>NULL</span><span class=cF0>,cmp_flags);
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (buf!=</span><span class=cF3>INVALID_PTR</span><span class=cF0>) {
<a name="l86"></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="l87"></a> tmpie-&gt;type=</span><span class=cF3>IET_MAIN</span><span class=cF0>;
<a name="l88"></a> tmpie-&gt;rip=buf;
<a name="l89"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpie,res-&gt;last_ie);
<a name="l90"></a> }
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (cmp_flags&amp;</span><span class=cF3>CMPF_ASM_BLK</span><span class=cF0>)
<a name="l92"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l94"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l95"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,,,cmp_flags);
<a name="l96"></a> </span><span class=cFD>AOTGlblsResolve</span><span class=cF0>(cc,res);
<a name="l97"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l98"></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>cmp_flags&amp;</span><span class=cF3>CMPF_ASM_BLK</span><span class=cF7>)</span><span class=cF0>) {
<a name="l99"></a> </span><span class=cF5>LexPutPos</span><span class=cF0>(cc);
<a name="l100"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l101"></a> }
<a name="l102"></a> okay=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l103"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l104"></a> </span><span class=cF1>if</span><span class=cF0> (!okay) </span><span class=cF7>{</span><span class=cF0>
<a name="l105"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;error_cnt&lt;1)
<a name="l106"></a> cc-&gt;error_cnt=1;
<a name="l107"></a> cc-&gt;aot=res-&gt;parent_aot;
<a name="l108"></a> </span><span class=cF5>Free</span><span class=cF0>(res);
<a name="l109"></a> </span><span class=cF5>LinkedLstDel</span><span class=cF0>(aotc-&gt;bin);
<a name="l110"></a> res=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l111"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (map_name)
<a name="l113"></a> </span><span class=cFD>MapFileWrite</span><span class=cF0>(cc-&gt;htc.glbl_hash_table,map_name,mapfile_drv_let);
<a name="l114"></a> </span><span class=cF5>HashTableDel</span><span class=cF0>(cc-&gt;htc.local_hash_table);
<a name="l115"></a> </span><span class=cF5>HashTableDel</span><span class=cF0>(cc-&gt;htc.glbl_hash_table);
<a name="l116"></a>
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (!aotc-&gt;num_bin_U8s)
<a name="l118"></a> res-&gt;buf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l119"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l120"></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="l121"></a> res-&gt;buf=</span><span class=cF5>MAlloc</span><span class=cF0>(aotc-&gt;num_bin_U8s);
<a name="l122"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l123"></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="l124"></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="l125"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l126"></a> res-&gt;buf=aotc-&gt;org;
<a name="l127"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l128"></a> res-&gt;aot_U8s=aotc-&gt;num_bin_U8s;
<a name="l129"></a> tmpbin=aotc-&gt;bin;
<a name="l130"></a> j=0;
<a name="l131"></a> l=aotc-&gt;num_bin_U8s;
<a name="l132"></a> </span><span class=cF1>while</span><span class=cF0> (tmpbin) </span><span class=cF7>{</span><span class=cF0>
<a name="l133"></a> i=l;
<a name="l134"></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="l135"></a> i=</span><span class=cF3>AOT_BIN_BLK_SIZE</span><span class=cF0>;
<a name="l136"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(res-&gt;buf+j,tmpbin-&gt;body,i);
<a name="l137"></a> j+=i;
<a name="l138"></a> l-=i;
<a name="l139"></a> tmpbin=tmpbin-&gt;next;
<a name="l140"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l141"></a> }
<a name="l142"></a> </span><span class=cF5>LinkedLstDel</span><span class=cF0>(aotc-&gt;bin);
<a name="l143"></a> res-&gt;abss=aotc-&gt;abss;
<a name="l144"></a> res-&gt;heap_glbls=aotc-&gt;heap_glbls;
<a name="l145"></a> res-&gt;max_align_bits=aotc-&gt;max_align_bits;
<a name="l146"></a> res-&gt;org=aotc-&gt;org;
<a name="l147"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l148"></a> cc-&gt;aot=parent;
<a name="l149"></a> </span><span class=cF5>MemCpy</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="l150"></a> </span><span class=cF5>Free</span><span class=cF0>(htc);
<a name="l151"></a> </span><span class=cF5>Free</span><span class=cF0>(aotc);
<a name="l152"></a> cc-&gt;aotc=old_aot;
<a name="l153"></a> cc-&gt;aot_depth--;
<a name="l154"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l155"></a>}
<a name="l156"></a>
<a name="l157"></a></span><span class=cF9>CAOT</span><span class=cF0> *</span><span class=cFD>CmpBuf</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>,
<a name="l158"></a> </span><span class=cF9>I64</span><span class=cF0> *error_cnt=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> *warning_cnt=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> mapfile_drv_let=0)
<a name="l159"></a>{
<a name="l160"></a> </span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc;
<a name="l161"></a> </span><span class=cF9>CAOT</span><span class=cF0> *res=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l162"></a> cc=</span><span class=cF5>CmpCtrlNew</span><span class=cF0>(buf,</span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>);
<a name="l163"></a> cc-&gt;flags|=</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>;
<a name="l164"></a> </span><span class=cF5>QueIns</span><span class=cF0>(cc,</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc);
<a name="l165"></a> res=</span><span class=cFD>CmpJoin</span><span class=cF0>(cc,</span><span class=cF3>CMPF_LEX_FIRST</span><span class=cF0>,map_name,mapfile_drv_let);
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (error_cnt) *error_cnt=cc-&gt;error_cnt;
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (warning_cnt) *warning_cnt=cc-&gt;warning_cnt;
<a name="l168"></a> </span><span class=cF5>QueRem</span><span class=cF0>(cc);
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (res)
<a name="l170"></a> </span><span class=cF5>CmpCtrlDel</span><span class=cF0>(cc);
<a name="l171"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l172"></a>}
<a name="l173"></a>
<a name="l174"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>CmpFixUpJITAsm</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CAOT</span><span class=cF0> *tmpaot)
<a name="l175"></a>{
<a name="l176"></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="l177"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l178"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *g_lb;
<a name="l179"></a> </span><span class=cF9>CAOTAbsAddr</span><span class=cF0> *tmpa,*tmpa1;
<a name="l180"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie,*tmpie1;
<a name="l181"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex;
<a name="l182"></a>
<a name="l183"></a> tmpa=tmpaot-&gt;abss;
<a name="l184"></a> </span><span class=cF1>while</span><span class=cF0> (tmpa) </span><span class=cF7>{</span><span class=cF0>
<a name="l185"></a> tmpa1=tmpa-&gt;next;
<a name="l186"></a> ptr=rip2+tmpa-&gt;rip;
<a name="l187"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpa-&gt;type] {
<a name="l188"></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="l189"></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="l190"></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="l191"></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="l192"></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="l193"></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="l194"></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="l195"></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="l196"></a> }
<a name="l197"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpa);
<a name="l198"></a> tmpa=tmpa1;
<a name="l199"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l200"></a> tmpie=tmpaot-&gt;next_ie;
<a name="l201"></a> </span><span class=cF1>while</span><span class=cF0> (tmpie!=&amp;tmpaot-&gt;next_ie) </span><span class=cF7>{</span><span class=cF0>
<a name="l202"></a> tmpie1=tmpie-&gt;next;
<a name="l203"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str) {
<a name="l204"></a> </span><span class=cF5>Free</span><span class=cF0>(str);
<a name="l205"></a> str=tmpie-&gt;str;
<a name="l206"></a> }
<a name="l207"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpie-&gt;type) {
<a name="l208"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL32_EXPORT</span><span class=cF0>:
<a name="l209"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM32_EXPORT</span><span class=cF0>:
<a name="l210"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL64_EXPORT</span><span class=cF0>:
<a name="l211"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM64_EXPORT</span><span class=cF0>:
<a name="l212"></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="l213"></a> tmpex-&gt;str=str;
<a name="l214"></a> str=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l215"></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="l216"></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="l217"></a> tmpex-&gt;val=tmpie-&gt;rip;
<a name="l218"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l219"></a> tmpex-&gt;val=tmpie-&gt;rip+rip2;
<a name="l220"></a> tmpex-&gt;src_link=tmpie-&gt;src_link;
<a name="l221"></a> tmpie-&gt;src_link=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l222"></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="l223"></a> </span><span class=cF5>SysSymImportsResolve</span><span class=cF0>(tmpex-&gt;str);
<a name="l224"></a> </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>IET_REL_I0</span><span class=cF0>...</span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str) </span><span class=cF7>{</span><span class=cF0>
<a name="l227"></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="l228"></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="l229"></a> </span><span class=cF6>&quot;Unresolved Reference:%s\n&quot;</span><span class=cF0>,str;
<a name="l230"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l231"></a> g_lb-&gt;use_cnt++;
<a name="l232"></a> g_lb=</span><span class=cFD>OptLabelFwd</span><span class=cF0>(g_lb);
<a name="l233"></a> i=g_lb-&gt;addr+tmpaot-&gt;buf;
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l235"></a> tmpex=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l236"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l237"></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,
<a name="l238"></a> </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="l239"></a> </span><span class=cF6>&quot;Unresolved Reference:%s\n&quot;</span><span class=cF0>,str;
<a name="l240"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l241"></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="l242"></a> i=tmpex(</span><span class=cF9>CHashFun</span><span class=cF0> *)-&gt;exe_addr;
<a name="l243"></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_GLBL_VAR</span><span class=cF0>)
<a name="l244"></a> i=tmpex(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *)-&gt;data_addr;
<a name="l245"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l246"></a> i=tmpex-&gt;val;
<a name="l247"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l248"></a> g_lb=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l249"></a> }
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l251"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex || g_lb) </span><span class=cF7>{</span><span class=cF0>
<a name="l252"></a> ptr=tmpie-&gt;rip+rip2;
<a name="l253"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpie-&gt;type] {
<a name="l254"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I0</span><span class=cF0>:
<a name="l255"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U0</span><span class=cF0>:
<a name="l256"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l257"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I8</span><span class=cF0>:
<a name="l258"></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-1&lt;=</span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l259"></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="l260"></a> *ptr(</span><span class=cF1>U8</span><span class=cF0> *) =i-ptr-1;
<a name="l261"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U8</span><span class=cF0>:
<a name="l263"></a> *ptr(</span><span class=cF1>U8</span><span class=cF0> *) =i;
<a name="l264"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l265"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I16</span><span class=cF0>:
<a name="l266"></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-2&lt;=</span><span class=cF3>I16_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l267"></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="l268"></a> *ptr(</span><span class=cF9>U16</span><span class=cF0> *)=i-ptr-2;
<a name="l269"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l270"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U16</span><span class=cF0>:
<a name="l271"></a> *ptr(</span><span class=cF9>U16</span><span class=cF0> *)=i;
<a name="l272"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l273"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I32</span><span class=cF0>:
<a name="l274"></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-4&lt;=</span><span class=cF3>I32_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l275"></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="l276"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)=i-ptr-4;
<a name="l277"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l278"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U32</span><span class=cF0>:
<a name="l279"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)=i;
<a name="l280"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l281"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I64</span><span class=cF0>:
<a name="l282"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *)=i-ptr-8;
<a name="l283"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l284"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
<a name="l285"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *)=i;
<a name="l286"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l287"></a> }
<a name="l288"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l289"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l290"></a> }
<a name="l291"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;src_link);
<a name="l292"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie);
<a name="l293"></a> tmpie=tmpie1;
<a name="l294"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l295"></a> </span><span class=cF5>Free</span><span class=cF0>(str);
<a name="l296"></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="l297"></a> </span><span class=cF5>Un</span><span class=cF0>(rip2,tmpaot-&gt;aot_U8s,64);
<a name="l298"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpaot);
<a name="l299"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpaot);
<a name="l300"></a>}
<a name="l301"></a>
<a name="l302"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>CmpFixUpAOTAsm</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CAOT</span><span class=cF0> *tmpaot)
<a name="l303"></a>{
<a name="l304"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc=cc-&gt;aotc;
<a name="l305"></a> </span><span class=cF9>I64</span><span class=cF0> i,rip2=tmpaot-&gt;rip+cc-&gt;aotc-&gt;rip;
<a name="l306"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l307"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *g_lb=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l308"></a> </span><span class=cF9>CAOTAbsAddr</span><span class=cF0> *tmpa,*tmpa1;
<a name="l309"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie,*tmpie1;
<a name="l310"></a>
<a name="l311"></a> tmpa=tmpaot-&gt;abss;
<a name="l312"></a> </span><span class=cF1>while</span><span class=cF0> (tmpa) </span><span class=cF7>{</span><span class=cF0>
<a name="l313"></a> tmpa1=tmpa-&gt;next;
<a name="l314"></a> tmpa-&gt;next=aotc-&gt;abss;
<a name="l315"></a> ptr=tmpaot-&gt;buf+tmpaot-&gt;rip+tmpa-&gt;rip;
<a name="l316"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpa-&gt;type] {
<a name="l317"></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="l318"></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="l319"></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="l320"></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="l321"></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="l322"></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="l323"></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="l324"></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="l325"></a> }
<a name="l326"></a> aotc-&gt;abss=tmpa;
<a name="l327"></a> tmpa-&gt;rip+=rip2;
<a name="l328"></a> tmpa=tmpa1;
<a name="l329"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l330"></a>
<a name="l331"></a> tmpie=tmpaot-&gt;next_ie;
<a name="l332"></a> </span><span class=cF1>while</span><span class=cF0> (tmpie!=&amp;tmpaot-&gt;next_ie) </span><span class=cF7>{</span><span class=cF0>
<a name="l333"></a> tmpie1=tmpie-&gt;next;
<a name="l334"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpie);
<a name="l335"></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="l336"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str) </span><span class=cF7>{</span><span class=cF0>
<a name="l337"></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="l338"></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="l339"></a> </span><span class=cF6>&quot;Unresolved Reference:%s\n&quot;</span><span class=cF0>,tmpie-&gt;str;
<a name="l340"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l341"></a> g_lb-&gt;use_cnt++;
<a name="l342"></a> g_lb=</span><span class=cFD>OptLabelFwd</span><span class=cF0>(g_lb);
<a name="l343"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l344"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l345"></a> g_lb=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l346"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l347"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l348"></a> g_lb=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l349"></a>
<a name="l350"></a> ptr=tmpaot-&gt;buf+tmpaot-&gt;rip+tmpie-&gt;rip;
<a name="l351"></a> </span><span class=cF1>if</span><span class=cF0> (g_lb) {
<a name="l352"></a> i=g_lb-&gt;addr+tmpaot-&gt;buf;
<a name="l353"></a> </span><span class=cF1>switch</span><span class=cF0> [tmpie-&gt;type] </span><span class=cF7>{</span><span class=cF0>
<a name="l354"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I0</span><span class=cF0>:
<a name="l355"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U0</span><span class=cF0>:
<a name="l356"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l357"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I8</span><span class=cF0>:
<a name="l358"></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-1&lt;=</span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l359"></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="l360"></a> *ptr(</span><span class=cF1>U8</span><span class=cF0> *) =i-ptr-1;
<a name="l361"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l362"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U8</span><span class=cF0>:
<a name="l363"></a> *ptr(</span><span class=cF1>U8</span><span class=cF0> *) =i;
<a name="l364"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l365"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I16</span><span class=cF0>:
<a name="l366"></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-2&lt;=</span><span class=cF3>I16_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l367"></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="l368"></a> *ptr(</span><span class=cF9>U16</span><span class=cF0> *)=i-ptr-2;
<a name="l369"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l370"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U16</span><span class=cF0>:
<a name="l371"></a> *ptr(</span><span class=cF9>U16</span><span class=cF0> *)=i;
<a name="l372"></a> </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>IET_REL_I32</span><span class=cF0>:
<a name="l374"></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-4&lt;=</span><span class=cF3>I32_MAX</span><span class=cF7>)</span><span class=cF0>)
<a name="l375"></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="l376"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)=i-ptr-4;
<a name="l377"></a> </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>IET_IMM_U32</span><span class=cF0>:
<a name="l379"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)=i;
<a name="l380"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l381"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I64</span><span class=cF0>:
<a name="l382"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *)=i-ptr-8;
<a name="l383"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l384"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
<a name="l385"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *)=i;
<a name="l386"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l387"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l388"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;src_link);
<a name="l389"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie);
<a name="l390"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l391"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpie-&gt;type) </span><span class=cF7>{</span><span class=cF0>
<a name="l392"></a> </span><span class=cF1>start</span><span class=cF0>:
<a name="l393"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL32_EXPORT</span><span class=cF0>:
<a name="l394"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM32_EXPORT</span><span class=cF0>:
<a name="l395"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL64_EXPORT</span><span class=cF0>:
<a name="l396"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM64_EXPORT</span><span class=cF0>:
<a name="l397"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U0</span><span class=cF0>:
<a name="l398"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U8</span><span class=cF0>:
<a name="l399"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U16</span><span class=cF0>:
<a name="l400"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_U32</span><span class=cF0>:
<a name="l401"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
<a name="l402"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I0</span><span class=cF0>:
<a name="l403"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l404"></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="l405"></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="l406"></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="l407"></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="l408"></a> </span><span class=cF1>end</span><span class=cF0>:
<a name="l409"></a> tmpie-&gt;rip+=rip2;
<a name="l410"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l411"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l412"></a> tmpie-&gt;aot=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l413"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpie,tmpaot-&gt;parent_aot-&gt;last_ie);
<a name="l414"></a> }
<a name="l415"></a> tmpie=tmpie1;
<a name="l416"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l417"></a>}
<a name="l418"></a>
<a name="l419"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Cmp</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_drv_let=0)
<a name="l420"></a>{</span><span class=cF2>//AOT Compile HC or PRJ file a and output BIN file. Returns err_cnt.</span><span class=cF0>
<a name="l421"></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>,
<a name="l422"></a> *patch_table=</span><span class=cF5>MAlloc</span><span class=cF0>(0x20000);
<a name="l423"></a> </span><span class=cF9>CAOT</span><span class=cF0> *tmpaot;
<a name="l424"></a> </span><span class=cF9>I64</span><span class=cF0> i,cnt,size=0,error_cnt=0,warning_cnt=0,aot_U8s=0;
<a name="l425"></a> </span><span class=cF9>CBinFile</span><span class=cF0> *bfh;
<a name="l426"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie,*tmpie1;
<a name="l427"></a> </span><span class=cF9>CAOTAbsAddr</span><span class=cF0> *tmpa,*tmpa1;
<a name="l428"></a> </span><span class=cF9>CAOTHeapGlblRef</span><span class=cF0> *tmphgr,*tmphgr1;
<a name="l429"></a> </span><span class=cF9>CAOTHeapGlbl</span><span class=cF0> *tmphg,*tmphg1;
<a name="l430"></a>
<a name="l431"></a> fbuf=</span><span class=cF5>ExtDft</span><span class=cF0>(filename,</span><span class=cF6>&quot;PRJ.Z&quot;</span><span class=cF0>);
<a name="l432"></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="l433"></a> </span><span class=cF1>if</span><span class=cF0> (map_name)
<a name="l434"></a> fbuf3=</span><span class=cF5>ExtDft</span><span class=cF0>(map_name,</span><span class=cF6>&quot;MAP.Z&quot;</span><span class=cF0>);
<a name="l435"></a>
<a name="l436"></a> </span><span class=cF1>if</span><span class=cF0> (tmpaot=</span><span class=cFD>CmpBuf</span><span class=cF7>(</span><span class=cF0>fbuf2,fbuf3,&amp;error_cnt,&amp;warning_cnt,mapfile_drv_let</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l437"></a> aot_U8s=tmpaot-&gt;aot_U8s;
<a name="l438"></a> ptr=patch_table;
<a name="l439"></a></span><span class=cF2>//See </span><a href="/Wb/Kernel/KLoad.HC.HTML#l181"><span class=cF4>Load</span></a><span class=cF2>()</span><span class=cF0>
<a name="l440"></a> cnt=0;
<a name="l441"></a> tmpa=tmpaot-&gt;abss;
<a name="l442"></a> </span><span class=cF1>while</span><span class=cF0> (tmpa) {
<a name="l443"></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="l444"></a> cnt++;
<a name="l445"></a> tmpa=tmpa-&gt;next;
<a name="l446"></a> }
<a name="l447"></a> </span><span class=cF1>if</span><span class=cF0> (cnt) {
<a name="l448"></a> *ptr++=</span><span class=cF3>IET_ABS_ADDR</span><span class=cF0>;
<a name="l449"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++=cnt;
<a name="l450"></a> *ptr++=0;
<a name="l451"></a> tmpa=tmpaot-&gt;abss;
<a name="l452"></a> </span><span class=cF1>while</span><span class=cF0> (tmpa) </span><span class=cF7>{</span><span class=cF0>
<a name="l453"></a> tmpa1=tmpa-&gt;next;
<a name="l454"></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="l455"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++ =tmpa-&gt;rip;
<a name="l456"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpa);
<a name="l457"></a> tmpa=tmpa1;
<a name="l458"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l459"></a> }
<a name="l460"></a> tmphg=tmpaot-&gt;heap_glbls;
<a name="l461"></a> </span><span class=cF1>while</span><span class=cF0> (tmphg) {
<a name="l462"></a> tmphg1=tmphg-&gt;next;
<a name="l463"></a> cnt=0;
<a name="l464"></a> tmphgr=tmphg-&gt;references;
<a name="l465"></a> </span><span class=cF1>while</span><span class=cF0> (tmphgr) </span><span class=cF7>{</span><span class=cF0>
<a name="l466"></a> cnt++;
<a name="l467"></a> tmphgr=tmphgr-&gt;next;
<a name="l468"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (cnt) </span><span class=cF7>{</span><span class=cF0>
<a name="l470"></a> *ptr++=</span><span class=cF3>IET_DATA_HEAP</span><span class=cF0>;
<a name="l471"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++=cnt;
<a name="l472"></a> </span><span class=cF1>if</span><span class=cF0> (tmphg-&gt;str) {
<a name="l473"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(tmphg-&gt;str);
<a name="l474"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ptr,tmphg-&gt;str,i+1);
<a name="l475"></a> </span><span class=cF5>Free</span><span class=cF0>(tmphg-&gt;str);
<a name="l476"></a> ptr+=i+1;
<a name="l477"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l478"></a> *ptr++=0;
<a name="l479"></a> *ptr(</span><span class=cF9>I64</span><span class=cF0> *)++=tmphg-&gt;size;
<a name="l480"></a> tmphgr=tmphg-&gt;references;
<a name="l481"></a> </span><span class=cF1>while</span><span class=cF0> (tmphgr) {
<a name="l482"></a> tmphgr1=tmphgr-&gt;next;
<a name="l483"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++=tmphgr-&gt;rip;
<a name="l484"></a> </span><span class=cF5>Free</span><span class=cF0>(tmphgr);
<a name="l485"></a> tmphgr=tmphgr1;
<a name="l486"></a> }
<a name="l487"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l488"></a> </span><span class=cF5>Free</span><span class=cF0>(tmphg);
<a name="l489"></a> tmphg=tmphg1;
<a name="l490"></a> }
<a name="l491"></a>
<a name="l492"></a> </span><span class=cF2>//Do exports first</span><span class=cF0>
<a name="l493"></a> tmpie=tmpaot-&gt;next_ie;
<a name="l494"></a> </span><span class=cF1>while</span><span class=cF0> (tmpie!=&amp;tmpaot-&gt;next_ie) {
<a name="l495"></a> tmpie1=tmpie-&gt;next;
<a name="l496"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l497"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpie);
<a name="l498"></a> *ptr++=tmpie-&gt;type;
<a name="l499"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++=tmpie-&gt;rip;
<a name="l500"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str) {
<a name="l501"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(tmpie-&gt;str);
<a name="l502"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ptr,tmpie-&gt;str,i+1);
<a name="l503"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;str);
<a name="l504"></a> ptr+=i+1;
<a name="l505"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l506"></a> *ptr++=0;
<a name="l507"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;src_link);
<a name="l508"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie);
<a name="l509"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l510"></a> tmpie=tmpie1;
<a name="l511"></a> }
<a name="l512"></a>
<a name="l513"></a> </span><span class=cF2>//Do imports second</span><span class=cF0>
<a name="l514"></a> tmpie=tmpaot-&gt;next_ie;
<a name="l515"></a> </span><span class=cF1>while</span><span class=cF0> (tmpie!=&amp;tmpaot-&gt;next_ie) {
<a name="l516"></a> tmpie1=tmpie-&gt;next;
<a name="l517"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpie);
<a name="l518"></a> *ptr++=tmpie-&gt;type;
<a name="l519"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;aot)
<a name="l520"></a> tmpie-&gt;rip+=tmpie-&gt;aot-&gt;rip2;
<a name="l521"></a> *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++=tmpie-&gt;rip;
<a name="l522"></a> </span><span class=cF1>if</span><span class=cF0> (tmpie-&gt;str) </span><span class=cF7>{</span><span class=cF0>
<a name="l523"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(tmpie-&gt;str);
<a name="l524"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ptr,tmpie-&gt;str,i+1);
<a name="l525"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;str);
<a name="l526"></a> ptr+=i+1;
<a name="l527"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l528"></a> *ptr++=0;
<a name="l529"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie-&gt;src_link);
<a name="l530"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpie);
<a name="l531"></a> tmpie=tmpie1;
<a name="l532"></a> }
<a name="l533"></a>
<a name="l534"></a> *ptr++=</span><span class=cF3>IET_END</span><span class=cF0>;
<a name="l535"></a> </span><span class=cF5>MemSet</span><span class=cF0>(ptr,0,16);
<a name="l536"></a> i=ptr-patch_table;
<a name="l537"></a></span><span class=cF2>//Needs 16 ALIGN</span><span class=cF0>
<a name="l538"></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+15)&amp;-16;
<a name="l539"></a> bfh=</span><span class=cF5>MAlloc</span><span class=cF0>(size);
<a name="l540"></a> bfh-&gt;jmp=0xEB+256*(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CBinFile</span><span class=cF7>)</span><span class=cF0>-2);
<a name="l541"></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>)-2&lt;=</span><span class=cF3>I8_MAX</span><span class=cF0>
<a name="l542"></a> bfh-&gt;reserved=0;
<a name="l543"></a> bfh-&gt;bin_signature=</span><span class=cF3>BIN_SIGNATURE_VAL</span><span class=cF0>;
<a name="l544"></a> bfh-&gt;org=tmpaot-&gt;org;
<a name="l545"></a> bfh-&gt;module_align_bits=tmpaot-&gt;max_align_bits;
<a name="l546"></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="l547"></a> bfh-&gt;file_size=size;
<a name="l548"></a> </span><span class=cF5>MemCpy</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="l549"></a> </span><span class=cF5>MemCpy</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,
<a name="l550"></a> 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="l551"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf2);
<a name="l552"></a> </span><span class=cF1>if</span><span class=cF0> (out_name)
<a name="l553"></a> fbuf2=</span><span class=cF5>ExtDft</span><span class=cF0>(out_name,</span><span class=cF6>&quot;BIN.Z&quot;</span><span class=cF0>);
<a name="l554"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l555"></a> fbuf2=</span><span class=cF5>ExtChg</span><span class=cF0>(fbuf,</span><span class=cF6>&quot;BIN.Z&quot;</span><span class=cF0>);
<a name="l556"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(fbuf2,bfh,size);
<a name="l557"></a> </span><span class=cF5>Free</span><span class=cF0>(bfh);
<a name="l558"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpaot-&gt;buf);
<a name="l559"></a> </span><span class=cF5>QueDel</span><span class=cF0>(tmpaot);
<a name="l560"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpaot);
<a name="l561"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l562"></a> </span><span class=cF5>Free</span><span class=cF0>(patch_table);
<a name="l563"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf);
<a name="l564"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf2);
<a name="l565"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf3);
<a name="l566"></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>,
<a name="l567"></a> error_cnt,warning_cnt,aot_U8s,size);
<a name="l568"></a> </span><span class=cF1>return</span><span class=cF0> error_cnt;
<a name="l569"></a>}
<a name="l570"></a>
<a name="l571"></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>,
<a name="l572"></a> </span><span class=cF9>I64</span><span class=cF0> ccf_flags=0,</span><span class=cF9>CLexHashTableContext</span><span class=cF0> *htc=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l573"></a>{</span><span class=cF2>//JIT Compile and execute text from a puts(&quot;&quot;).</span><span class=cF0>
<a name="l574"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l575"></a> </span><span class=cF1>Bool</span><span class=cF0> okay=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l576"></a> </span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc;
<a name="l577"></a> </span><span class=cF1>if</span><span class=cF0> (!filename)
<a name="l578"></a> filename=</span><span class=cFB>blkdev</span><span class=cF0>.tmp_filename;
<a name="l579"></a> cc=</span><span class=cF5>CmpCtrlNew</span><span class=cF0>(buf,ccf_flags|</span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>,filename);
<a name="l580"></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) </span><span class=cF7>{</span><span class=cF0>
<a name="l581"></a> cc-&gt;opts=</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc-&gt;opts;
<a name="l582"></a> </span><span class=cF1>if</span><span class=cF0> (htc) {
<a name="l583"></a> cc-&gt;flags=cc-&gt;flags &amp;~</span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0> |
<a name="l584"></a> htc-&gt;old_flags&amp;</span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>;
<a name="l585"></a> </span><span class=cF5>MemCpy</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="l586"></a> }
<a name="l587"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l588"></a> </span><span class=cF5>QueIns</span><span class=cF0>(cc,</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc);
<a name="l589"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l590"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l591"></a> res=</span><span class=cF5>ExeCmdLine</span><span class=cF0>(cc);
<a name="l592"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l593"></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="l594"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l595"></a> okay=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l596"></a> res=0;
<a name="l597"></a> }
<a name="l598"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l599"></a> </span><span class=cF5>QueRem</span><span class=cF0>(cc);
<a name="l600"></a> </span><span class=cF1>if</span><span class=cF0> (okay)
<a name="l601"></a> </span><span class=cF5>CmpCtrlDel</span><span class=cF0>(cc); </span><span class=cF2>//TODO: can crash</span><span class=cF0>
<a name="l602"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l603"></a>}
<a name="l604"></a>
<a name="l605"></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> *fmt,...)
<a name="l606"></a>{</span><span class=cF2>//JIT Compile and execute text from a printf().</span><span class=cF0>
<a name="l607"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l608"></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>,fmt,argc,argv);
<a name="l609"></a> res=</span><span class=cF5>ExePutS</span><span class=cF0>(buf);
<a name="l610"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l611"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l612"></a>}
<a name="l613"></a>
<a name="l614"></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=0)
<a name="l615"></a>{</span><span class=cF2>//JIT Compile and execute a file.</span><span class=cF0>
<a name="l616"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l617"></a> </span><span class=cF1>U8</span><span class=cF0> *name2=</span><span class=cF5>ExtDft</span><span class=cF0>(name,</span><span class=cF6>&quot;HC.Z&quot;</span><span class=cF0>),
<a name="l618"></a> *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="l619"></a> res=</span><span class=cF5>ExePutS</span><span class=cF0>(st,name,ccf_flags);
<a name="l620"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l621"></a> </span><span class=cF5>Free</span><span class=cF0>(name2);
<a name="l622"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l623"></a>}
<a name="l624"></a>
<a name="l625"></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=0,...)
<a name="l626"></a>{</span><span class=cF2>//</span><a href="/Wb/Compiler/CMain.HC.HTML#l614"><span class=cF4>ExeFile</span></a><span class=cF2>() with args using </span><a href="/Wb/Compiler/CMisc.HC.HTML#l48"><span class=cF4>LastFun</span></a><span class=cF2>().</span><span class=cF0>
<a name="l627"></a> </span><span class=cF5>ExeFile</span><span class=cF0>(name,ccf_flags);
<a name="l628"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>LastFun</span><span class=cF0>(argc,argv);
<a name="l629"></a>}
<a name="l630"></a>
<a name="l631"></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=0)
<a name="l632"></a>{</span><span class=cF2>//throws exceptions</span><span class=cF0>
<a name="l633"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l634"></a> </span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc;
<a name="l635"></a> </span><span class=cF1>if</span><span class=cF0> (!filename)
<a name="l636"></a> filename=</span><span class=cFB>blkdev</span><span class=cF0>.tmp_filename;
<a name="l637"></a> cc=</span><span class=cF5>CmpCtrlNew</span><span class=cF0>(buf,ccf_flags|</span><span class=cF3>CCF_DONT_FREE_BUF</span><span class=cF0>,filename);
<a name="l638"></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="l639"></a> cc-&gt;opts=</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc-&gt;opts;
<a name="l640"></a> </span><span class=cF5>QueIns</span><span class=cF0>(cc,</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc);
<a name="l641"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l642"></a> res=</span><span class=cF5>ExeCmdLine</span><span class=cF0>(cc);
<a name="l643"></a> </span><span class=cF5>QueRem</span><span class=cF0>(cc);
<a name="l644"></a> </span><span class=cF5>CmpCtrlDel</span><span class=cF0>(cc);
<a name="l645"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l646"></a>}
<a name="l647"></a>
<a name="l648"></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> *fmt,...)
<a name="l649"></a>{</span><span class=cF2>//throws exceptions</span><span class=cF0>
<a name="l650"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l651"></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>,fmt,argc,argv);
<a name="l652"></a> res=</span><span class=cF5>ExePutS2</span><span class=cF0>(buf);
<a name="l653"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l654"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l655"></a>}
<a name="l656"></a>
<a name="l657"></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=0)
<a name="l658"></a>{</span><span class=cF2>//throws exceptions</span><span class=cF0>
<a name="l659"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l660"></a> </span><span class=cF1>U8</span><span class=cF0> *name2=</span><span class=cF5>ExtDft</span><span class=cF0>(name,</span><span class=cF6>&quot;HC.Z&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="l661"></a> res=</span><span class=cF5>ExePutS2</span><span class=cF0>(st,name,ccf_flags);
<a name="l662"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l663"></a> </span><span class=cF5>Free</span><span class=cF0>(name2);
<a name="l664"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l665"></a>}
<a name="l666"></a>
<a name="l667"></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=0,...)
<a name="l668"></a>{</span><span class=cF2>//</span><a href="/Wb/Compiler/CMain.HC.HTML#l657"><span class=cF4>ExeFile2</span></a><span class=cF2>() with args using </span><a href="/Wb/Compiler/CMisc.HC.HTML#l48"><span class=cF4>LastFun</span></a><span class=cF2>(). throws exceptions.</span><span class=cF0>
<a name="l669"></a> </span><span class=cF5>ExeFile2</span><span class=cF0>(name,ccf_flags);
<a name="l670"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>LastFun</span><span class=cF0>(argc,argv);
<a name="l671"></a>}
<a name="l672"></a>
<a name="l673"></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> *fmt,...)
<a name="l674"></a>{</span><span class=cF2>//Causes value from stream to be used in an #exe{} block.</span><span class=cF0>
<a name="l675"></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>,fmt,argc,argv);
<a name="l676"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
<a name="l677"></a> </span><span class=cF9>CLexHashTableContext</span><span class=cF0> *htc;
<a name="l678"></a> </span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc=</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_cc;
<a name="l679"></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="l680"></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="l681"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l682"></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="l683"></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="l684"></a> </span><span class=cF1>if</span><span class=cF0> (htc=cc-&gt;htc.next)
<a name="l685"></a> res=</span><span class=cF5>ExePutS</span><span class=cF0>(buf,,,htc);
<a name="l686"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l687"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l688"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l689"></a>}
<a name="l690"></a>
<a name="l691"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CInit</span><span class=cF0>()
<a name="l692"></a>{
<a name="l693"></a> </span><span class=cFD>CmpLoadDefines</span><span class=cF0>;
<a name="l694"></a> </span><span class=cFD>CmpFillTables</span><span class=cF0>;
<a name="l695"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;</span><span class=cFB>cmp</span><span class=cF0>.ic_nop);
<a name="l696"></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="l697"></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="l698"></a> </span><span class=cFD>AsmHashLoad</span><span class=cF0>;
<a name="l699"></a> </span><span class=cFD>UAsmHashLoad</span><span class=cF0>;
<a name="l700"></a>}
<a name="l701"></a>
<a name="l702"></a></span><span class=cF5>CInit</span><span class=cF0>;
</span></pre></body>
</html>