-
Notifications
You must be signed in to change notification settings - Fork 133
Merge #1814 after JIT changes #1864
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
Open
bettio
wants to merge
2
commits into
atomvm:main
Choose a base branch
from
bettio:integrate-1814-pr-after-jit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| % | ||
| % This file is part of AtomVM. | ||
| % | ||
| % Copyright 2025 Franciszek Kubis <[email protected]> | ||
| % | ||
| % Licensed under the Apache License, Version 2.0 (the "License"); | ||
| % you may not use this file except in compliance with the License. | ||
| % You may obtain a copy of the License at | ||
| % | ||
| % http://www.apache.org/licenses/LICENSE-2.0 | ||
| % | ||
| % Unless required by applicable law or agreed to in writing, software | ||
| % distributed under the License is distributed on an "AS IS" BASIS, | ||
| % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| % See the License for the specific language governing permissions and | ||
| % limitations under the License. | ||
| % | ||
| % SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later | ||
| % | ||
|
|
||
| -module(test_code_get_object_code). | ||
|
|
||
| -export([start/0, get_object_wrong_argument/1]). | ||
|
|
||
| -include("code_load/export_test_module_data.hrl"). | ||
|
|
||
| start() -> | ||
| ok = get_object_from_export_test_module(), | ||
| ok = get_object_from_already_loaded_test_module(), | ||
| ok = get_object_from_non_existing_module(), | ||
| ok = ?MODULE:get_object_wrong_argument("a string"), | ||
| ok = ?MODULE:get_object_wrong_argument(123), | ||
| ok = ?MODULE:get_object_wrong_argument({1, "a"}), | ||
| ok = ?MODULE:get_object_wrong_argument([1, b, 3]), | ||
| 0. | ||
|
|
||
| get_object_from_already_loaded_test_module() -> | ||
| {test_code_get_object_code, Bin, _Filename} = code:get_object_code(?MODULE), | ||
| {module, ?MODULE} = code:load_binary( | ||
| ?MODULE, atom_to_list(?MODULE) ++ ".beam", Bin | ||
| ), | ||
| {module, ?MODULE} = code:ensure_loaded(?MODULE), | ||
| ok. | ||
|
|
||
| get_object_from_export_test_module() -> | ||
| Bin = ?EXPORT_TEST_MODULE_DATA, | ||
| error = code:get_object_code(export_test_module), | ||
| {module, export_test_module} = code:load_binary( | ||
| export_test_module, "export_test_module.beam", Bin | ||
| ), | ||
| {module, export_test_module} = code:ensure_loaded(export_test_module), | ||
| error = code:get_object_code(export_test_module), | ||
| 24 = export_test_module:exported_func(4), | ||
| ok. | ||
|
|
||
| get_object_from_non_existing_module() -> | ||
| error = code:get_object_code(non_existing_module), | ||
| ok. | ||
|
|
||
| get_object_wrong_argument(Argument) -> | ||
| try code:get_object_code(Argument) of | ||
| _ -> not_raised | ||
| catch | ||
| _:_ -> ok | ||
| end. |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pguyot This is my best try at fixing build error with build-and-test (macos-15-intel, 28, -DAVM_DISABLE_JIT=OFF). Can we do anything better than just skipping the test?
The relevant error is:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should follow the same pattern as test_code_load_binary to make sure we load the binary with precompiled native code. We will need to update it for every jit target, so maybe we should factorize the hrl at some point.
However, when I do that, I have a crash with the external calls:
There are other external calls in these tests and they don't crash. I don't know why this one does crash, though. I have yet to investigate this.
The following two versions don't crash.
I don't know if it's related to this nif.
Also I don't like this warning:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the bug: https://github.com/atomvm/AtomVM/pull/1814/files#r2399909494
Additionally, maybe JIT is not very tolerant to hot code reloading on macOS (the mmap didn't have the proper flags), but it's not like we support hot code reloading yet.