Verified Commit ed9c6003 authored by Camil Staps's avatar Camil Staps 🚀

Optimise the optimiser a bit (closes #61)

parent 02ff4b64
Pipeline #15782 passed with stages
in 14 minutes and 25 seconds
......@@ -126,7 +126,11 @@ parseLine`{|CONS of d|} fx = \0 line -> case d.gcd_name of
'I' -> '\t' // Instruction
'A' -> '.' // Annotation
parseLine`{|OBJECT|} fx = \i s -> appFst OBJECT <$> fx i s
parseLine`{|EITHER|} fl fr = \i s -> appFst LEFT <$> fl i s <|> appFst RIGHT <$> fr i s
parseLine`{|EITHER|} fl fr = \i s -> case fl i s of
Just (l,i) -> Just (LEFT l,i)
Nothing -> case fr i s of
Just (r,i) -> Just (RIGHT r,i)
Nothing -> Nothing
parseLine`{|UNIT|} = \i _ -> Just (UNIT, i)
parseLine`{|PAIR|} fx fy = \i s -> fx i s >>= \(x,i) -> fy (skipSpace i s) s >>= \(y,i) -> Just (PAIR x y, skipSpace i s)
where
......
SHELL:=bash
CLM:=clm
CPM:=cpm
CLMFLAGS:=-IL Platform -nr -nt -h 20m
override CFLAGS+=\
-std=c99\
-Wall\
......@@ -37,7 +36,7 @@ optimise: .FORCE
$(CPM) project $@_win.prj build
else
optimise: .FORCE
$(CLM) $(CLMFLAGS) ABC.Optimise -o $@
$(CPM) project $@.prj build
endif
SRC_BCGEN:=\
......
......@@ -89,7 +89,7 @@ BC_WORD copy_to_interpreter(struct interpretation_environment *ie, BC_WORD *heap
words=(length+IF_INT_64_OR_32(7,3))/IF_INT_64_OR_32(8,4);
else if (desc == (BC_WORD) &dINT+2 || desc == (BC_WORD) &REAL+2)
words=length;
else {
else { /* TODO: unboxed record arrays */
heap[2]=(BC_WORD)&__ARRAY__+2;
heap[3]=length;
heap[4]=0;
......
......@@ -292,6 +292,7 @@ BC_WORD copy_to_host(struct InterpretationEnvironment *clean_ie, BC_WORD *node)
else if (desc == (BC_WORD) &dINT+2 || desc == (BC_WORD) &REAL+2)
words=len+3;
else { /* boxed array */
/* TODO: unboxed record arrays */
int words_needed = 5+len+(3+FINALIZER_SIZE_ON_HEAP)*len;
if (host_heap_free < words_needed)
return -2;
......
Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}/optimise
CodeGen
CheckStacks: False
CheckIndexes: False
Application
HeapSize: 20971520
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 20971520
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: True
DisableRTSFlags: True
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: False
GenericFusion: True
DescExL: False
Output
Output: NoConsole
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Path: {Application}*lib*StdEnv
Path: {Application}*lib*Platform
Precompile:
Postlink:
MainModule
Name: ABC.Optimise
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: True
......@@ -7,7 +7,7 @@ Global
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 2097152000
HeapSize: 20971520
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
......@@ -24,7 +24,7 @@ Global
Time: False
Stack: False
Dynamics: False
GenericFusion: False
GenericFusion: True
DescExL: False
Output
Output: NoConsole
......@@ -59,4 +59,4 @@ MainModule
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Fusion: True
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment