diff options
Diffstat (limited to 'misc')
| -rw-r--r-- | misc/compile_time_execution_problems.md | 55 | ||||
| -rw-r--r-- | misc/lib_maker_clang.bat | 11 | ||||
| -rw-r--r-- | misc/libs.txt | 25 | ||||
| -rw-r--r-- | misc/logo-slim.png | bin | 0 -> 251710 bytes | |||
| -rw-r--r-- | misc/roadmap.md | 21 | ||||
| -rw-r--r-- | misc/todo.md | 18 |
6 files changed, 130 insertions, 0 deletions
diff --git a/misc/compile_time_execution_problems.md b/misc/compile_time_execution_problems.md new file mode 100644 index 000000000..8cfeca4e4 --- /dev/null +++ b/misc/compile_time_execution_problems.md @@ -0,0 +1,55 @@ +# Compile Time Execution Problems (Metaprogramming) +2016-11-02 + +## Memory and Types + +Compile time execution (CTE) is a stage of the compiler which runs any Odin code the +user requests before the creation of the executable. The data modified and generated +by this stage will be used as the initialization data for the _compiled_ code. + +The CTE stage is an interpreter running the generated _single static assignment_ (SSA) +tree for the requested code. When using the memory generated by the interpreter for the +compiled code, there are a few problems. The main problem being: pointers will point +to invalid memory addresses. This is becaused the memory space of the interpreter is +completely different to the memory space of the executable (compiled code). + +The table below presents which data types are safe for transferal and which are not. + +Key: + +* Y - Yes +* N - No +* D - Dependent on elements +* ? - Highly depends on a lot of factors (most likely no) + +| Type | Safe? | +|-----------|------------------------------------------------------------------------| +| boolean | Y | +| integer | Y | +| float | Y | +| pointer | N - Maybe safe if never changed | +| string | Y - Even though (ptr+int) interally, still safe to convert to constant | +| any | N - (ptr+ptr) | +| array | D | +| vector | Y - Elements can only be boolean, integer, or float (thus safe) | +| slice | N - Internally (ptr+int+int) | +| maybe | D | +| struct | D | +| enum | Y | +| union | N - (blob+int) | +| raw_union | N - ^^^ | +| tuple | D | +| proc | ? - Need to solve the next problem | + + +## Calling procedures (external and internal) + +If all the procedures are only from within the code itself, i.e. not a loaded pointer, +then it is "safe". However, calling external procedures and passing procedures from the +interpreter to external programs _will_ cause problems as many of the procedures are not +stored in _real_ memory. This causes numerous problems. + +**TODO:** + +* Look at how other languages solve this problem (e.g. LUA) +* ??? diff --git a/misc/lib_maker_clang.bat b/misc/lib_maker_clang.bat new file mode 100644 index 000000000..14899f6ef --- /dev/null +++ b/misc/lib_maker_clang.bat @@ -0,0 +1,11 @@ +@echo off +setlocal EnableDelayedExpansion + +set file_input=%1 +set name=%1 +FOR %%f IN (name) do ( + FOR %%g in (!%%f!) do set "%%f=%%~ng" +) + +call clang -O2 -c %file_input% -o %name%.o ^ + && call ar %name%.o -rcs %name%.lib diff --git a/misc/libs.txt b/misc/libs.txt new file mode 100644 index 000000000..f13b0fcc0 --- /dev/null +++ b/misc/libs.txt @@ -0,0 +1,25 @@ +LLVMX86Disassembler.lib ^ +LLVMX86AsmParser.lib ^ +LLVMX86CodeGen.lib ^ +LLVMSelectionDAG.lib ^ +LLVMAsmPrinter.lib ^ +LLVMCodeGen.lib ^ +LLVMTarget.lib ^ +LLVMScalarOpts.lib ^ +LLVMInstCombine.lib ^ +LLVMInstrumentation.lib ^ +LLVMProfileData.lib ^ +LLVMTransformUtils.lib ^ +LLVMBitWriter.lib ^ +LLVMAnalysis.lib ^ +LLVMX86Desc.lib ^ +LLVMObject.lib ^ +LLVMMCParser.lib ^ +LLVMBitReader.lib ^ +LLVMMCDisassembler.lib ^ +LLVMX86Info.lib ^ +LLVMX86AsmPrinter.lib ^ +LLVMMC.lib ^ +LLVMX86Utils.lib ^ +LLVMCore.lib ^ +LLVMSupport.lib ^ diff --git a/misc/logo-slim.png b/misc/logo-slim.png Binary files differnew file mode 100644 index 000000000..2b70e6a0c --- /dev/null +++ b/misc/logo-slim.png diff --git a/misc/roadmap.md b/misc/roadmap.md new file mode 100644 index 000000000..83fbbb695 --- /dev/null +++ b/misc/roadmap.md @@ -0,0 +1,21 @@ +# Odin Roadmap + +Not in any particular order + +* Custom backend to replace LLVM + - Improve SSA design to accommodate for lowering to a "bytecode" + - SSA optimizations + - COFF generation + - linker +* Type safe "macros" +* Documentation generator for "Entities" +* Multiple architecture support +* Inline assembly +* Linking options + - Executable + - Static/Dynamic Library +* Debug information + - pdb format too +* Command line tooling +* Compiler internals: + - Big numbers library diff --git a/misc/todo.md b/misc/todo.md new file mode 100644 index 000000000..ab35c7830 --- /dev/null +++ b/misc/todo.md @@ -0,0 +1,18 @@ +# Todo + +## Checker +* Cyclic Type Checking + - type A: struct { b: B; }; type B: struct { a: A; }; + - ^ Should be illegal as it's a cyclic definition +* Big numbers library + - integer + - rational + - real + +## Codegen +* Debug info + +## Command Line Tool +* Begin!!! +* Choose/determine architecture + |