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

Remove Misleading Claim About Java's Value Types in Object Stack Allocation Documentation #110295

Closed
mburakeker opened this issue Dec 1, 2024 · 3 comments
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI documentation Documentation bug or enhancement, does not impact product or test code

Comments

@mburakeker
Copy link

Problem Description
The documentation for Object Stack Allocation currently includes the following statement:

This optimization is more important for Java since it doesn't have value types.

This is misleading because:

  • Java does have an equivalent to value types, called Primitive Types, which are stored in stack memory.
  • The comparison suggesting Object Stack Allocation is more important for Java is inaccurate.

Proposed Solution
Replace the misleading sentence with:

This is also important for Java.

This update removes the false comparison and keeps the focus on the scope of Object Stack Allocation across both .NET and Java.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 1, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 1, 2024
@mburakeker
Copy link
Author

Attached is my pull request with Proposed Solution. #110296

@teo-tsirpanis
Copy link
Contributor

Primitive types in Java are only boolean, char, byte, int, short, long, float, and double. Unlike C# you cannot declare a custom value type in Java. Because all user-defined types in Java are classes and therefore allocated on the heap, Object Stack Allocation is more important in Java because developers have no manual control of which values stay in the stack.

@mburakeker
Copy link
Author

Primitive types in Java are only boolean, char, byte, int, short, long, float, and double. Unlike C# you cannot declare a custom value type in Java. Because all user-defined types in Java are classes and therefore allocated on the heap, Object Stack Allocation is more important in Java because developers have no manual control of which values stay in the stack.

Thank you for the explanation! Your comment provides a much clearer explanation. I'll close my PR since it’s obsolete.
Feel free to update the documentation with better wording if you'd like.

@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Dec 1, 2024
@teo-tsirpanis teo-tsirpanis closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2024
@teo-tsirpanis teo-tsirpanis added documentation Documentation bug or enhancement, does not impact product or test code area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI documentation Documentation bug or enhancement, does not impact product or test code
Projects
None yet
Development

No branches or pull requests

2 participants