-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduction of object fields offsets
- Loading branch information
1 parent
695b190
commit 4b25cd6
Showing
10 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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
Binary file not shown.
Binary file modified
BIN
+410 Bytes
(160%)
tests/test_data/samples/jdkinternal/unsafe/trivial/UnsafeUsage.class
Binary file not shown.
Binary file added
BIN
+727 Bytes
tests/test_data/samples/jdkinternal/unsafe/trivial/UnsafeUsage2.class
Binary file not shown.
This file contains 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 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 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 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub(crate) mod class; | ||
pub(crate) mod string; | ||
pub(crate) mod system; | ||
pub(crate) mod unsafe_; |
This file contains 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,25 @@ | ||
use crate::method_area::method_area::with_method_area; | ||
use crate::system_native::string::get_utf8_string_by_ref; | ||
|
||
pub(crate) fn object_field_offset_1_wrp(args: &[i32]) -> crate::error::Result<Vec<i32>> { | ||
let _unsafe_ref = args[0]; | ||
let class_ref = args[1]; | ||
let string_ref = args[2]; | ||
let offset = object_field_offset_1(class_ref, string_ref)?; | ||
|
||
let high = ((offset >> 32) & 0xFFFFFFFF) as i32; | ||
let low = (offset & 0xFFFFFFFF) as i32; | ||
|
||
Ok(vec![high, low]) | ||
} | ||
fn object_field_offset_1(class_ref: i32, string_ref: i32) -> crate::error::Result<i64> { | ||
let field_name = get_utf8_string_by_ref(string_ref)?; | ||
let jc = with_method_area(|area| { | ||
let class_name = area.get_from_reflection_table(class_ref)?; | ||
area.get(class_name.as_str()) | ||
})?; | ||
|
||
let offset = jc.get_field_offset(&field_name)?; | ||
|
||
Ok(offset) | ||
} |