Skip to content

Commit 755eaca

Browse files
committed
Increase interpreter stack size when run loop is enabled in LispKitRepl.
1 parent 3697a66 commit 755eaca

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

LispKit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"originHash" : "c0cf977fd6347d3cc8de46822359ed43d81d8a9d5f35685d1112a0e50aed672d",
2+
"originHash" : "38833ba30b68407110856ab66591f9ae6191d6797e0b3efd94ba0238e342ed30",
33
"pins" : [
44
{
55
"identity" : "bitbytedata",

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ debug: replinfo
1414

1515
repl: release
1616
ifeq ($(program),)
17-
.build/release/LispKitRepl -r Sources/LispKit/Resources -d LispKit
17+
.build/release/LispKitRepl -x -r Sources/LispKit/Resources -d LispKit
1818
else
19-
.build/release/LispKitRepl -r Sources/LispKit/Resources -d LispKit $(program)
19+
.build/release/LispKitRepl -x -r Sources/LispKit/Resources -d LispKit $(program)
2020
endif
2121

2222
release: replinfo

Sources/LispKit/Data/Expr.swift

+4
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ public enum Expr: Hashable {
554554
switch self {
555555
case .symbol(let sym):
556556
return .symbol(sym.root)
557+
case .pair(let car0, .pair(let car1, .pair(let car2, let cdr))):
558+
return .pair(car0.datum, .pair(car1.datum, .pair(car2.datum, cdr.datum)))
559+
case .pair(let car0, .pair(let car1, let cdr)):
560+
return .pair(car0.datum, .pair(car1.datum, cdr.datum))
557561
case .pair(let car, let cdr):
558562
return .pair(car.datum, cdr.datum)
559563
case .syntax(_, let expr):

Sources/LispKitRepl/AppInfo.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public struct AppInfo {
4343
public static let buildDate = { () -> String in
4444
let dateFormatter = DateFormatter()
4545
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
46-
return dateFormatter.string(from: Date(timeIntervalSince1970: 1720824594))
46+
return dateFormatter.string(from: Date(timeIntervalSince1970: 1721732211))
4747
}()
4848
public static let buildAnnotation = " (\(AppInfo.buildDate))"
4949
}

Sources/LispKitRepl/LispKitRepl.swift

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ struct LispKitRepl {
5656
repl.release()
5757
exit(succeeded ? 0 : 1)
5858
}
59+
// Set stack size of interpreter thread (12 MByte by default)
60+
main.stackSize = (repl.systemStackSize.value ?? (12 * 1024)) * 1024
61+
main.qualityOfService = .userInitiated
5962
main.start()
6063
RunLoop.current.run()
6164
} else {

Sources/LispKitTools/LispKitRepl.swift

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ open class LispKitRepl {
5555
public let raw: Option
5656
public let tabWidth: SingletonArgument<Int>
5757
public let runloop: Option
58+
public let systemStackSize: SingletonArgument<Int>
5859
public let help: Option
5960

6061
// LispKit setup
@@ -120,6 +121,9 @@ open class LispKitRepl {
120121
value: 2)
121122
self.runloop = f.option("x", "runloop",
122123
description: "Enable runloop, i.e. support asynchronous APIs")
124+
self.systemStackSize = f.int("y", "systemstack",
125+
description: "Stack size (in KB) of interpreter thread " +
126+
"(if --runloop is used)")
123127
self.help = f.option("h", "help",
124128
description: "Show description of usage and options of this tools.")
125129
// Instantiate the terminal

0 commit comments

Comments
 (0)