about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-10-08 23:10:46 -0700
committerKartik Agaram <vc@akkartik.com>2018-10-08 23:10:46 -0700
commit8423ad4aca6d2f327d9db495ba57be92885b3f1b (patch)
treeeb9456809b77b8cf7d5987d8eb455142d1bbe40a
parent47fbf5e3c7bed0edcf4bd32d57013d75dd7cdc9f (diff)
downloadmu-8423ad4aca6d2f327d9db495ba57be92885b3f1b.tar.gz
4676
On second thoughts, let's not use Mu's "null is real hardware" convention
for traces. There's no real difference between a real and fake trace stream,
so we'll just always explicitly pass in *Trace-stream in production code.
-rw-r--r--subx/055trace.subx34
1 files changed, 2 insertions, 32 deletions
diff --git a/subx/055trace.subx b/subx/055trace.subx
index 816ddc05..039496c8 100644
--- a/subx/055trace.subx
+++ b/subx/055trace.subx
@@ -66,7 +66,7 @@ initialize-trace-stream:
   c7          0/copy              1/mod/*+disp8   0/rm32/EAX    .           .             .           .           8/disp8         0xff4/imm32       # copy 0xff4 to *(EAX+8)
   c3/return
 
-# Append to the given trace stream. If it's null, append to the trace-stream saved in 'Trace-stream'.
+# Append to the given trace stream.
 trace:  # t : (address trace-stream), line : string
   # prolog
   55/push-EBP
@@ -80,12 +80,7 @@ trace:  # t : (address trace-stream), line : string
   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none              0/r32/EAX   8/disp8         .                 # copy *(EBP+8) to EAX
   # EBX = line
   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none              3/r32/EBX   0xc/disp8       .                 # copy *(EBP+12) to EBX
-  # if (t == 0) t = *Trace-stream
-  81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0/imm32           # compare EAX
-  75/jump-if-not-equal  $trace:t-initialized/disp8
-  8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   Trace-stream/disp32               # copy *Trace-stream to EAX
-$trace:t-initialized:
-  # otherwise append line to t.data from t.write
+  # append line to t.data from t.write
   #
   # pseudocode:
   #   length = *(EBX+8)
@@ -185,29 +180,4 @@ test-trace:
   # done
   c3/return
 
-test-trace-real:
-  # initialize-trace-stream()
-  e8/call  initialize-trace-stream/disp32
-  # trace(null/Real-trace-stream, "Ab")
-    # push args
-  68/push  "Ab"/imm32
-  68/push  0/imm32
-    # call
-  e8/call  trace/disp32
-    # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-  # check-ints-equal(*(*Trace-stream).data, 41/A 62/b 0a/newline 00, msg)
-    # push args
-  68/push  "F - test-trace-real"/imm32
-  68/push  0x0a6241/imm32/Ab-newline
-    # push *(*Trace-stream).data
-  8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   Trace-stream/disp32               # copy *Trace-stream to EAX
-  ff          6/subop/push        1/mod/*+disp8   0/rm32/EAX    .           .             .           .           0xc/disp8       .                 # push *(EAX+12)
-    # call
-  e8/call  check-ints-equal/disp32
-    # discard args
-  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-  # done
-  c3/return
-
 # vim:nowrap:textwidth=0
> 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382