Skip to content

Commit

Permalink
[mycpp] Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy C committed Dec 18, 2022
1 parent ecca9cf commit 82192a6
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions mycpp/README.md
Expand Up @@ -52,7 +52,7 @@ To build oil-native, use:

To run the tests and benchmarks:

oil$ ninja mycpp-logs-equal
oil$ mycpp/TEST.sh test-translator
... 200+ tasks run ...

If you have problems, post a message on `#oil-dev` at
Expand Down Expand Up @@ -164,8 +164,23 @@ Note: I really wish we were not using visitors, but that's inherited from MyPy.

### Optimizations

- Return Tuples by Value. To reduce GC pressure, we we return `Tuple2<A, B>`
insetad of `Tuple2<A, B>*`, and likewise for `Tuple3` and `Tuple4`.
- Returning Tuples by value. To reduce GC pressure, we we return
`Tuple2<A, B>` instead of `Tuple2<A, B>*`, and likewise for `Tuple3` and `Tuple4`.

### Rooting Policy

The translated code roots local variables in every function

StackRoots _r({&var1, &var2});

We have two kinds of hand-written code:

1. Methods like `Str::strip()` in `mycpp/`
2. OS bindings like `stat()` in `cpp/`

Neither of them needs any rooting! This is because we use **manual collection
points** in the interpreter, and these functions don't call any functions that
can collect. They are "leaves" in the call tree.

### Hard-Coded Lists To Get Rid Of

Expand All @@ -180,7 +195,6 @@ Note: I really wish we were not using visitors, but that's inherited from MyPy.
- lists of modules vs. types: `module.Func()` vs. `sum_type.Variant()`
- `_GetCastKind()` has some hard-coded names


Issue on mycpp improvements: <https://github.com/oilshell/oil/issues/568>

## Limitations Requiring Source Rewrites
Expand All @@ -204,10 +218,6 @@ Issue on mycpp improvements: <https://github.com/oilshell/oil/issues/568>

## C++

### Interactions Between C++ and Garbage Collection

- TODO: Link to a wiki page. The `f(g())` problem, etc.

### Gotchas

- C++ classes can have 2 member variables of the same name! From the base
Expand Down

0 comments on commit 82192a6

Please sign in to comment.