Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 4 files changed
  • 0 comments
  • 1 contributor
4 excerpts/identity-int.c
... ... @@ -0,0 +1,4 @@
  1 +int identity__int(int value) {
  2 + const Class *T = Int_class();
  3 + return value;
  4 +}
BIN  images/inception.png
23 report.md
Source Rendered
@@ -155,8 +155,29 @@ is eventually reclaimed by the garbage collector [^2],
155 155
156 156 ### Performance problems
157 157
  158 +The current implementation of generics suffers from a few performance problems.
  159 +Because of the generality of the machine code that is eventually produced, there
  160 +is a significant amount of lost opportunity for optimization.
  161 +
  162 +For example, if we knew - at compile time - the generic types that were later
  163 +going to be used, we could use much faster primitives for memory allocation and
  164 +copy.
  165 +
  166 +For this semester project, we will focus on the performance of the ooc library
  167 +'inception-engine', an open-source game engine that mimics the dynamic nature
  168 +of the well-known Source engine.
  169 +
  170 +<!-- ![Screenshot of the inception engine in action](images/inception.png) -->
  171 +
158 172 ## Specialization implementation
159 173
  174 +The basic idea behind specialization is to turn a subset of generic instances
  175 +into template instances, statically compiled to type-specific code. For example,
  176 +the identity function as described above, when used with an integer argument,
  177 +would compile down to this specialized code:
  178 +
  179 +\input{excerpts/identity-int.c.tex}
  180 +
160 181 ### AST transformations
161 182
162 183 ### Resulting code
@@ -171,3 +192,5 @@ is eventually reclaimed by the garbage collector [^2],
171 192
172 193 ## Conclusion
173 194
  195 +
  196 +
23 samples/bug.ooc
... ... @@ -1,23 +0,0 @@
1   -
2   -import structs/ArrayList
3   -
4   -main: func {
5   -
6   - s := ArrayList<Int> new()
7   - s add(0xdeadbeef). add(0). add(0). add(0)
8   -
9   - "Correct" println()
10   - for (i in 0..s size) {
11   - "%x" printfln(s get(i))
12   - }
13   -
14   - s T = Octet // that is so, so wrong.
15   -
16   - "Incorrect" println()
17   - for (i in 0..s size) {
18   - "%x" printfln(s get(i))
19   - }
20   -
21   -}
22   -
23   -

No commit comments for this range

Something went wrong with that request. Please try again.