- Remove constant folding from the optimization lists; it's a core
language feature. You can't disable it.
- Group the optimizations into groups: NONE, SAFE, AGGRESSIVE,
EXPERIMENTAL
- Default to SAFE everywhere. This is just dead code elimination, which
was default prior to all the compiler improvements
- Provide CLI args for -O{0..3} to pick the groups
```
-O N Optimisation levels [default: 1]
0: Optimise nothing
1: Safe optimisations only, as used by the game and toolset
+RemoveDeadCode
2: Aggressive optimisations; faster and smaller code size
+RemoveDeadCode
+RemoveDeadBranches
3: Experimental optimisations; untested or known to break something
+RemoveDeadCode
+MeldInstructions
+RemoveDeadBranches
```
This is in response to #148 , but it only fixes it insofar that it
disables the problematic behavior by default.
## Testing
nwscript test corpus. Also ran manually with all four different -O
options and looked at disassembly.
## Changelog
### Changed
- nwn_script_comp: the default optimization level has been lowered from
2 to 1***
## Licence
- [x] I am licencing my change under the project's MIT licence,
including all changes to GPL-3.0 licenced parts of the codebase.
|
||
|---|---|---|
| .github/workflows | ||
| bin | ||
| dist/pkg-x86_64-windows | ||
| docs | ||
| neverwinter | ||
| private | ||
| scripts | ||
| tests | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| CHANGELOG.md | ||
| config.nims | ||
| LICENCE | ||
| neverwinter.nimble | ||
| nim.cfg | ||
| nimble.lock | ||
| nwn_asm.nim | ||
| nwn_compressedbuf.nim | ||
| nwn_erf.nim | ||
| nwn_erf_tlkify.nim | ||
| nwn_gff.nim | ||
| nwn_key_pack.nim | ||
| nwn_key_shadows.nim | ||
| nwn_key_transparent.nim | ||
| nwn_key_unpack.nim | ||
| nwn_net.nim | ||
| nwn_nwsync_fetch.nim | ||
| nwn_nwsync_print.nim | ||
| nwn_nwsync_prune.nim | ||
| nwn_nwsync_write.nim | ||
| nwn_resman_cat.nim | ||
| nwn_resman_diff.nim | ||
| nwn_resman_extract.nim | ||
| nwn_resman_grep.nim | ||
| nwn_resman_pkg.nim | ||
| nwn_resman_stats.nim | ||
| nwn_script_comp.nim | ||
| nwn_script_comp.nim.cfg | ||
| nwn_ssf.nim | ||
| nwn_tlk.nim | ||
| nwn_twoda.nim | ||
| pull_request_template.md | ||
| README.md | ||
| VERSION.tpl | ||
neverwinter.nim
This is a nim-lang library and utility collection to read and write data files used by Neverwinter Nights: Enhanced Edition.
It also includes the official script compiler source code and CLI utility, as well as tools to maintain a serverside NWSync repository.
Binary releases are available on the Github Releases page of this project. You do not need to install anything else.
Tools
All utilities write their working output to stdout, and any library- or tool-
related logging goes to stderr. You can turn on debug logging with --verbose,
and turn off all logging except errors with --quiet.
Call each utility with --help to get documentation on their usage.
General resman utilities
nwn_resman_stats: Get data on what is in a resman view.nwn_resman_grep: Grep a resman view for data.nwn_resman_extract: Pull files from resman into directory.nwn_resman_cat: Pull file(s) from resman and pipe them to stdout.nwn_resman_diff: Diffs two resman views (for language support).nwn_resman_pkgsrv: Repackage a resman view suitable for docker deployment.nwn_key_pack, nwn_key_unpack: Un/packs a keyfile into/from a directory structure.nwn_key_shadows: Get data on file shadowing in a list of key files.nwn_key_transparent: Get data on file duplication in a list of key files.
Most of these utilities embed a complete resman. The general idea is NOT to operate on single file formats. Instead, they all utilise the underlying resman implementation from the neverwinter library included in this repository.
For example, if you want to get statistics about a key file, you do not unpack it:
Instead, you use nwn_resman_stats and tell it to only load the key file you are
interested in.
Format conversion and user data utilities
nwn_gff: Transforms gff data to/from various formats, extract/embed SQLite.nwn_erf: Un/pack erf files.nwn_tlk: Transforms tlk tables from/to various formats.nwn_twoda: Transforms 2da files from/to various formats.nwn_erf_tlkify: Refactor strings in a erf into a exisiting or new tlk.nwn_sff: Convert SSF files to/from csv.nwn_compressedbuf: De/compress NWCompressedBuf payloads.nwn_net: A utility providing some network-related helpers, like querying servers.
Script compiler
nwn_script_comp: NWScript compiler using the official open-source compiler library.nwn_asm: Utility to deal with nwscript assembly.
NWSync
These utilities are the official way to maintain a NWSync serverside repository.
Note that all of these were previously at home on Beamdog/nwsync, but were moved here.
nwn_nwsync_write: Generate a serverside NWSync manifest.nwn_nwsync_prune: Trim serverside NWSync repository of unreferenced data, to save diskspace.nwn_nwsync_print: Print manifest contents in human-readable format.nwn_nwsync_fetch: Helper to synchronise a manifest server-to-server with aria2c.
Development
neverwinter.nim requires nim 2.0 or later set up to develop against.
Since moving to 2.0, the file nimble.lock is used to pin dependencies to specific versions.
You can keep building it simply by typing nimble build -d:release (where -d:release is optional). If you want to use nim or testament directly, you need to set up the local search path file with nimble setup.