mirror of
https://github.com/janet-lang/janet
synced 2025-10-17 16:57:40 +00:00
Begin C Function specialization in the compiler.
This commit is contained in:
1
test/hello.dst
Normal file
1
test/hello.dst
Normal file
@@ -0,0 +1 @@
|
||||
(print "Hello, World!")
|
18
test/scratch.dst
Normal file
18
test/scratch.dst
Normal file
@@ -0,0 +1,18 @@
|
||||
(def fib (asm '{
|
||||
bytecode [
|
||||
(load-integer 2 2)
|
||||
(less-than 2 0 2)
|
||||
(jump-if-not 2 2)
|
||||
(return 0)
|
||||
(load-self 1)
|
||||
(add-immediate 0 0 -1)
|
||||
(push 0)
|
||||
(call 2 1)
|
||||
(add-immediate 0 0 -1)
|
||||
(push 0)
|
||||
(call 3 1)
|
||||
(add-integer 0 2 3)
|
||||
(return 0)
|
||||
]
|
||||
arity 1
|
||||
}))
|
@@ -151,6 +151,10 @@
|
||||
'(1 2 3) 5
|
||||
:apple 1)) "struct order does not matter 2")
|
||||
|
||||
# Symbol function
|
||||
|
||||
(assert (= (symbol "abc" 1 2 3) 'abc123) "symbol function")
|
||||
|
||||
# Fiber tests
|
||||
|
||||
(def afiber (fiber (fn [x]
|
||||
@@ -163,7 +167,7 @@
|
||||
|
||||
# yield tests
|
||||
|
||||
(def t (fiber (fn [] (transfer nil 1) (transfer nil 2) 3)))
|
||||
(def t (fiber (fn [] (transfer nil 1) (yield 2) 3)))
|
||||
|
||||
(assert (= 1 (transfer t)) "initial transfer to new fiber")
|
||||
(assert (= 2 (transfer t)) "second transfer to fiber")
|
||||
|
Reference in New Issue
Block a user