Changeset 755 for proto/JSON/src


Ignore:
Timestamp:
Dec 1, 2010, 2:56:27 PM (8 years ago)
Author:
ksherdy
Message:

Update template.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/JSON/src/json.c

    r746 r755  
    1717#define BUFFER_SIZE (BLOCK_SIZE * 16)           /* BUFFER_SIZE          - multiple of BLOCK_SIZE */
    1818#define OVERLAP_BUFSIZE BLOCK_SIZE              /* OVERLAP_BUFSIZE      - SIMD register width in bytes overlap */
     19
     20#define DEBUG 1
    1921
    2022#ifdef BUFFER_PROFILING
     
    4547BitBlock temp49;
    4648BitBlock temp42;
     49BitBlock StringErrors_1;
    4750BitBlock strct_u8__xF4_;
     51BitBlock StringErrors_3;
    4852BitBlock temp43;
     53BitBlock StringErrors_5;
     54BitBlock StringErrors_4;
    4955BitBlock strct_Lex__True_;
     56BitBlock strct_Lex__DecimalPoint_;
    5057BitBlock strct_Lex__Null_;
    5158BitBlock temp10;
    5259BitBlock array_bit__2_;
    5360BitBlock strct_u8__suffix_;
     61BitBlock StringSpans_6;
    5462BitBlock strct_u8__xE0_;
    5563BitBlock temp59;
     
    6371BitBlock temp51;
    6472BitBlock temp50;
     73BitBlock Temp9;
    6574BitBlock strct_Ctrl__CR_;
    6675BitBlock strct_Lex__f_;
    6776BitBlock UnescapedDQuotes;
     77BitBlock StringEscapeChars;
    6878BitBlock OddFinal;
    6979BitBlock strct_u8__unibyte_;
     80BitBlock StringErrors_0;
     81BitBlock TrueStarts;
     82BitBlock StringErrors_2;
    7083BitBlock array_bit__3_;
    7184BitBlock strct_u8__xED_;
     
    7487BitBlock temp29;
    7588BitBlock temp22;
    76 BitBlock EvenStart;
     89BitBlock strct_Ctrl__SP_;
    7790BitBlock temp20;
    7891BitBlock temp21;
     
    92105BitBlock temp8;
    93106BitBlock strct_Lex__a_;
     107BitBlock StringStarts;
    94108BitBlock strct_u8__x80_x8F_;
     109BitBlock StringCursor;
     110BitBlock NullStarts;
    95111BitBlock StringMask;
     112BitBlock strct_Lex__Digit1_9_;
    96113BitBlock strct_u8__prefix2_;
     114BitBlock AtomSpans;
    97115BitBlock array_bit__0_;
    98116BitBlock temp39;
     
    112130BitBlock temp35;
    113131BitBlock EvenFinal;
     132BitBlock AtomStarts;
    114133BitBlock strct_Lex__DQuote_;
    115 BitBlock EvenEscape;
     134BitBlock Temp20;
     135BitBlock Temp21;
    116136BitBlock strct_Lex__RSolidus_;
    117 //BitBlock Escape;
     137BitBlock Escape;
    118138BitBlock array_bit__1_;
    119139BitBlock Even;
     
    122142BitBlock Start;
    123143BitBlock strct_u8__xF0_;
     144BitBlock temp14;
    124145BitBlock strct_Ctrl__x00_x1F_;
    125146BitBlock strct_u8__x90_xBF_;
     147BitBlock uScope2;
    126148BitBlock strct_u8__badprefix_;
    127 BitBlock strct_Ctrl__SP_;
     149BitBlock EvenStart;
    128150BitBlock strct_Lex__False_;
    129151BitBlock temp23;
     152BitBlock uScope1;
    130153BitBlock strct_Lex__Digit0_9_;
    131154BitBlock strct_Lex__Comma_;
    132155BitBlock array_bit__7_;
    133156BitBlock strct_Lex__Colon_;
    134 BitBlock OddStart;
     157BitBlock uScope4;
    135158BitBlock temp53;
    136 BitBlock strct_Lex__DecimalPoint_;
    137 BitBlock Escape;
     159BitBlock FalseStarts;
     160BitBlock error_mask;
     161BitBlock NumberStarts;
     162BitBlock StringNotEscapedChars;
     163BitBlock EscapeChars;
    138164BitBlock temp88;
    139165BitBlock temp89;
     166BitBlock strct_Lex__e_;
    140167BitBlock temp84;
    141168BitBlock temp85;
     
    147174BitBlock temp83;
    148175BitBlock strct_u8__xA0_xBF_;
     176BitBlock StringErrors;
    149177BitBlock strct_u8__prefix3_;
    150178BitBlock Odd;
     
    159187BitBlock temp68;
    160188BitBlock temp69;
    161 BitBlock strct_Lex__e_;
    162 BitBlock strct_Lex__PlusMinus_;
     189BitBlock Temp13;
     190BitBlock Temp12;
     191BitBlock Temp11;
     192BitBlock Temp10;
     193BitBlock Temp17;
     194BitBlock Temp16;
     195BitBlock Temp15;
     196BitBlock Temp14;
     197BitBlock Temp19;
     198BitBlock Temp18;
    163199BitBlock strct_Lex__u_;
    164200BitBlock strct_u8__x80_x9F_;
     201BitBlock uScope3;
    165202BitBlock strct_Lex__Zero_;
     203BitBlock strct_Lex__WS_;
    166204BitBlock temp13;
    167205BitBlock temp12;
     
    171209BitBlock temp16;
    172210BitBlock temp15;
    173 BitBlock temp14;
     211BitBlock StringEnds;
     212BitBlock Temp7;
    174213BitBlock temp19;
    175214BitBlock temp18;
     
    189228BitBlock strct_u8__prefix_;
    190229BitBlock strct_Lex__s_;
    191 BitBlock strct_Lex__WS_;
     230BitBlock Temp5;
     231BitBlock EvenEscape;
    192232BitBlock array_bit__5_;
    193233BitBlock AllOne = simd_const_1(1);
     
    199239BitBlock Temp2;
    200240BitBlock Temp1;
    201 BitBlock Temp7;
     241BitBlock u;
    202242BitBlock Temp6;
    203 BitBlock Temp5;
     243BitBlock strct_Lex__PlusMinus_;
    204244BitBlock Temp4;
    205245BitBlock strct_Lex__HexDigit_;
    206246BitBlock strct_Lex__RCurlyBrace_;
    207247BitBlock Temp8;
    208 BitBlock strct_Lex__Digit1_9_;
     248BitBlock OddStart;
    209249CarryType carry1 = Carry0;
    210250CarryType carry0 = Carry0;
    211251CarryType carry3 = Carry0;
    212252CarryType carry2 = Carry0;
    213 
    214        
    215         BitBlock error_mask;
     253CarryType carry5 = Carry0;
     254CarryType carry4 = Carry0;
     255CarryType carry7 = Carry0;
     256CarryType carry6 = Carry0;
     257CarryType carry9 = Carry0;
     258CarryType carry8 = Carry0;
     259CarryType carry_brw0 = Carry0;
     260CarryType carry10 = Carry0;
     261
     262       
     263        // BitBlock error_mask;  // PyBit compiler auto declares this variables
    216264        BitBlock EOF_mask = simd_const_1(1);
    217265       
     
    417465Escape = simd_or(EvenEscape,OddEscape);
    418466UnescapedDQuotes = simd_andc(strct_Lex__DQuote_,Escape);
     467advance_with_carry(ParityMask, carry3, Temp8);
     468StringMask = simd_and(ParityMask,Temp8);
     469StringSpans_6 = simd_or(StringMask,UnescapedDQuotes);
     470Temp9 = simd_or(strct_Lex__True_,strct_Lex__False_);
     471Temp10 = simd_or(Temp9,strct_Lex__Null_);
     472Temp11 = simd_or(Temp10,strct_Lex__Number_);
     473AtomSpans = simd_or(Temp11,StringSpans_6);
     474advance_with_carry(AtomSpans, carry4, Temp12);
     475AtomStarts = simd_andc(AtomSpans,Temp12);
     476StringStarts = simd_and(AtomStarts,strct_Lex__DQuote_);
     477NumberStarts = simd_and(AtomStarts,temp44);
     478TrueStarts = simd_and(AtomStarts,temp68);
     479FalseStarts = simd_and(AtomStarts,temp62);
     480NullStarts = simd_and(AtomStarts,temp64);
     481StringEscapeChars = simd_and(EscapeChars,StringMask);
     482StringErrors_0 = simd_andc(StringEscapeChars,strct_Lex__Escape_);
     483u = simd_and(StringEscapeChars,strct_Lex__u_);
     484advance_with_carry(u, carry5, uScope1);
     485advance_with_carry(uScope1, carry6, uScope2);
     486advance_with_carry(uScope2, carry7, uScope3);
     487advance_with_carry(uScope3, carry8, uScope4);
     488Temp13 = simd_andc(uScope1,strct_Lex__HexDigit_);
     489StringErrors_1 = simd_or(StringErrors_0,Temp13);
     490Temp14 = simd_andc(uScope2,strct_Lex__HexDigit_);
     491StringErrors_2 = simd_or(StringErrors_1,Temp14);
     492Temp15 = simd_andc(uScope3,strct_Lex__HexDigit_);
     493StringErrors_3 = simd_or(StringErrors_2,Temp15);
     494Temp16 = simd_andc(uScope4,strct_Lex__HexDigit_);
     495StringErrors_4 = simd_or(StringErrors_3,Temp16);
     496Temp17 = simd_or(EscapeChars,strct_Lex__RSolidus_);
     497StringNotEscapedChars = simd_andc(StringMask,Temp17);
     498Temp18 = simd_and(StringNotEscapedChars,strct_Ctrl__x00_x1F_);
     499StringErrors_5 = simd_or(StringErrors_4,Temp18);
     500advance_with_carry(StringStarts, carry9, StringCursor);
     501adc128(StringCursor, StringMask, carry10, Temp19);
     502StringEnds = simd_andc(Temp19,StringMask);
     503Temp20 = simd_andc(StringEnds,UnescapedDQuotes);
     504StringErrors = simd_or(StringErrors_5,Temp20);
     505sbb128(StringEnds, StringStarts, carry_brw0, Temp21);
     506StringSpans = simd_or(Temp21,StringEnds);
     507error_mask = StringErrors;
     508
    419509
    420510                        /* Generate Parity Mask */
     
    423513                        bitblock_parity_mask = sisd_add( simd_not(sisd_srl(high_bit_is_set, sisd_from_int(BLOCK_SIZE-1))) , sisd_low_bit_mask);                                         
    424514                        ParityMask = bitblock_parallel_prefix_parity(UnescapedDQuotes, bitblock_parity_mask);
    425 
    426 advance_with_carry(ParityMask, carry3, Temp8);
    427 StringMask = simd_and(ParityMask,Temp8);
    428 StringSpans = simd_or(StringMask,UnescapedDQuotes);
    429 
    430 
    431                         /* strct_Lex__Null_ = simd_or(temp89,strct_Lex__l_); */
     515                       
     516                        #ifdef DEBUG
     517                       
    432518                        print_array_le("Data", &srcbuf[buf_pos],BLOCK_SIZE);
    433519                        print_simd_register("Escape", Escape);
    434                        
    435 
    436                        
    437520                        print_simd_register("Unescaped DQuote",UnescapedDQuotes);
    438521                        /*
     
    443526                        print_simd_register("StringMask", StringMask);
    444527                        print_simd_register("StringSpans", StringSpans);                                               
     528               
     529                        print_simd_register("AtomStarts", AtomStarts);
     530                        print_simd_register("StringStarts", StringStarts);
     531                        print_simd_register("NumberStarts", NumberStarts);
     532                        print_simd_register("TrueStarts", TrueStarts);
     533                        print_simd_register("FalseStarts", FalseStarts);
     534                        print_simd_register("NullStarts", NullStarts);
     535                                               
     536                        #endif
    445537                       
    446538                        if (bitblock_has_bit(error_mask)){
     
    638730advance_with_carry(ParityMask, carry3, Temp8);
    639731StringMask = simd_and(ParityMask,Temp8);
    640 StringSpans = simd_or(StringMask,UnescapedDQuotes);
    641 
    642 
    643                         /* strct_Lex__Null_ = simd_or(temp89,strct_Lex__l_); */
     732StringSpans_6 = simd_or(StringMask,UnescapedDQuotes);
     733Temp9 = simd_or(strct_Lex__True_,strct_Lex__False_);
     734Temp10 = simd_or(Temp9,strct_Lex__Null_);
     735Temp11 = simd_or(Temp10,strct_Lex__Number_);
     736AtomSpans = simd_or(Temp11,StringSpans_6);
     737advance_with_carry(AtomSpans, carry4, Temp12);
     738AtomStarts = simd_andc(AtomSpans,Temp12);
     739StringStarts = simd_and(AtomStarts,strct_Lex__DQuote_);
     740NumberStarts = simd_and(AtomStarts,temp44);
     741TrueStarts = simd_and(AtomStarts,temp68);
     742FalseStarts = simd_and(AtomStarts,temp62);
     743NullStarts = simd_and(AtomStarts,temp64);
     744
     745StringEscapeChars = simd_and(Escape,StringMask);
     746StringErrors_0 = simd_andc(StringEscapeChars,strct_Lex__Escape_);
     747u = simd_and(StringEscapeChars,strct_Lex__u_);
     748advance_with_carry(u, carry5, uScope1);
     749advance_with_carry(uScope1, carry6, uScope2);
     750advance_with_carry(uScope2, carry7, uScope3);
     751advance_with_carry(uScope3, carry8, uScope4);
     752Temp13 = simd_andc(uScope1,strct_Lex__HexDigit_);
     753StringErrors_1 = simd_or(StringErrors_0,Temp13);
     754Temp14 = simd_andc(uScope2,strct_Lex__HexDigit_);
     755StringErrors_2 = simd_or(StringErrors_1,Temp14);
     756Temp15 = simd_andc(uScope3,strct_Lex__HexDigit_);
     757StringErrors_3 = simd_or(StringErrors_2,Temp15);
     758Temp16 = simd_andc(uScope4,strct_Lex__HexDigit_);
     759StringErrors_4 = simd_or(StringErrors_3,Temp16);
     760Temp17 = simd_or(Escape,strct_Lex__RSolidus_);
     761StringNotEscapedChars = simd_andc(StringMask,Temp17);
     762Temp18 = simd_and(StringNotEscapedChars,strct_Ctrl__x00_x1F_);
     763StringErrors_5 = simd_or(StringErrors_4,Temp18);
     764advance_with_carry(StringStarts, carry9, StringCursor);
     765adc128(StringCursor, StringMask, carry10, Temp19);
     766StringEnds = simd_andc(Temp19,StringMask);
     767Temp20 = simd_andc(StringEnds,UnescapedDQuotes);
     768StringErrors = simd_or(StringErrors_5,Temp20);
     769sbb128(StringEnds, StringStarts, carry_brw0, Temp21);
     770StringSpans = simd_or(Temp21,StringEnds);
     771error_mask = StringErrors;
     772
     773                        #ifdef DEBUG
     774                       
    644775                        print_array_le("Data", &srcbuf[buf_pos],BLOCK_SIZE);
    645776                        print_simd_register("Escape", Escape);
    646                        
    647 
    648                        
    649                        
    650777                        print_simd_register("Unescaped DQuote",UnescapedDQuotes);
    651                        
     778                        /*
    652779                        print_simd_register("high_bit_is_set", high_bit_is_set);
    653780                        print_simd_register("high_bit_mask", high_bit_mask);
    654                        
     781                        */
    655782                        print_simd_register("ParityMask", ParityMask);
    656783                        print_simd_register("StringMask", StringMask);
    657                         print_simd_register("StringSpans", StringSpans);                       
     784                        print_simd_register("StringSpans", StringSpans);                                               
     785               
     786                        print_simd_register("AtomStarts", AtomStarts);
     787                        print_simd_register("StringStarts", StringStarts);
     788                        print_simd_register("NumberStarts", NumberStarts);
     789                        print_simd_register("TrueStarts", TrueStarts);
     790                        print_simd_register("FalseStarts", FalseStarts);
     791                        print_simd_register("NullStarts", NullStarts);
     792                       
     793                        print_simd_register("u", u);
     794                        print_simd_register("StringErrors", StringErrors);
     795                       
     796                        #endif
    658797                       
    659798                        if(bitblock_has_bit(error_mask)) {
Note: See TracChangeset for help on using the changeset viewer.