Skip to content

GC Bridge for Android scenarios #114184

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AaronRobinsonMSFT
Copy link
Member

This PR contains the VM side of the work and the introduction of a new GC Handle type.

The GC work still needs to be completed. This is currently just a place to share work.

  • API needs approval
  • Tests

Prior to check-in, update all places with "!TODO-JAVA!".
Implement scanning of the new GC Handle and calling
a new VM callout to process the resulting data.
Implement the VM side of the GC Handle processing
and callout to mark cross references.
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

@AaronRobinsonMSFT AaronRobinsonMSFT added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Apr 2, 2025
@@ -161,6 +161,11 @@ if(FEATURE_OBJCMARSHAL)
add_compile_definitions(FEATURE_OBJCMARSHAL)
endif()

if(FEATURE_JAVAMARSHAL)
add_compile_definitions(FEATURE_JAVAMARSHAL)
add_compile_definitions(FEATURE_GCBRIDGE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need two different FEATURE_... ifdefs for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point there aren't any. While I was implementing it the logic was clearly distinct though. There is the general concept of the GC Bridge and also the specific Java API and infrastructure that exposes that data. It was natural to separate the two given how we've implemented other interop scenarios involving the GC. It is entirely reasonable to collapse them, but making them distinct now is much easier than retroactively splitting them in the future.

@@ -14,7 +14,7 @@
#endif

#define INITIAL_HANDLE_TABLE_ARRAY_SIZE 10
#define HANDLE_MAX_INTERNAL_TYPES 12
#define HANDLE_MAX_INTERNAL_TYPES 16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there perf consequences from bumping this limit? Should we start recycling deprecated HDNTYPE values (e.g. HNDTYPE_ASYNCPINNED)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just need to be careful that recycling wouldnt cause backcompat issues for standalone gc.

GCScan::GcScanWithBridge(GCHeap::Promote,
condemned_gen_number, max_generation,
&sc);
drain_mark_queue();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder whether drain_mark_queue is required after each scan or can it be combined with the one above ?

condemned_gen_number, max_generation,
&sc);
drain_mark_queue();
// fire_mark_event (ETW::???, current_promoted_bytes, last_promoted_bytes);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assume this will be a TODO to enable later?

}
CONTRACTL_END;

#ifdef FEATURE_GCBRIDGE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt the full function be under a #ifdef ?

@Maoni0
Copy link
Member

Maoni0 commented Apr 3, 2025

I don't think changes on the GC side need to be reviewed at this point. I know they will be different but we will address those when we actually start implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Runtime.InteropServices new-api-needs-documentation NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants