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

Clean up ABC code; add Mac-specific version

parent 85099e2d
......@@ -13,6 +13,7 @@ implementation module Gast.StdProperty
import Gast.Testable, StdEnv
from Math.Random import genRandInt
import System.OS
class (==>) infixr 1 b :: b p -> Property | Testable p
......@@ -226,17 +227,42 @@ thunk_name_to_string a = code {
.o 1 0
}
thunk_to_module_name_pointer :: !(a a->Bool) -> Int;
thunk_to_module_name_pointer a = code {
pushD_a 0
pop_a 1
push_b 0
load_si16 0
addI
load_i 6
pushI 4294967295
and%
}
thunk_to_module_name_pointer :: ((a a->Bool) -> Int)
thunk_to_module_name_pointer = IF_MAC v64mac (IF_INT_64_OR_32 v64 v32)
where
v32 :: !(a a -> Bool) -> Int
v32 _ = code {
pushD_a 0
pop_a 1
push_b 0
load_si16 0
addI
load_i 6
}
v64 :: !(a a -> Bool) -> Int
v64 _ = code {
pushD_a 0
pop_a 1
push_b 0
load_si16 0
addI
load_si32 6
}
v64mac :: !(a a -> Bool) -> Int
v64mac _ = code {
pushD_a 0
pop_a 1
push_b 0
load_si16 0
addI
push_b 0
load_si32 6
addI
pushI 6
addI
}
thunk_to_module_name_string :: !(a a->Bool) -> {#Char};
thunk_to_module_name_string a
......@@ -246,12 +272,18 @@ get_module_name :: !Int -> {#Char};
get_module_name m
= {get_module_name_char m i\\i<-[0..get_module_name_size m-1]};
get_module_name_size :: !Int -> Int;
get_module_name_size a = code {
load_i 0
pushI 4294967295
and%
}
get_module_name_size :: (Int -> Int)
get_module_name_size = IF_INT_64_OR_32 v64 v32
where
v32 :: !Int -> Int
v32 _ = code {
load_i 0
}
v64 :: !Int -> Int
v64 _ = code {
load_si32 0
}
get_module_name_char :: !Int !Int -> Char;
get_module_name_char a i = code {
......
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