Commit 93136a28 authored by Arjan Oortgiese's avatar Arjan Oortgiese

Initial commit graph-copy files from iTasks-SDK repository at commit 71b3c92c...

Initial commit graph-copy files from iTasks-SDK repository at commit 71b3c92c (https://gitlab.science.ru.nl/clean-and-itasks/iTasks-SDK/tree/71b3c92ca46ab50ed4131edddbd9318be34e79fb/Dependencies/graph_copy).
parents
# Set the default behavior, in case people don't have core.autocrlf set.
# * text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.icl text
*.dcl text
*.c text
*.h text
*.txt text
*.s text
*.sh text
*.bat text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.exe binary
*.o binary
**/Clean System Files
*.a
*.o
*.obj
*.exe
\ No newline at end of file
definition module graph_to_sapl_string
// JMJ 2007
// Convert a graph to a SAPL string that can be evaluated by the SAPL interpreter
// DynamicSapl is only for debugging purposes
:: DynamicSapl = IntS Int | BoolS Bool | CharS Char | RealS Real | StringS String | CstrS String String Int [DynamicSapl] |
FunctionS String String Int [DynamicSapl] | ArrayS Int [DynamicSapl] | ListS [DynamicSapl] |
TupleS Int [DynamicSapl] | RecS String String Int [DynamicSapl]
// Conversion to a SAPL string
graph_to_sapl_string :: !a -> String
string_to_graph :: !String -> .a
// Conversion to a SAPL intermediate format, only for debugging
graph_to_sapl_dynamic :: !a -> DynamicSapl
// Testing function for debugging, also gives decoding
graph_to_sapl_dynamic_test :: !a -> (({#Int},Char,{#String},Char,{#String}),Char,DynamicSapl,Char,String)
// Testing function for debugging, also gives decoding
print_graph :: !a -> String
\ No newline at end of file
This diff is collapsed.
all: copy_graph_to_string.o copy_graph_to_string_interface.o copy_string_to_graph.o copy_string_to_graph_interface.o
copy_graph_to_string.o: copy_graph_to_string.c
gcc -O -S -fomit-frame-pointer -DLINUX32 copy_graph_to_string.c -o copy_graph_to_string.a
sed -f s.sed copy_graph_to_string.a > copy_graph_to_string.s
as copy_graph_to_string.s -o copy_graph_to_string.o
cp copy_graph_to_string.o "Clean System Files"/copy_graph_to_string.o
copy_graph_to_string_interface.o: copy_graph_to_string_interface.s
as copy_graph_to_string_interface.s -o copy_graph_to_string_interface.o
cp copy_graph_to_string_interface.o "Clean System Files"/copy_graph_to_string_interface.o
copy_string_to_graph.o: copy_string_to_graph.c
gcc -O -S -fomit-frame-pointer -DLINUX32 copy_string_to_graph.c -o copy_string_to_graph.a
sed -f s.sed copy_string_to_graph.a > copy_string_to_graph.s
as copy_string_to_graph.s -o copy_string_to_graph.o
cp copy_string_to_graph.o "Clean System Files"/copy_string_to_graph.o
copy_string_to_graph_interface.o: copy_string_to_graph_interface.s
as copy_string_to_graph_interface.s -o copy_string_to_graph_interface.o
cp copy_string_to_graph_interface.o "Clean System Files"/copy_string_to_graph_interface.o
cleanup:
rm copy_graph_to_string.o
rm copy_graph_to_string_interface.o
rm copy_string_to_graph.o
rm copy_string_to_graph_interface.o
rm "Clean System Files"/copy_graph_to_string.o
rm "Clean System Files"/copy_graph_to_string_interface.o
rm "Clean System Files"/copy_string_to_graph.o
rm "Clean System Files"/copy_string_to_graph_interface.o
This diff is collapsed.
_TEXT segment para 'CODE'
_TEXT ends
_DATA segment para 'DATA'
_DATA ends
extrn copy_graph_to_string:near
extrn remove_forwarding_pointers_from_graph:near
extrn collect_1:near
if THREAD
heap_p_offset = 192
heap_size_offset = 280
endif
_TEXT segment
public __copy__graph__to__string
__copy__graph__to__string:
push rcx
if THREAD
mov rax,qword ptr heap_p_offset[r9]
mov rbx,qword ptr heap_size_offset[r9]
endif
mov rdx,rdi
lea r8,[rdi+r15*8]
mov rbp,rsp
or rsp,8
if THREAD
mov r12,r9
sub rsp,48
mov qword ptr 32[rsp],rbx
mov r9,rax
else
sub rsp,40
endif
call copy_graph_to_string
mov rsp,rbp
if THREAD
mov r9,r12
endif
mov rcx,qword ptr [rsp]
push rax
lea rdx,[rdi+r15*8]
mov rbp,rsp
or rsp,8
if THREAD
mov r12,r9
endif
sub rsp,40
call remove_forwarding_pointers_from_graph
mov rsp,rbp
if THREAD
mov r9,r12
endif
pop rcx
test rcx,rcx
jne __copy__graph__to__string_1
pop rcx
lea rbx,1[r15]
sub r15,rbx
call collect_1
add r15,rbx
jmp __copy__graph__to__string
__copy__graph__to__string_1:
add rsp,8
mov rax,qword ptr 8[rcx]
add rax,16+7
and rax,-8
add rdi,rax
sar rax,3
sub r15,rax
ret
_TEXT ends
end
.globl copy_graph_to_string
.globl remove_forwarding_pointers_from_graph
.globl collect_1l
.globl end_heap
.text
.globl __copy__graph__to__string
__copy__graph__to__string:
pushl %ecx
movl end_heap,%ebx
addl $32,%ebx
pushl %ebx
pushl %edi
pushl %ecx
call copy_graph_to_string
addl $12,%esp
movl (%esp),%ecx
pushl %eax
movl end_heap,%ebx
addl $32,%ebx
pushl %ebx
pushl %ecx
call remove_forwarding_pointers_from_graph
addl $8,%esp
popl %ecx
testl %ecx,%ecx
jne __copy__graph__to__string_1
popl %ecx
movl end_heap,%ebp
addl $4-32+32,%ebp
call collect_1l
jmp __copy__graph__to__string
__copy__graph__to__string_1:
addl $4,%esp
movl 4(%ecx),%eax
addl $8+3,%eax
andl $-4,%eax
addl %eax,%edi
ret
This diff is collapsed.
_TEXT segment para 'CODE'
_TEXT ends
_DATA segment para 'DATA'
_DATA ends
extrn collect_1:near
extrn copy_string_to_graph:near
extrn remove_forwarding_pointers_from_string:near
_TEXT segment
public __copy__string__to__graph
__copy__string__to__graph:
push rcx
sub rsp,8
mov r12,r9
mov r9,rsp
lea r8,[rdi+r15*8]
mov rdx,rdi
mov rbp,rsp
sub rsp,40
or rsp,8
call copy_string_to_graph
mov rsp,rbp
mov r9,r12
test rax,1
je __copy__string__to__graph_1
mov rcx,qword ptr 8[rsp]
and rax,-8
mov rdx,rax
mov rbp,rsp
or rsp,8
mov r12,r9
sub rsp,40
call remove_forwarding_pointers_from_string
mov rsp,rbp
mov r9,r12
pop rbx
pop rcx
sub rbx,rdi
sar rbx,3
sub r15,rbx
call collect_1
add r15,rbx
jmp __copy__string__to__graph
__copy__string__to__graph_1:
mov rbx,rdi
mov rdi,qword ptr [rsp]
mov rcx,rax
sub rbx,rdi
sar rbx,3
add r15,rbx
add rsp,16
ret
_TEXT ends
end
.globl collect_1l
.globl end_heap
.globl copy_string_to_graph
.globl remove_forwarding_pointers_from_string
.text
.globl __copy__string__to__graph
__copy__string__to__graph:
pushl %ecx
subl $4,%esp
pushl %esp
movl end_heap,%ebx
addl $32,%ebx
pushl %ebx
pushl %edi
pushl %ecx
call copy_string_to_graph
addl $16,%esp
testl $1,%eax
je __copy__string__to__graph_1
movl 4(%esp),%ecx
andl $-4,%eax
pushl %eax
pushl %ecx
call remove_forwarding_pointers_from_string
addl $8,%esp
popl %ebp
popl %ecx
subl $32,%ebp
call collect_1l
jmp __copy__string__to__graph
__copy__string__to__graph_1:
movl (%esp),%edi
movl %eax,%ecx
addl $8,%esp
ret
definition module dynamic_string
import StdDynamic
dynamic_to_string :: !Dynamic -> *{#Char}
string_to_dynamic :: *{#Char} -> .Dynamic
copy_to_string :: !.a -> *{#Char}
copy_from_string :: !*{#Char} -> (.a,!Int)
implementation module dynamic_string
import StdDynamic
import StdEnv
import code from "copy_graph_to_string_interface."
import code from "copy_graph_to_string."
import code from "copy_string_to_graph_interface."
import code from "copy_string_to_graph."
copy_to_string :: !.a -> *{#Char}
copy_to_string g = code {
.d 1 0
jsr _copy_graph_to_string
.o 1 0
}
copy_from_string :: !*{#Char} -> (.a,!Int)
copy_from_string g = code {
.d 1 0
jsr _copy_string_to_graph
.o 1 0
pushI 0
}
dynamic_to_string :: !Dynamic -> *{#Char}
dynamic_to_string d
= copy_to_string d
string_to_dynamic :: *{#Char} -> .Dynamic
string_to_dynamic s
# (d,_) = copy_from_string s
= d
mk_unique :: !{#Char} -> *{#Char}
mk_unique s = {s` \\ s` <-: s}
definition module graph_to_string_and_descriptors;
// includes unboxed record descriptors
graph_to_string_with_descriptors :: !a -> {#Char};
graph_to_string_with_descriptor_and_module_table :: !a -> (!{#Char},!{#{#Char}},!{#{#Char}});
// (graph,descriptor_table,module_table)
This diff is collapsed.
definition module graph_to_string_with_descriptors;
graph_to_string_with_descriptors :: !a -> {#Char};
graph_to_string_with_descriptor_and_module_table :: !a -> (!{#Char},!{#{#Char}},!{#{#Char}});
// (graph,descriptor_table,module_table)
This diff is collapsed.
s/_INT/INT/
s/_CHAR/CHAR/
s/_BOOL/BOOL/
s/_REAL/REAL/
s/_static_characters/static_characters/
s/_small_integers/small_integers/
s/_dINT/dINT/
s/_CHAR/CHAR/
s/_BOOL/BOOL/
s/_REAL/REAL/
s/_static_characters/static_characters/
s/_small_integers/small_integers/
s/\s*\.cfi.*//
s/\.macosx_version_min [0-9]*, [0-9]*//
definition module sapldebug
sapldebug :: !a .b -> .b
implementation module sapldebug
import StdEnv,graph_to_sapl_string, StdDebug,graph_to_string_with_descriptors
sapldebug :: !a .b -> .b
sapldebug a b = trace_n ("DEBUG: " +++ graph_to_sapl_string a) b
all: copy_graph_to_string.o copy_graph_to_string_interface.o copy_string_to_graph.o copy_string_to_graph_interface.o
copy_graph_to_string.o: copy_graph_to_string.c
gcc -S -O -DLINUX64 copy_graph_to_string.c -o copy_graph_to_string.a
sed -f s2.sed copy_graph_to_string.a > copy_graph_to_string.s
as copy_graph_to_string.s -o copy_graph_to_string.o
cp copy_graph_to_string.o "Clean System Files"/copy_graph_to_string.o
copy_graph_to_string_interface.o: copy_graph_to_string_interface.s
as copy_graph_to_string_interface.s -o copy_graph_to_string_interface.o
cp copy_graph_to_string_interface.o "Clean System Files"/copy_graph_to_string_interface.o
copy_string_to_graph.o: copy_string_to_graph.c
gcc -S -O -DLINUX64 copy_string_to_graph.c -o copy_string_to_graph.a
sed -f s2.sed copy_string_to_graph.a > copy_string_to_graph.s
as copy_string_to_graph.s -o copy_string_to_graph.o
cp copy_string_to_graph.o "Clean System Files"/copy_string_to_graph.o
copy_string_to_graph_interface.o: copy_string_to_graph_interface.s
as copy_string_to_graph_interface.s -o copy_string_to_graph_interface.o
cp copy_string_to_graph_interface.o "Clean System Files"/copy_string_to_graph_interface.o
cleanup:
rm copy_graph_to_string.o
rm copy_graph_to_string_interface.o
rm copy_string_to_graph.o
rm copy_string_to_graph_interface.o
rm "Clean System Files"/copy_graph_to_string.o
rm "Clean System Files"/copy_graph_to_string_interface.o
rm "Clean System Files"/copy_string_to_graph.o
rm "Clean System Files"/copy_string_to_graph_interface.o
This diff is collapsed.
_TEXT segment para 'CODE'
_TEXT ends
_DATA segment para 'DATA'
_DATA ends
extrn copy_graph_to_string:near
extrn remove_forwarding_pointers_from_graph:near
extrn collect_1:near
if THREAD
heap_p_offset = 192
heap_size_offset = 280
endif
_TEXT segment
public __copy__graph__to__string
__copy__graph__to__string:
push rcx
if THREAD
mov rax,qword ptr heap_p_offset[r9]
mov rbx,qword ptr heap_size_offset[r9]
endif
mov rdx,rdi
lea r8,[rdi+r15*8]
mov rbp,rsp
or rsp,8
if THREAD
mov r12,r9
sub rsp,48
mov qword ptr 32[rsp],rbx
mov r9,rax
else
sub rsp,40
endif
call copy_graph_to_string
mov rsp,rbp
if THREAD
mov r9,r12
endif
mov rcx,qword ptr [rsp]
push rax
lea rdx,[rdi+r15*8]
mov rbp,rsp
or rsp,8
if THREAD
mov r12,r9
endif
sub rsp,40
call remove_forwarding_pointers_from_graph
mov rsp,rbp
if THREAD
mov r9,r12
endif
pop rcx
test rcx,rcx
jne __copy__graph__to__string_1
pop rcx
lea rbx,1[r15]
sub r15,rbx
call collect_1
add r15,rbx
jmp __copy__graph__to__string
__copy__graph__to__string_1:
add rsp,8
mov rax,qword ptr 8[rcx]
add rax,16+7
and rax,-8
add rdi,rax
sar rax,3
sub r15,rax
ret
_TEXT ends
end
.globl copy_graph_to_string
.globl remove_forwarding_pointers_from_graph
.globl collect_1
.text
.intel_syntax noprefix
.globl __copy__graph__to__string
__copy__graph__to__string:
push rcx
mov r12,rsi
mov r13,rdi
mov rdi,rcx
mov rsi,r13
lea rdx,[r13+r15*8]
mov rbp,rsp
and rsp,-8
call copy_graph_to_string
mov rsp,rbp
mov rcx,qword ptr [rsp]
push rax
mov rdi,rcx
lea rsi,[r13+r15*8]
mov rbp,rsp
and rsp,-8
call remove_forwarding_pointers_from_graph
mov rsp,rbp
pop rcx
mov rsi,r12
mov rdi,r13
test rcx,rcx
jne __copy__graph__to__string_1
pop rcx
lea rbx,1[r15]
sub r15,rbx
call collect_1
add r15,rbx
jmp __copy__graph__to__string
__copy__graph__to__string_1:
add rsp,8
mov rax,qword ptr 8[rcx]
add rax,16+7
and rax,-8
add rdi,rax
sar rax,3
sub r15,rax
ret
This diff is collapsed.
_TEXT segment para 'CODE'
_TEXT ends
_DATA segment para 'DATA'
_DATA ends
extrn collect_1:near
extrn copy_string_to_graph:near
extrn remove_forwarding_pointers_from_string:near
_TEXT segment
public __copy__string__to__graph
__copy__string__to__graph:
push rcx
sub rsp,8
mov r12,r9
mov r9,rsp
lea r8,[rdi+r15*8]
mov rdx,rdi
mov rbp,rsp
sub rsp,40
or rsp,8
call copy_string_to_graph
mov rsp,rbp
mov r9,r12
test rax,1
je __copy__string__to__graph_1
mov rcx,qword ptr 8[rsp]
and rax,-8
mov rdx,rax
mov rbp,rsp
or rsp,8
mov r12,r9
sub rsp,40
call remove_forwarding_pointers_from_string
mov rsp,rbp
mov r9,r12
pop rbx
pop rcx
sub rbx,rdi
sar rbx,3
sub r15,rbx
call collect_1
add r15,rbx
jmp __copy__string__to__graph
__copy__string__to__graph_1:
mov rbx,rdi
mov rdi,qword ptr [rsp]
mov rcx,rax
sub rbx,rdi
sar rbx,3
add r15,rbx
add rsp,16
ret
_TEXT ends
end
.globl collect_1
.globl copy_string_to_graph
.globl remove_forwarding_pointers_from_string
.text
.intel_syntax noprefix
.globl __copy__string__to__graph
__copy__string__to__graph:
push rcx
sub rsp,8
mov r12,rsi
mov r13,rdi
mov rdi,rcx