From: bdemsky Date: Thu, 16 Jun 2011 09:56:59 +0000 (+0000) Subject: code for generating mark bit tables X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=115ce882cecba10a03af77391dadeaaa8fc558a7;p=IRC.git code for generating mark bit tables --- diff --git a/Robust/src/Runtime/bamboo/buildprefix.java b/Robust/src/Runtime/bamboo/buildprefix.java new file mode 100644 index 00000000..82091b8c --- /dev/null +++ b/Robust/src/Runtime/bamboo/buildprefix.java @@ -0,0 +1,155 @@ +import java.io.*; + +public class buildprefix { + + public static void main(String xstr[]) { + buildprefix bf=new buildprefix(); + bf.foo(Integer.valueOf(xstr[0])); + } + boolean prefix=true; + int skipbyte=42; + int allocunits=2; + int max; + int maxbits; + public void foo(int maxbit) { + maxbits=maxbit; + max=1<=value) { + System.out.println(value+": "+count); + if (value==0&&!prefix) + value=2; + else + value++; + } + } + + System.out.print("int revmarkmappingarray[]={"); + value=0; + int printed=0; + for(int count=0;count=value) { + while(x[count]!=value) { + if (value!=0) { + System.out.print(", "); + if ((printed%16)==0) { + System.out.println(""); + System.out.print(" "); + } + } + System.out.print("0"); + printed++; + value++; + } + if (value!=0) { + System.out.print(", "); + + if ((printed%16)==0) { + System.out.println(""); + System.out.print(" "); + } + } + System.out.print(count); + printed++; + if (value==0&&!prefix) + value=2; + else + value++; + } + } + System.out.println("};"); + + System.out.print("int revmarkmappingarray[]={"); + value=0; + printed=0; + for(int count=0;count=value) { + while(x[count]!=value) { + if (value!=0) { + System.out.print(", "); + if ((printed%16)==0) { + System.out.println(""); + System.out.print(" "); + } + } + System.out.print("0x0"); + printed++; + value++; + } + if (value!=0) { + System.out.print(", "); + + if ((printed%16)==0) { + System.out.println(""); + System.out.print(" "); + } + } + long valcount=count; + System.out.print("0x"+Long.toHexString(valcount<<(32-maxbits))); + printed++; + if (value==0&&!prefix) + value=2; + else + value++; + } + } + System.out.println("};"); + } + + int mask(int x) { + return ((max-1)>>(maxbits-x))<<(maxbits-x); + } + + int bits(int x) { + if (x<2) + return 2; + else { + x=x*allocunits; + if (x>maxbits) + return maxbits; + else return x; + } + } + + int increment(int x) { + if (x==0&&!prefix) + return x+2; + if (x==skipbyte) + return x+2; + else + return x+1; + } +}