Skip to content

Commit eebfdd9

Browse files
committed
Remove Execution.stackStart
1 parent 6bd9cf2 commit eebfdd9

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

Sources/WasmKit/Execution/Debugger.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
self.store = store
8888
self.execution = Execution(
8989
store: StoreRef(store),
90-
stackStart: .init(start: valueStack, count: limit),
9190
stackEnd: valueStack.advanced(by: limit)
9291
)
9392
self.threadingModel = store.engine.configuration.threadingModel

Sources/WasmKit/Execution/Execution.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ struct Execution: ~Copyable {
88
/// The reference to the ``Store`` associated with the execution.
99
let store: StoreRef
1010

11-
/// The start of the VM stack space, used for debugging purposes.
12-
let stackStart: UnsafeBufferPointer<StackSlot>
13-
1411
/// The end of the VM stack space.
1512
private let stackEnd: UnsafeMutablePointer<StackSlot>
1613
/// The error trap thrown during execution.
@@ -19,9 +16,8 @@ struct Execution: ~Copyable {
1916
private var trap: (error: UnsafeRawPointer, sp: Sp)? = nil
2017

2118
#if WasmDebuggingSupport
22-
package init(store: StoreRef, stackStart: UnsafeBufferPointer<StackSlot>, stackEnd: UnsafeMutablePointer<StackSlot>) {
19+
package init(store: StoreRef, stackEnd: UnsafeMutablePointer<StackSlot>) {
2320
self.store = store
24-
self.stackStart = stackStart
2521
self.stackEnd = stackEnd
2622
}
2723
#endif
@@ -37,7 +33,7 @@ struct Execution: ~Copyable {
3733
defer {
3834
valueStack.deallocate()
3935
}
40-
var context = Execution(store: store, stackStart: .init(start: valueStack, count: limit), stackEnd: valueStack.advanced(by: limit))
36+
var context = Execution(store: store, stackEnd: valueStack.advanced(by: limit))
4137
return try body(&context, valueStack)
4238
}
4339

Sources/WasmKitGDBHandler/DebuggerMemoryCache.swift renamed to Sources/WasmKitGDBHandler/DebuggerMemoryView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import NIOCore
1616
import WasmKit
1717

18-
package struct DebuggerMemoryCache: ~Copyable {
18+
package struct DebuggerMemoryView: ~Copyable {
1919
package static let executableCodeOffset = UInt64(0x4000_0000_0000_0000)
2020

2121
private let allocator: ByteBufferAllocator

Sources/WasmKitGDBHandler/WasmKitGDBHandler.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
private let allocator: ByteBufferAllocator
5757
private var debugger: Debugger
5858

59-
private var memoryCache: DebuggerMemoryCache
59+
private var memoryView: DebuggerMemoryView
6060

6161
package init(
6262
moduleFilePath: FilePath,
@@ -85,7 +85,7 @@
8585
throw Error.stoppingAtEntrypointFailed
8686
}
8787

88-
self.memoryCache = DebuggerMemoryCache(allocator: allocator, wasmBinary: wasmBinary)
88+
self.memoryView = DebuggerMemoryView(allocator: allocator, wasmBinary: wasmBinary)
8989
}
9090

9191
private func hexDump<I: FixedWidthInteger>(_ value: I, endianness: Endianness) -> String {
@@ -117,7 +117,7 @@
117117
switch self.debugger.state {
118118
case .stoppedAtBreakpoint(let breakpoint):
119119
let pc = breakpoint.wasmPc
120-
let pcInHostAddressSpace = UInt64(pc) + DebuggerMemoryCache.executableCodeOffset
120+
let pcInHostAddressSpace = UInt64(pc) + DebuggerMemoryView.executableCodeOffset
121121
result.append(("thread-pcs", self.hexDump(pcInHostAddressSpace, endianness: .big)))
122122
result.append(("00", self.hexDump(pcInHostAddressSpace, endianness: .little)))
123123
result.append(("reason", "trace"))
@@ -221,7 +221,7 @@
221221
"""
222222
l<library-list>\
223223
<library name="\(self.moduleFilePath.string)">\
224-
<section address="0x\(String(DebuggerMemoryCache.executableCodeOffset, radix: 16))"/>\
224+
<section address="0x\(String(DebuggerMemoryView.executableCodeOffset, radix: 16))"/>\
225225
</library>\
226226
</library-list>
227227
""")
@@ -238,7 +238,7 @@
238238
else { throw Error.unknownReadMemoryArguments }
239239

240240
responseKind = .hexEncodedBinary(
241-
try self.memoryCache.readMemory(
241+
try self.memoryView.readMemory(
242242
debugger: self.debugger,
243243
addressInProtocolSpace: addressInProtocolSpace,
244244
length: length
@@ -249,7 +249,7 @@
249249
let callStack = self.debugger.currentCallStack
250250
var buffer = self.allocator.buffer(capacity: callStack.count * 8)
251251
for pc in callStack {
252-
buffer.writeInteger(UInt64(pc) + DebuggerMemoryCache.executableCodeOffset, endianness: .little)
252+
buffer.writeInteger(UInt64(pc) + DebuggerMemoryView.executableCodeOffset, endianness: .little)
253253
}
254254
responseKind = .hexEncodedBinary(buffer.readableBytesView)
255255

@@ -288,7 +288,7 @@
288288
argumentsString: command.arguments,
289289
separator: ",",
290290
endianness: .big
291-
) - DebuggerMemoryCache.executableCodeOffset)
291+
) - DebuggerMemoryView.executableCodeOffset)
292292
)
293293
responseKind = .ok
294294

@@ -299,7 +299,7 @@
299299
argumentsString: command.arguments,
300300
separator: ",",
301301
endianness: .big
302-
) - DebuggerMemoryCache.executableCodeOffset)
302+
) - DebuggerMemoryView.executableCodeOffset)
303303
)
304304
responseKind = .ok
305305

0 commit comments

Comments
 (0)