Wolfgang Jeltsch pushed to branch wip/jeltsch/textual-bytecode-output at Glasgow Haskell Compiler / GHC
Commits:
-
021b832a
by Wolfgang Jeltsch at 2026-08-03T16:20:17+03:00
-
30184f3a
by Wolfgang Jeltsch at 2026-08-03T16:33:11+03:00
3 changed files:
- testsuite/tests/show-bytecode/Makefile
- testsuite/tests/show-bytecode/all.T
- + testsuite/tests/show-bytecode/normalize
Changes:
| ... | ... | @@ -2,34 +2,17 @@ TOP=../.. |
| 2 | 2 | include $(TOP)/mk/boilerplate.mk
|
| 3 | 3 | include $(TOP)/mk/test.mk
|
| 4 | 4 | |
| 5 | -compile = '$(TEST_HC)' $(TEST_HC_OPTS) \
|
|
| 6 | - -fbyte-code -fwrite-byte-code -no-link
|
|
| 7 | -show = '$(TEST_HC)' $(TEST_HC_OPTS) \
|
|
| 8 | - --show-byte-code
|
|
| 9 | -stabilize = sed -E -e ' \
|
|
| 10 | - s/_r[[:alnum:]]+/_@name_suffix@/g; \
|
|
| 11 | - s/^( *hash: )[[:xdigit:]]+/\1@hash@/g; \
|
|
| 12 | - s/^( *)[[:xdigit:]]+:/\1@hash@:/g; \
|
|
| 13 | - s/word [[:digit:]]{2}[[:digit:]]*/word @large_word@/ \
|
|
| 14 | - '
|
|
| 15 | -universalize = sed -E -e ' \
|
|
| 16 | - s/UInt[[:digit:]]+/UInt@word_size@/; \
|
|
| 17 | - s/W[[:digit:]]+#/W@word_size@#/ \
|
|
| 18 | - ' | \
|
|
| 19 | - uniq
|
|
| 20 | -normalize = $(stabilize) | $(universalize)
|
|
| 21 | -# The invocation of `uniq` in `$(universalize)` is merely for collapsing
|
|
| 22 | -# adjacent entries of `word @large_word@`, whose number may depend on the word
|
|
| 23 | -# size.
|
|
| 5 | +compile = '$(TEST_HC)' $(TEST_HC_OPTS) -fbyte-code -fwrite-byte-code -no-link
|
|
| 6 | +show = '$(TEST_HC)' $(TEST_HC_OPTS) --show-byte-code
|
|
| 24 | 7 | |
| 25 | 8 | show-bytecode-vanilla:
|
| 26 | 9 | $(compile) Example.hs
|
| 27 | - $(show) Example.gbc | $(normalize)
|
|
| 10 | + $(show) Example.gbc | ./normalize
|
|
| 28 | 11 | |
| 29 | 12 | show-bytecode-breakpoints:
|
| 30 | 13 | $(compile) -fbreak-points Example.hs
|
| 31 | - $(show) Example.gbc | $(normalize)
|
|
| 14 | + $(show) Example.gbc | ./normalize
|
|
| 32 | 15 | |
| 33 | 16 | show-bytecode-hpc:
|
| 34 | 17 | $(compile) -fhpc Example.hs
|
| 35 | - $(show) Example.gbc | $(normalize) |
|
| 18 | + $(show) Example.gbc | ./normalize |
| 1 | 1 | test(
|
| 2 | 2 | 'show-bytecode-vanilla',
|
| 3 | - extra_files(['Example.hs']),
|
|
| 3 | + extra_files(['Example.hs', 'normalize']),
|
|
| 4 | 4 | makefile_test,
|
| 5 | 5 | []
|
| 6 | 6 | )
|
| 7 | 7 | test(
|
| 8 | 8 | 'show-bytecode-breakpoints',
|
| 9 | - extra_files(['Example.hs']),
|
|
| 9 | + extra_files(['Example.hs', 'normalize']),
|
|
| 10 | 10 | makefile_test,
|
| 11 | 11 | []
|
| 12 | 12 | )
|
| 13 | 13 | test(
|
| 14 | 14 | 'show-bytecode-hpc',
|
| 15 | - extra_files(['Example.hs']),
|
|
| 15 | + extra_files(['Example.hs', 'normalize']),
|
|
| 16 | 16 | makefile_test,
|
| 17 | 17 | []
|
| 18 | 18 | ) |
| 1 | +#!/usr/bin/env bash
|
|
| 2 | + |
|
| 3 | +set -e -o pipefail
|
|
| 4 | + |
|
| 5 | +stabilize ()
|
|
| 6 | +{
|
|
| 7 | + sed -E -e '
|
|
| 8 | + s/_r[[:alnum:]]+/_@name_suffix@/g
|
|
| 9 | + s/^( *hash: )[[:xdigit:]]+/\1@hash@/g
|
|
| 10 | + s/^( *)[[:xdigit:]]+:/\1@hash@:/g
|
|
| 11 | + s/word [[:digit:]]{2}[[:digit:]]*/word @large_word@/
|
|
| 12 | + '
|
|
| 13 | +}
|
|
| 14 | + |
|
| 15 | +universalize ()
|
|
| 16 | +{
|
|
| 17 | + sed -E -e '
|
|
| 18 | + s/UInt[[:digit:]]+/UInt@word_size@/
|
|
| 19 | + s/W[[:digit:]]+#/W@word_size@#/
|
|
| 20 | + ' |
|
|
| 21 | + uniq
|
|
| 22 | + # The invocation of `uniq` is merely for collapsing adjacent entries of
|
|
| 23 | + # `word @large_word@`, whose number may depend on the word size.
|
|
| 24 | +}
|
|
| 25 | + |
|
| 26 | +stabilize | universalize |