
The "props" file still has * ".rkt" `drdr:timeout` entries, needed until DrDr uses submodules and "info.rkt" files; although timeout information has been put in submodules for `raco test`, DrDr uses `raco test` in a way that does not enable timeouts, so that DrDr can implement timeouts itself (and record when a test times out) * ".rkt" `drdr:random #t` entries; not sure what to do with these, yet * ".rkt" `responsible` entries; not sure what to do with these, yet * ".rktl" `drdr:command-line #f` entries, needed until all ".rktl" files are disabled in DrDr The following files were previously disabled for DrDr testing, but were intentionally left as enabled with these changes: pkgs/racket-pkgs/racket-test/tests/pkg/shelly.rkt pkgs/racket-pkgs/racket-test/tests/pkg/util.rkt pkgs/racket-pkgs/racket-test/tests/pkg/info.rkt pkgs/racket-pkgs/racket-test/tests/pkg/basic-index.rkt pkgs/racket-pkgs/racket-test/tests/racket/link.rkt pkgs/racket-pkgs/racket-test/tests/racket/embed-in-c.rkt pkgs/racket-pkgs/racket-doc/ffi/examples/use-c-printf.rkt pkgs/racket-pkgs/racket-doc/ffi/examples/c-printf.rkt pkgs/parser-tools-pkgs/parser-tools-lib/parser-tools/private-lex/error-tests.rkt pkgs/mysterx/mysterx.rkt pkgs/mysterx/main.rkt pkgs/games/gobblet/test-model.rkt pkgs/games/gobblet/test-explore.rkt pkgs/games/gobblet/robot.rkt pkgs/games/gobblet/check.rkt pkgs/db-pkgs/db-lib/db/private/odbc/main.rkt pkgs/db-pkgs/db-lib/db/private/odbc/ffi.rkt pkgs/db-pkgs/db-lib/db/private/odbc/dbsystem.rkt pkgs/db-pkgs/db-lib/db/private/odbc/connection.rkt pkgs/distributed-places-pkgs/distributed-places-lib/racket/place/distributed/examples/hello-world.rkt pkgs/redex-pkgs/redex-lib/redex/private/compiler/match.rkt pkgs/redex-pkgs/redex-lib/redex/private/compiler/match.rkt pkgs/htdp-pkgs/htdp-test/2htdp/utest/balls.rkt pkgs/gui-pkgs/gui-test/framework/tests/test-suite-utils.rkt pkgs/games/paint-by-numbers/raw-problems/size-calculation.rkt pkgs/db-pkgs/db-lib/db/odbc.rkt pkgs/compatibility-pkgs/compatibility-lib/mzlib/traceld.rkt pkgs/cext-lib/dynext/private/stdio.rkt pkgs/db-pkgs/db-lib/db/odbc.rkt racket/collects/ffi/unsafe/objc.rkt racket/collects/ffi/objc.rkt pkgs/racket-pkgs/racket-test/tests/pkg/tests-db.rkt pkgs/racket-pkgs/racket-test/tests/pkg/test-docs.rkt pkgs/racket-pkgs/racket-test/tests/pkg/test-catalogs-api.rkt pkgs/gui-pkg-manager-pkgs/gui-pkg-manager-lib/pkg/gui/main.rkt pkgs/redex-pkgs/redex-lib/redex/private/compiler/redextomatrix.rkt pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/base-env/base-special-env.rkt pkgs/planet-pkgs/planet-test/tests/planet/version.rkt pkgs/planet-pkgs/planet-test/tests/planet/test-docs-complete.rkt pkgs/planet-pkgs/planet-test/tests/planet/lang.rkt pkgs/planet-pkgs/planet-test/tests/planet/docs-build.rkt pkgs/drracket-pkgs/drracket-test/tests/drracket/follow-log.rkt pkgs/drracket-pkgs/drracket/drracket/private/dock-icon.rkt pkgs/drracket-pkgs/drracket-test/tests/drracket/tool-lib-and-sig.rkt
62 lines
2.5 KiB
Racket
62 lines
2.5 KiB
Racket
#lang racket/base
|
|
|
|
#|
|
|
Here's the idea:
|
|
|
|
- Take a module's bytecode
|
|
- Recursively get all the bytecode for modules that the target requires
|
|
- After reading it, prune everything that isn't at phase 0 (the runtime phase)
|
|
|
|
- Now that we have all the modules, the next step is to merge them into a single
|
|
module
|
|
-- Although actually we collapse them into the top-level, not a module
|
|
- To do that, we iterate through all the modules doing two things as we go:
|
|
-- Incrementing all the global variable references by all the references in all
|
|
the modules
|
|
--- So if A has 5, then B's start at index 5 and so on
|
|
-- Replacing module variable references with the actual global variables
|
|
corresponding to those variables
|
|
--- So if A's variable 'x' is in global slot 4, then if B refers to it, it
|
|
directly uses slot 4, rather than a module-variable slot
|
|
|
|
- At that point we have all the module code in a single top-level, but many
|
|
toplevels won't be used because a library function isn't really used
|
|
- So, we do a "garbage collection" on elements of the prefix
|
|
- First, we create a dependency graph of all toplevels and the initial scope
|
|
- Then, we do a DFS on the initial scope and keep all those toplevels, throwing
|
|
away the construction of everything else
|
|
[XXX: This may be broken because of side-effects.]
|
|
|
|
- Now we have a small amount code, but because we want to go back to source,
|
|
we need to fix it up a bit; because different modules may've used the same
|
|
names
|
|
- So, we do alpha-renaming, but it's easy because names are only used in the
|
|
compilation-top prefix structure
|
|
|
|
[TODO]
|
|
|
|
- Next, we decompile
|
|
- Then, it will pay to do dead code elimination and inlining, etc.
|
|
|#
|
|
|
|
(require racket/cmdline
|
|
racket/set
|
|
raco/command-name
|
|
"main.rkt")
|
|
|
|
|
|
(let ([output-file (make-parameter #f)])
|
|
(command-line #:program (short-program+command-name)
|
|
#:multi
|
|
[("-e" "--exclude-modules") path "Exclude <path> from flattening"
|
|
(current-excluded-modules (set-add (current-excluded-modules) path))]
|
|
#:once-each
|
|
[("-o") dest-filename "Write output as <dest-filename>"
|
|
(output-file (string->path dest-filename))]
|
|
[("-g" "--garbage-collect") "Garbage-collect final module (unsound)"
|
|
(garbage-collect-toplevels-enabled #t)]
|
|
#:args (filename)
|
|
(demodularize filename (output-file))))
|
|
|
|
(module test racket/base)
|