Conversation
…wnload Adds a useFFM flag to S3MetaRequestOptions that activates zero-copy callbacks on the two performance-critical paths: Download (s_on_s3_meta_request_body_callback): - JNI path: allocates a byte[] and copies every downloaded chunk into it - FFM path: passes the raw native pointer + length as jlong primitives; Java wraps it as a MemorySegment (zero-copy) via onResponseBodyFFM() Upload (s_aws_input_stream_read): - JNI path: creates a DirectByteBuffer wrapper object per part, reads back position() via a second JNI call - FFM path: passes raw pointer + capacity as jlong primitives; Java writes directly into native memory and returns bytes-written as int Java-side changes: - S3MetaRequestOptions: add withUseFFM(boolean) / getUseFFM() - S3Client: pass useFFM to native s3ClientMakeMetaRequest() - S3MetaRequestResponseHandler: add onResponseBody(MemorySegment,...) overload - S3MetaRequestResponseHandlerNativeAdapter: add onResponseBodyFFM(long,long,long) - HttpRequestBodyStream: add sendRequestBody(long address, long length) -> int Native-side changes: - java_class_ids.h/c: register send_outgoing_body_ffm (JJ)I and onResponseBodyFFM (JJJ)I method IDs - s3_client.c: add use_ffm to callback struct; branch in body callback - http_request_utils.h/c: add use_ffm to stream impl; branch in read fn; propagate use_ffm through aws_apply_java_http_request_changes_to_native_request
Three callers were missing the new use_ffm parameter: - aws_signing.c: aws_input_stream_new_from_java_http_request_body_stream() -> add false (signing path always uses JNI) - mqtt_connection.c: aws_apply_java_http_request_changes_to_native_request() -> add false (MQTT path always uses JNI) - mqtt5_client.c: aws_apply_java_http_request_changes_to_native_request() -> add false (MQTT5 path always uses JNI) Also fix the unused-parameter warning in http_request_utils.c: - aws_apply_java_http_request_changes_to_native_request() now passes use_ffm through to aws_input_stream_new_from_java_http_request_body_stream() instead of hardcoding false, making the parameter actually used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FFM testing branch.
DO NOT MERGE
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.