Skip to content

Commit 9fa33af

Browse files
committed
Fixed crash when execution gets aborted while loading and executing a file. Included changelog for release 1.9.2.
1 parent bfaecfa commit 9fa33af

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Changelog
22

3-
## 1.9.2 (2020-10-24)
4-
- TODO
3+
## 1.9.2 (2020-12-23)
4+
- Included new libraries: `(srfi 9)`, `(srfi 180)`, `(srfi 209)`, `(srfi 210)`
5+
- Extended library `(lispkit log)` with syntax `log-time`
6+
- Extended library `(lispkit debug)` with syntax `time-values`
7+
- Extended library `(lispkit math)` with procedures `fxodd?`, `fxeven?`, `fx-width`, `fx-greatest`, and `fx-least` in library `(lispkit math)`.; generalized procedure `number->string`
8+
- Fixed procedure `environment-bindings`, renamed `date-time-has-dst`
9+
- Fixed crash when execution gets aborted while loading and executing a file
10+
- Included new sample code: `DrawTrees.scm`, `EditDistance.scm`
11+
- Minor tweaks to the REPL
512

613
## 1.9.1 (2020-10-04)
714
- Revision of library `(lispkit test)` involving procedures `test-group-failed-tests`, `test-group-passed-tests`, `failed-tests`, `passed-tests`, `current-test-epsilon`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ _LispKit_ provides support for the following core features, many of which are ba
9595
[`(lispkit match)`](https://github.com/objecthub/swift-lispkit/wiki/LispKit-Match),
9696
[`(lispkit iterate)`](https://github.com/objecthub/swift-lispkit/wiki/LispKit-Iterate),
9797
[`(lispkit log)`](https://github.com/objecthub/swift-lispkit/wiki/LispKit-Log),
98-
`(lispkit debug)`,
98+
[`(lispkit debug)`](https://github.com/objecthub/swift-lispkit/wiki/LispKit-Debug),
9999
[`(lispkit set)`](https://github.com/objecthub/swift-lispkit/wiki/LispKit-Set),
100100
[`(lispkit stack)`](https://github.com/objecthub/swift-lispkit/wiki/LispKit-Stack),
101101
[`(lispkit queue)`](https://github.com/objecthub/swift-lispkit/wiki/LispKit-Queue),

Sources/LispKit/Primitives/DynamicControlLibrary.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public final class DynamicControlLibrary: NativeLibrary {
175175
self.execute("(call-with-current-continuation " +
176176
" (lambda (cont) (set! exit (lambda args (_trigger-exit cont args)))))")
177177
self.define(Procedure("emergency-exit", emergencyExit))
178+
self.define(Procedure("abort-eventually", abortEventually))
178179

179180
// Parameters
180181
self.define(Procedure("dynamic-environment", dynamicEnvironment))
@@ -455,6 +456,11 @@ public final class DynamicControlLibrary: NativeLibrary {
455456
return .undef
456457
}
457458

459+
private func abortEventually(expr: Expr?) -> Expr {
460+
self.context.machine.abort()
461+
return .void
462+
}
463+
458464
private func makeParameter(_ value: Expr, setter: Expr?) -> Expr {
459465
return .procedure(Procedure(setter ?? .null, value))
460466
}

Sources/LispKit/Runtime/VirtualMachine.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ public final class VirtualMachine: TrackedObject {
288288
do {
289289
return try self.apply(.procedure(raiseProc), to: .pair(.error(obj), .null))
290290
} catch let error as RuntimeError { // handle Lisp-related issues
291+
guard !self.abortionRequested else { // abortions bypass the raise mechanism
292+
return .error(error)
293+
}
291294
exception = error
292295
} catch let error { // handle OS-related issues
293296
exception = RuntimeError.os(error)
@@ -1032,7 +1035,7 @@ public final class VirtualMachine: TrackedObject {
10321035
}
10331036
return res
10341037
} catch let error as RuntimeError {
1035-
if error.stackTrace == nil {
1038+
if !self.abortionRequested && error.stackTrace == nil {
10361039
error.attach(stackTrace: self.getStackTrace())
10371040
}
10381041
throw error

0 commit comments

Comments
 (0)