Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generated ASDL code should support garbage collection #1176

Closed
3 tasks done
andychu opened this issue Jun 26, 2022 · 6 comments
Closed
3 tasks done

generated ASDL code should support garbage collection #1176

andychu opened this issue Jun 26, 2022 · 6 comments

Comments

@andychu
Copy link
Contributor

andychu commented Jun 26, 2022

Parts

  • code generated by build/dev.sh oil-asdl-to-cpp-gc should compile
  • asdl/runtime.gc.{h,cc} # this needs to be correct
    • hnode stuff
  • asdl/gc_test.cc -- this should be able to pretty print
@andychu
Copy link
Contributor Author

andychu commented Jun 26, 2022

Progress: a1120f2

@andychu
Copy link
Contributor Author

andychu commented Jun 26, 2022

Issue with generated code. There are 2 allocations in initializer lists. Doesn't that break a GC invariant?

class lvalue__Named : public lvalue_t {                                                                                                                                                                            
 public:                                                                                                                                                                                                           
  lvalue__Named() : type_tag_(static_cast<uint16_t>(lvalue_e::Named)),                                                                                                                                             
                name(NewStr("")), spids(new List<int>()) {                                                                                                                                                         
  }  

@andychu
Copy link
Contributor Author

andychu commented Jun 26, 2022

I think we need a plain old function wrapper for every type. Just like NewStr / NewList / NewDict functions, we need new_lvalue__Named() ?

andychu pushed a commit that referenced this issue Jun 26, 2022
See build/dev.sh test-all-asdl-gc

This is part of #1176.

- Generate NewStr() and NewList().
  - In mylib.h, this is C++ 'new'.
  - In gc_heap.h, this will be Alloc<>
andychu pushed a commit that referenced this issue Jun 26, 2022
This now crashes on the garbage collector.

Part of #1176.
@andychu andychu mentioned this issue Jun 26, 2022
4 tasks
@andychu
Copy link
Contributor Author

andychu commented Jun 26, 2022

https://oilshell.zulipchat.com/#narrow/stream/121539-oil-dev/topic/Targeting.20ASDL.20to.20New.20GC.20Runtime

At least two parts to this task:

andychu pushed a commit that referenced this issue Jun 29, 2022
It translates, compiles, and passes test!  I fixed the ASDL build issue
by generating manifests with build/app-deps.sh.

And now it crashes in the benchmark with an assertion, which is the bug
we want to fix.  ASDL types don't have field masks!

We need to address #1164 and #1176 to make this pass.
andychu pushed a commit that referenced this issue Jul 3, 2022
For both ASDL and mycpp.  Instead of separate files, we use #ifdef
LEAKY_BINDINGS in the same file.

- remove asdl/runtime.gc.{cc,h}, and don't generate
  _build/dev/foo_asdl.gc.{cc,h}
- mycpp has a straggler for NewList<> that we can get rid of later

Related to #1176.  The ASDL code will support both leaky and GC at once.
@andychu
Copy link
Contributor Author

andychu commented Sep 21, 2022

@andychu andychu mentioned this issue Sep 25, 2022
14 tasks
andychu pushed a commit that referenced this issue Oct 1, 2022
Preparing for adding field masks, which is #1176.
@andychu
Copy link
Contributor Author

andychu commented Oct 23, 2022

@andychu andychu closed this as completed Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant