diff --git a/CGI.pas b/CGI.pas index 6cb3227..0e0803b 100644 --- a/CGI.pas +++ b/CGI.pas @@ -279,7 +279,11 @@ type cgDouble, cgComp, cgExtended : (rval: extended); - cgString : (str: longStringPtr); + cgString : ( + case isByteSeq: boolean of + false : (str: longStringPtr); + true : (data: ptr; len: longint); + ); cgVoid, ccPointer : (pval: longint; pstr: longStringPtr); end; @@ -574,6 +578,16 @@ procedure GenS (fop: pcodes; str: longstringPtr); { str - pointer to string } +procedure GenBS (fop: pcodes; data: ptr; len: longint); + +{ generate an instruction that uses a byte sequence operand } +{ } +{ parameters: } +{ fop - operation code } +{ data - pointer to data } +{ data - length of data } + + procedure GenL1 (fop: pcodes; lval: longint; fp1: integer); { generate an instruction that uses a longint and an int } @@ -1230,6 +1244,30 @@ if codeGeneration then begin end; {GenS} +procedure GenBS {fop: pcodes; data: ptr; len: longint}; + +{ generate an instruction that uses a byte sequence operand } +{ } +{ parameters: } +{ fop - operation code } +{ data - pointer to data } +{ len - length of data } + +var + lcode: icptr; {local copy of code} + +begin {GenBS} +if codeGeneration then begin + lcode := code; + lcode^.optype := cgString; + lcode^.isByteSeq := true; + lcode^.data := data; + lcode^.len := len; + Gen0(fop); + end; {if} +end; {GenBS} + + procedure GenL1 {fop: pcodes; lval: longint; fp1: integer}; { generate an instruction that uses a longint and an int } diff --git a/DAG.pas b/DAG.pas index 3bb3981..13d6cca 100644 --- a/DAG.pas +++ b/DAG.pas @@ -202,7 +202,8 @@ else if (op1 <> nil) and (op2 <> nil) then or fastMath then CodesMatch := true; cgString: - CodesMatch := LongStrCmp(op1^.str, op2^.str); + if not (op1^.isByteSeq or op1^.isByteSeq) then + CodesMatch := LongStrCmp(op1^.str, op2^.str); cgVoid, ccPointer: if op1^.pval = op2^.pval then CodesMatch := LongStrCmp(op1^.str, op2^.str); diff --git a/Native.pas b/Native.pas index e4b231e..8cd5156 100644 --- a/Native.pas +++ b/Native.pas @@ -361,6 +361,7 @@ type rkind = (k1,k2,k3,k4); {cnv record types} var + bp: ^byte; {byte pointer} ch: char; {temp storage for string constants} cns: realRec; {for converting reals to bytes} cnv: record {for converting double, real to bytes} @@ -672,9 +673,20 @@ case mode of CnOut(cns.inSANE[j]); end; cgString : begin - sptr := icptr(name)^.str; - for j := 1 to sptr^.length do - CnOut(ord(sPtr^.str[j])); + if not icptr(name)^.isByteSeq then begin + sptr := icptr(name)^.str; + for j := 1 to sptr^.length do + CnOut(ord(sPtr^.str[j])); + end {if} + else begin + lval := 0; + while lval < icptr(name)^.len do begin + bp := pointer( + ord4(icptr(name)^.data) + lval); + CnOut(bp^); + lval := lval + 1; + end; + end; {else} end; ccPointer : begin if icptr(name)^.lab <> nil then begin diff --git a/Symbol.pas b/Symbol.pas index a338e4c..ffb8fba 100644 --- a/Symbol.pas +++ b/Symbol.pas @@ -801,7 +801,7 @@ procedure DoGlobals; begin {StaticInit} {allocate buffer} {(+3 for possible bitfield overhang)} - buffHandle := NewHandle(variable^.itype^.size+3, UserID, $8000, nil); + buffHandle := NewHandle(variable^.itype^.size+3, globalID, $8000, nil); if ToolError <> 0 then TermError(5); buffPtr := buffHandle^; @@ -892,25 +892,9 @@ procedure DoGlobals; endDisp := variable^.itype^.size else endDisp := relocs^.disp; - while endDisp - disp >= 8 do begin - qp := pointer(ord4(buffPtr) + disp); - GenQ1(dc_cns, qp^, 1); - disp := disp + 8; - end; {while} - if endDisp - disp >= 4 then begin - lp := pointer(ord4(buffPtr) + disp); - GenL1(dc_cns, lp^, 1); - disp := disp + 4; - end; {if} - if endDisp - disp >= 2 then begin - wp := pointer(ord4(buffPtr) + disp); - Gen2t(dc_cns, wp^, 1, cgUWord); - disp := disp + 2; - end; {if} - if endDisp - disp >= 1 then begin - bp := pointer(ord4(buffPtr) + disp); - Gen2t(dc_cns, bp^, 1, cgUByte); - disp := disp + 1; + if disp <> endDisp then begin + GenBS(dc_cns, pointer(ord4(buffPtr) + disp), endDisp - disp); + disp := endDisp; end; {if} if relocs <> nil then begin code^.optype := ccPointer; @@ -930,8 +914,6 @@ procedure DoGlobals; disp := disp + cgPointerSize; end; {if} end; {while} - - DisposeHandle(buffHandle); end; {StaticInit}