in the middle of debugging GC

This commit is contained in:
2014-01-16 16:52:18 +00:00
parent 2e03937883
commit a4e4c5c127
9 changed files with 1458 additions and 1242 deletions

1062
lib/h2-scheme-execute.adb Normal file

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ package body Token is
begin
if Buffer.Len > 0 then
declare
subtype New_String is Object_String (1 .. Buffer.Len);
subtype New_String is Object_Character_Array (1 .. Buffer.Len);
type New_String_Pointer is access all New_String;
for New_String_Pointer'Size use Object_Pointer_Bits;
@ -37,8 +37,8 @@ package body Token is
procedure Append_Buffer (Interp: in out Interpreter_Record;
Buffer: in out Buffer_Record;
Source: in Object_String) is
Incr: Object_String_Size;
Source: in Object_Character_Array) is
Incr: Object_Size;
begin
if Buffer.Last >= Buffer.Len then
if Buffer.Len <= 0 then
@ -51,7 +51,7 @@ package body Token is
end if;
declare
subtype New_String is Object_String (1 .. Buffer.Len + Incr);
subtype New_String is Object_Character_Array (1 .. Buffer.Len + Incr);
type New_String_Pointer is access all New_String;
for New_String_Pointer'Size use Object_Pointer_Bits;
@ -96,7 +96,7 @@ package body Token is
procedure Set (Interp: in out Interpreter_Record;
Kind: in Token_Kind;
Value: in Object_Character) is
Tmp: Object_String(1..1);
Tmp: Object_Character_Array(1..1);
begin
Interp.Token.Kind := Kind;
Clear_Buffer (Interp.Token.Value);
@ -106,7 +106,7 @@ package body Token is
procedure Set (Interp: in out Interpreter_Record;
Kind: in Token_Kind;
Value: in Object_String) is
Value: in Object_Character_Array) is
begin
Interp.Token.Kind := Kind;
Clear_Buffer (Interp.Token.Value);
@ -116,7 +116,7 @@ package body Token is
end Set;
procedure Append_String (Interp: in out Interpreter_Record;
Value: in Object_String) is
Value: in Object_Character_Array) is
begin
if Value'Length > 0 then
Append_Buffer (Interp, Interp.Token.Value, Value);
@ -124,8 +124,8 @@ package body Token is
end Append_String;
procedure Append_Character (Interp: in out Interpreter_Record;
Value: in Object_Character) is
Tmp: Object_String(1..1) := (1 => Value);
Value: in Object_Character) is
Tmp: Object_Character_Array(1..1) := (1 => Value);
begin
Append_Buffer (Interp, Interp.Token.Value, Tmp);
end Append_Character;

File diff suppressed because it is too large Load Diff

View File

@ -128,25 +128,19 @@ package H2.Scheme is
subtype Object_Character is Character_Type;
subtype Object_String_Size is Object_Size;
subtype Object_String_Index is Object_Index;
type Object_String is array(Object_String_Index range <>) of Object_Character;
type Object_String_Pointer is access all Object_String;
for Object_String_Pointer'Size use Object_Pointer_Bits;
type Constant_Object_String_Pointer is access constant Object_String;
for Constant_Object_String_Pointer'Size use Object_Pointer_Bits;
-- TODO: are these Thin_XXXX necessary?
subtype Thin_Object_String is Object_String(Object_Index'Range);
type Thin_Object_String_Pointer is access all Thin_Object_String;
for Thin_Object_String_Pointer'Size use Object_Pointer_Bits;
type Object_Byte_Array is array(Object_Index range <>) of Object_Byte;
subtype Object_Character_Array is Object_String;
type Object_Pointer_Array is array(Object_Index range <>) of Object_Pointer;
type Object_Character_Array is array(Object_Index range <>) of Object_Character;
type Object_Byte_Array is array(Object_Index range <>) of Object_Byte;
type Object_Word_Array is array(Object_Index range <>) of Object_Word;
type Object_Character_Array_Pointer is access all Object_Character_Array;
for Object_Character_Array_Pointer'Size use Object_Pointer_Bits;
type Constant_Object_Character_Array_Pointer is access constant Object_Character_Array;
for Constant_Object_Character_Array_Pointer'Size use Object_Pointer_Bits;
subtype Thin_Object_Character_Array is Object_Character_Array(Object_Index'Range);
type Thin_Object_Character_Array_Pointer is access all Thin_Object_Character_Array;
for Thin_Object_Character_Array_Pointer'Size use Object_Pointer_Bits;
type Object_Kind is (
Moved_Object, -- internal use only
Pointer_Object,
@ -303,18 +297,18 @@ package H2.Scheme is
procedure Close (Stream: in out Stream_Record) is abstract;
procedure Read (Stream: in out Stream_Record;
Data: out Object_String;
Last: out Object_String_Size) is abstract;
Data: out Object_Character_Array;
Last: out Object_Size) is abstract;
procedure Write (Stream: in out Stream_Record;
Data: out Object_String;
Last: out Object_String_Size) is abstract;
Data: out Object_Character_Array;
Last: out Object_Size) is abstract;
type Stream_Pointer is access all Stream_Record'Class;
type Stream_Allocator is access
procedure (Interp: in out Interpreter_Record;
Name: Constant_Object_String_Pointer;
Name: access Object_Character_Array;
Result: out Stream_Pointer);
type Stream_Deallocator is access
@ -339,10 +333,10 @@ package H2.Scheme is
type IO_Record is record
--type IO_Record is limited record
Stream: Stream_Pointer := null;
--Data: Object_String(1..2048) := (others => Object_Character'First);
Data: Object_String(1..5) := (others => Object_Character'First);
Last: Object_String_Size := 0;
Pos: Object_String_Size := 0;
--Data: Object_Character_Array(1..2048) := (others => Object_Character'First);
Data: Object_Character_Array(1..5) := (others => Object_Character'First);
Last: Object_Size := 0;
Pos: Object_Size := 0;
Flags: IO_Flags := 0; -- EOF, ERROR
Next: IO_Pointer := null;
Iochar: IO_Character_Record; -- the last character read.
@ -430,12 +424,6 @@ package H2.Scheme is
-- -----------------------------------------------------------------------------
type Buffer_Record is record
Ptr: Thin_Object_String_Pointer := null;
Len: Object_String_Size := 0;
Last: Object_String_Size := 0;
end record;
private
type Heap_Element_Array is array(Heap_Size range <>) of aliased Heap_Element;
@ -449,6 +437,12 @@ private
type Heap_Number is mod 2 ** 1;
type Heap_Pointer_Array is array(Heap_Number'First .. Heap_Number'Last) of Heap_Pointer;
type Buffer_Record is record
Ptr: Thin_Object_Character_Array_Pointer := null;
Len: Object_Size := 0;
Last: Object_Size := 0;
end record;
type Token_Kind is (End_Token,
Identifier_Token,
Left_Parenthesis_Token,
@ -474,8 +468,8 @@ private
--type Interpreter_Record is tagged limited record
type Interpreter_Record is limited record
--Self: Interpreter_Pointer := null;
Self: Interpreter_Pointer := Interpreter_Record'Unchecked_Access; -- Current instance's pointer
Storage_Pool: Storage_Pool_Pointer := null;
Trait: Option_Record(Trait_Option);
Stream: Option_Record(Stream_Option);
@ -483,20 +477,21 @@ private
Heap: Heap_Pointer_Array := (others => null);
Current_Heap: Heap_Number := Heap_Number'First;
Root_Table: Object_Pointer := Nil_Pointer;
Symbol_Table: Object_Pointer := Nil_Pointer;
Root_Environment: Object_Pointer := Nil_Pointer;
Environment: Object_Pointer := Nil_Pointer;
Stack: Object_Pointer := Nil_Pointer;
Stack: aliased Object_Pointer := Nil_Pointer;
Mark: Object_Pointer := Nil_Pointer;
Top: Top_Record; -- temporary object pointers
Base_Input: aliased IO_Record;
Input: IO_Pointer := null;
Token: Token_Record;
LC_Unfetched: Standard.Boolean := Standard.False;
Top: Top_Record;
STACK_XXX: aliased Object_Pointer := Nil_Pointer;
end record;
package Token is
@ -513,10 +508,10 @@ private
procedure Set (Interp: in out Interpreter_Record;
Kind: in Token_Kind;
Value: in Object_String);
Value: in Object_Character_Array);
procedure Append_String (Interp: in out Interpreter_Record;
Value: in Object_String);
Value: in Object_Character_Array);
pragma Inline (Append_String);
procedure Append_Character (Interp: in out Interpreter_Record;

View File

@ -14,6 +14,7 @@ project Lib is
"h2-pool.ads",
"h2-scheme.adb",
"h2-scheme.ads",
"h2-scheme-execute.adb",
"h2-scheme-token.adb",
"h2-utf8.adb",
"h2-utf8.ads"
@ -28,7 +29,7 @@ project Lib is
package Compiler is
for Default_Switches ("Ada") use (
"-gnata", "-gnato", "-gnatN", "-gnatwl", "-gnat95", "-gnatW8"
"-gnata", "-gnato", "-gnatN", "-gnatwl", "-gnat95", "-gnatW8", "-g"
);
end Compiler;