Changeset 14


Ignore:
Timestamp:
Dec 29, 2007, 7:19:45 AM (11 years ago)
Author:
cameron
Message:

Optimized ]]> testing; end-tag scan

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bitlex.c

    r13 r14  
    1212
    1313#include "transpose.h"
     14
     15
    1416
    1517Lexer::Lexer(XML_Buffer *b, ParallelStreamSet *p) {
     
    4547  BitBlock LAngle = simd_and(temp8, temp14);
    4648  BitBlock temp15 = simd_and(temp12, temp5);
    47   LexItem[RAngle] = simd_and(temp8, temp15);
     49  BitBlock RAngle = simd_and(temp8, temp15);
    4850  BitBlock temp16 = simd_andc(bit[1], bit[0]);
    4951  BitBlock temp17 = simd_andc(bit[3], bit[2]);
     
    5153  BitBlock temp19 = simd_andc(bit[7], bit[6]);
    5254  BitBlock temp20 = simd_and(temp12, temp19);
    53   LexItem[RBracket] = simd_and(temp18, temp20);
     55  BitBlock RBracket = simd_and(temp18, temp20);
    5456  LexItem[Hyphen] = simd_and(temp3, temp20);
    5557  BitBlock temp21 = simd_and(temp12, temp10);
     
    7981  LexItem[SQuote] = simd_or(LexItem[SQuote], AttScan);
    8082  LexItem[DQuote] = simd_or(LexItem[DQuote], AttScan);
    81 #ifdef OMIT_RBracket_In_Markup_Scan
     83
     84  /* Mark potential occurrences of ']]>'  These are all actual
     85     occurrences of ]]> as well as occurrences of ]] or ] at
     86     the block end. Shifting the RBracket and RAngle streams in
     87     negated forms ensures that a potential CD_End is not ruled
     88     out at the block boundary. */
     89  LexItem[CD_End_check] = simd_andc(RBracket,
     90                                simd_or(simd_sbli_64(simd_not(RBracket), 1),
     91                                        simd_sbli_64(simd_not(RAngle), 2)));
     92#ifdef OMIT_CD_End_check_In_Markup_Scan
    8293LexItem[MarkupStart] = simd_or(LAngle, RefStart);
    8394#endif
    84 #ifndef OMIT_RBracket_In_Markup_Scan
    85   LexItem[MarkupStart] = simd_or(simd_or(LAngle, RefStart), LexItem[RBracket]);
     95#ifndef OMIT_CD_End_check_In_Markup_Scan
     96  LexItem[MarkupStart] = simd_or(simd_or(LAngle, RefStart), LexItem[CD_End_check]);
    8697#endif
    8798  LexItem[NonWS] = simd_not(WhiteSpace);
    8899  LexItem[NameFollow] = simd_or(simd_or(simd_or(WhiteSpace, Semicolon),
    89                                         simd_or(Slash, LexItem[RAngle])),
     100                                        simd_or(Slash, RAngle)),
    90101                                simd_or(Equals, LexItem[QMark]));
    91102}
     
    119130#endif
    120131}
    121 #if BYTE_ORDER == BIG_ENDIAN
    122 #define sisd_sfl(blk, n) sisd_srl(blk, n)
    123 #endif
    124 #if BYTE_ORDER == LITTLE_ENDIAN
    125 #define sisd_sfl(blk, n) sisd_sll(blk, n)
    126 #endif
    127132
    128133
  • trunk/src/bitlex.h

    r8 r14  
    1010
    1111#include "../lib/sse_simd.h"
     12
     13#if BYTE_ORDER == BIG_ENDIAN
     14#define sisd_sfl(blk, n) sisd_srl(blk, n)
     15#define sisd_sbl(blk, n) sisd_sll(blk, n)
     16#define sisd_sfli(blk, n) sisd_srli(blk, n)
     17#define sisd_sbli(blk, n) sisd_slli(blk, n)
     18#define simd_sbli_64(blk, n) simd_slli_64(blk, n)
     19#endif
     20#if BYTE_ORDER == LITTLE_ENDIAN
     21#define sisd_sfl(blk, n) sisd_sll(blk, n)
     22#define sisd_sbl(blk, n) sisd_srl(blk, n)
     23#define sisd_sfli(blk, n) sisd_slli(blk, n)
     24#define sisd_sbli(blk, n) sisd_srli(blk, n)
     25#define simd_sbli_64(blk, n) simd_srli_64(blk, n)
     26#endif
     27
    1228
    1329/* The BytePack and the BitBlock are the two fundamental
     
    3046
    3147enum lexical_item {
    32   MarkupStart, RAngle, RBracket, Hyphen, QMark, DQuote, SQuote,
     48  MarkupStart, CD_End_check, Hyphen, QMark, DQuote, SQuote,
    3349  NonWS, NameFollow};
    3450
  • trunk/src/engine.c

    r12 r14  
    2626
    2727#define OFFSET32_SENTINEL
    28 #if (BYTE_ORDER == LITTLE_ENDIAN)
    29 #define bitblock_sfli sisd_slli
    30 #endif
    3128
    3229  /* Install sentinels for every lexical item stream*/
     
    314311inline void ParsingEngine::Parse_EndTag () {
    315312        int markup_start = AbsPos();
    316 #ifndef OMIT_ADVANCE_PRIOR_TO_EXLUSIVE_SCAN
     313#ifndef OMIT_ADVANCE_PRIOR_TO_EXCLUSIVE_SCAN
    317314        Advance(2); /* Skip "</". */
    318315#endif
    319         ScanTo(RAngle);
    320         Advance(1);
    321         EndTag_action(markup_start, AbsPos());
     316        ScanTo(NameFollow);
     317        if (AtChar('>')) {
     318                Advance(1);
     319                EndTag_action(markup_start, AbsPos());
     320        }
     321        else {
     322                ScanTo(NonWS);
     323                if (AtChar('>')) {
     324                        Advance(1);
     325                        EndTag_action(markup_start, AbsPos());
     326                }
     327                else Error_action(markup_start, AbsPos());
     328        }
    322329}
    323330
     
    330337        }
    331338        else {
    332                 ScanTo(RBracket);
     339                ScanTo(CD_End_check);
    333340                while (!at_CDATA_End()) {
    334341                        Advance(1);
    335                         ScanTo(RBracket);
     342                        ScanTo(CD_End_check);
    336343                }
    337344                Advance(3); /* Skip "]]>". */
Note: See TracChangeset for help on using the changeset viewer.