This commit is contained in:
Irmen de Jong 2021-10-30 00:38:48 +02:00
parent 3767b4bbe7
commit 7b69df4db2
3 changed files with 3 additions and 14 deletions

View File

@ -248,8 +248,8 @@ private fun processAst(program: Program, errors: IErrorReporter, compilerOptions
program.checkIdentifiers(errors, compilerOptions) program.checkIdentifiers(errors, compilerOptions)
errors.report() errors.report()
// TODO: turning char literals into UBYTEs via an encoding should really happen in code gen - but for that we'd need DataType.CHAR // TODO: turning char literals into UBYTEs via an encoding should really happen in code gen - but for that we'd need DataType.CHAR
// NOTE: we will then lose the opportunity to do constant-folding on any expression containing a char literal, but how often will those occur? // ...but what do we gain from this? We can leave it as it is now: where a char literal is no more than syntactic sugar for an UBYTE value.
// Also they might be optimized away eventually in codegen or by the assembler even // By introduction a CHAR dt, we will also lose the opportunity to do constant-folding on any expression containing a char literal.
program.charLiteralsToUByteLiterals(compilerOptions.compTarget) program.charLiteralsToUByteLiterals(compilerOptions.compTarget)
program.constantFold(errors, compilerOptions.compTarget) program.constantFold(errors, compilerOptions.compTarget)
errors.report() errors.report()

View File

@ -151,14 +151,4 @@ sealed class SourceCode {
override val origin: String = name override val origin: String = name
override fun readText() = throw IOException("generated code nodes don't have a text representation") override fun readText() = throw IOException("generated code nodes don't have a text representation")
} }
// TODO: possibly more, like fromURL(..)
/* // For `jar:..` URLs
// see https://stackoverflow.com/questions/22605666/java-access-files-in-jar-causes-java-nio-file-filesystemnotfoundexception
var url = URL("jar:file:/E:/x16/prog8(meisl)/compiler/build/libs/prog8compiler-7.0-BETA3-all.jar!/prog8lib/c64/textio.p8")
val uri = url.toURI()
val parts = uri.toString().split("!")
val fs = FileSystems.newFileSystem(URI.create(parts[0]), mutableMapOf(Pair("", "")) )
val path = fs.getPath(parts[1])
*/
} }

View File

@ -32,8 +32,7 @@ Future
Perhaps replace all uses of .proc/.pend by .block/.bend will fix that? Perhaps replace all uses of .proc/.pend by .block/.bend will fix that?
(but we lose the optimizing aspect of the assembler where it strips out unused code. (but we lose the optimizing aspect of the assembler where it strips out unused code.
There's not really a dynamic switch possible as all assembly lib code is static and uses one or the other) There's not really a dynamic switch possible as all assembly lib code is static and uses one or the other)
- introduce byte-index operator to avoid index multiplications in loops over arrays? - introduce byte-index operator to avoid index multiplications in loops over arrays? see github issue #4
see https://www.reddit.com/r/programming/comments/alhj59/creating_a_programming_language_and_cross/eg898b9?utm_source=share&utm_medium=web2x&context=3
More code optimization ideas More code optimization ideas