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

Add the ability to have multiple wasm intrinsic modules (e.g. for Emscripten support). STACKED on Emscripten version PR. #32

Merged
merged 2 commits into from
Mar 6, 2019

Conversation

jplevyak
Copy link

Add the ability to have multiple wasm intrinsic modules (e.g. for Emscripten support).

@jplevyak jplevyak requested a review from PiotrSikora February 26, 2019 00:15
@istio-testing
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approvers:

If they are not already assigned, you can assign the PR to them by writing /assign in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -504,6 +504,21 @@ void replaceHeader(Http::HeaderMap* map, absl::string_view key, absl::string_vie
map->addCopy(lower_key, std::string(value));
}

const uint8_t* decodeVarint(const uint8_t* start, const uint8_t* end, uint32_t* out) {
Copy link

Choose a reason for hiding this comment

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

Could you make this function at this moment?

Copy link
Author

Choose a reason for hiding this comment

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

Could you clarify? Do you think the function should be moved?

Copy link

Choose a reason for hiding this comment

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

Sorry... The word "static" is eaten by mistake -_-b

I think we could declare the function static so that no other component should use decodeVarint
If there is further usage, it indicates we should extract this function to a util class.

Copy link
Author

Choose a reason for hiding this comment

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

it is in an anonymous namespace.

start++;
}
if (start < end) {
ret |= (*start & 0x7f);
Copy link

Choose a reason for hiding this comment

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

add an ASSERT(*start > 0x7F) ?

Copy link
Author

Choose a reason for hiding this comment

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

IMO not necessary. Also I don't see a great number of such asserts in the envoy codebase so I don't believe it is the style. The asserts I see seem to be concentrated in particularly complex code (e.g. the connection manager).

Copy link

Choose a reason for hiding this comment

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

Sure. Ignore my comment. Please follow the style.

wavm->envoy_functions_.emplace_back(
new Intrinsics::Function(wavm->envoy_module_, functionName.data(), reinterpret_cast<void*>(f),
inferEnvoyFunctionType(f), IR::CallingConvention::intrinsic));
wavm->envoyFunctions_.emplace_back(new Intrinsics::Function(
Copy link

Choose a reason for hiding this comment

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

Suggested change
wavm->envoyFunctions_.emplace_back(new Intrinsics::Function(
wavm->envoyFunctions_.emplace_back(std::make_unique<Intrinsics::Function>(

Copy link
Author

Choose a reason for hiding this comment

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

In this case I don't see how that is an improvement. It is clear that the pointer is not lost, and in the second case (your suggestion) it provides the additional bit of information that the container is of unique_ptr but that bit of information is not salient useful at this point.

Copy link

Choose a reason for hiding this comment

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

Agree that at this moment the pointer is not lost. It reduces the risk when we make further changes.
Meanwhile my suggestion is self explaining: no extra thinking for any one doesn't have the full knowledge of envoyFunctions_

WAVM::Runtime::ModuleInstance* moduleInstance() { return moduleInstance_; }
WAVM::Runtime::ModuleInstance* envoyModuleInstance() { return moduleInstance_; }
void makeModule(absl::string_view name) override;
absl::string_view getUserSection(absl::string_view name, bool* present) override;

void GetFunctions();
void RegisterCallbacks();

bool hasInstantiatedModule_ = false;
Copy link

Choose a reason for hiding this comment

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

IMHO all the belows should be private...

Copy link
Author

Choose a reason for hiding this comment

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

This class is entirely within this file so it is well encapsulated already and the purpose of 'private' is to provide proper encapsulation which has already been achieved. I'll change it to a struct.

Copy link

Choose a reason for hiding this comment

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

Thanks for the explanation. I should add nit prefix for this comment

@jplevyak jplevyak changed the title Add the ability to have multiple wasm intrinsic modules (e.g. for Emscripten support). Add the ability to have multiple wasm intrinsic modules (e.g. for Emscripten support). STACKED on Emscripten version PR. Mar 1, 2019
@jplevyak jplevyak merged commit 12290b3 into istio:wasm Mar 6, 2019
@jplevyak jplevyak deleted the wasm-module branch March 6, 2019 01:19
jplevyak pushed a commit to jplevyak/envoy that referenced this pull request Aug 13, 2019
istio-release-robot pushed a commit that referenced this pull request Apr 19, 2024
envoyproxy#32902)

Revert "Begin process of removing singleton use by StringMatcher (envoyproxy#32829)"

This reverts commit b7818b0.

Signed-off-by: Ryan Northey <[email protected]>
istio-release-robot pushed a commit that referenced this pull request Apr 19, 2024
…32908)

* Revert "Revert "Begin process of removing singleton use by StringMatcher (#32… (envoyproxy#32902)"

This reverts commit 9ac0dd8.

Signed-off-by: Greg Greenway <[email protected]>

* try increasing shard count to attempt fix of test timeout

Signed-off-by: Greg Greenway <[email protected]>

---------

Signed-off-by: Greg Greenway <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants