From dfd84c6fd3be9fe7d994e4e186b191ff55b41334 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 27 Mar 2006 13:42:06 +0000 Subject: [PATCH] * leb128 gets always a 64bit int * fixed sleb128 encode git-svn-id: trunk@3060 - --- compiler/aasmbase.pas | 21 +++++++++++---------- compiler/aggas.pas | 12 ++++++------ compiler/dbgdwarf.pas | 4 ++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/compiler/aasmbase.pas b/compiler/aasmbase.pas index 0df29b5b98..48fe365996 100644 --- a/compiler/aasmbase.pas +++ b/compiler/aasmbase.pas @@ -107,10 +107,10 @@ interface function use_smartlink_section:boolean; function maybe_smartlink_symbol:boolean; - function LengthUleb128(a: aword) : byte; - function LengthSleb128(a: aint) : byte; - function EncodeUleb128(a: aword;out buf) : byte; - function EncodeSleb128(a: aint;out buf) : byte; + function LengthUleb128(a: qword) : byte; + function LengthSleb128(a: int64) : byte; + function EncodeUleb128(a: qword;out buf) : byte; + function EncodeSleb128(a: int64;out buf) : byte; implementation @@ -134,7 +134,7 @@ implementation end; - function LengthUleb128(a: aword) : byte; + function LengthUleb128(a: qword) : byte; begin result:=0; repeat @@ -146,10 +146,10 @@ implementation end; - function LengthSleb128(a: aint) : byte; + function LengthSleb128(a: int64) : byte; var b, size: byte; - asign : aint; + asign : int64; neg, more: boolean; begin more := true; @@ -178,7 +178,7 @@ implementation end; - function EncodeUleb128(a: aword;out buf) : byte; + function EncodeUleb128(a: qword;out buf) : byte; var b: byte; pbuf : pbyte; @@ -199,10 +199,10 @@ implementation end; - function EncodeSleb128(a: aint;out buf) : byte; + function EncodeSleb128(a: int64;out buf) : byte; var b, size: byte; - asign : aint; + asign : int64; neg, more: boolean; pbuf : pbyte; begin @@ -229,6 +229,7 @@ implementation else b := b or $80; pbuf^:=b; + inc(pbuf); inc(result); if not(more) then break; diff --git a/compiler/aggas.pas b/compiler/aggas.pas index 69f5b72ccf..9ef4dba729 100644 --- a/compiler/aggas.pas +++ b/compiler/aggas.pas @@ -57,8 +57,8 @@ interface destructor destroy; override; private setcount: longint; - procedure WriteDecodedSleb128(a: aint); - procedure WriteDecodedUleb128(a: aword); + procedure WriteDecodedSleb128(a: int64); + procedure WriteDecodedUleb128(a: qword); function NextSetLabel: string; protected InstrWriter: TCPUInstrWriter; @@ -326,7 +326,7 @@ implementation end; - procedure TGNUAssembler.WriteDecodedUleb128(a: aword); + procedure TGNUAssembler.WriteDecodedUleb128(a: qword); var i,len : longint; buf : array[0..63] of byte; @@ -341,7 +341,7 @@ implementation end; - procedure TGNUAssembler.WriteDecodedSleb128(a: aint); + procedure TGNUAssembler.WriteDecodedSleb128(a: int64); var i,len : longint; buf : array[0..255] of byte; @@ -631,9 +631,9 @@ implementation AsmWrite(ait_const2str[aitconst_8bit]); case tai_const(hp).consttype of aitconst_uleb128bit: - WriteDecodedUleb128(aword(tai_const(hp).value)); + WriteDecodedUleb128(qword(tai_const(hp).value)); aitconst_sleb128bit: - WriteDecodedSleb128(aint(tai_const(hp).value)); + WriteDecodedSleb128(int64(tai_const(hp).value)); end end else diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index c417e349ac..105de88df7 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -930,8 +930,8 @@ implementation finish_entry; { to simplify things, we don't write a multidimensional array here } append_entry(DW_TAG_subrange_type,false,[ - DW_AT_lower_bound,DW_FORM_udata,def.lowrange, - DW_AT_upper_bound,DW_FORM_udata,def.highrange + DW_AT_lower_bound,DW_FORM_sdata,def.lowrange, + DW_AT_upper_bound,DW_FORM_sdata,def.highrange ]); append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.rangetype.def)); finish_entry;