-
-
Notifications
You must be signed in to change notification settings - Fork 907
avm2: Implement Dxns and DxnsLate opcodes #21014
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
base: master
Are you sure you want to change the base?
Conversation
core/src/avm2.rs
Outdated
self.default_xml_namespace_stack | ||
.last() | ||
.copied() | ||
.unwrap_or_else(|| AvmString::new_ascii_static(strings.gc(), b"")) |
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.
If this was working on Activation instead, you could just do istr!("")
here
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.
You can specify the StringContext manually with istr!(strings, "")
, too.
core/src/avm2.rs
Outdated
/// Default XML namespace stack for E4X operations. | ||
/// The last element is the current default namespace. | ||
default_xml_namespace_stack: Vec<AvmString<'gc>>, | ||
|
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.
Why use a stack here? There's no PopDxns
opcode, so a single default_xml_namespace: Option<AvmString<'gc>>
on Activation
would be enough.
Note: the AVM2 specification says that |
I don't think the stack is correct here; what FP does kinda resembles the stack, in that when you call a function and set dxns, when you exit from the function the callee has its previous But in reality, in FP this is more complex unfortunately, in avmplus (see The easily visible difference is that the default namespace of the function f(){
var a = <xml xmlns:a="a" xmlns:b="b"><data x="1" a:x="2" b:x="3">asdf</data></xml>;
trace(a.data.@x); // 1
var inline_f1 = function(){ trace(a.data.@x); };
default xml namespace = "a";
trace(a.data.@x); // 12
var inline_f2 = function(){ trace(a.data.@x); };
default xml namespace = "b";
trace(a.data.@x); // 13
inline_f1(); // 1
inline_f2(); // 12
create_custom_function("")(a); // 1
create_custom_function("a")(a); // 12
create_custom_function("b")(a); // 13
}
function create_custom_function(nsname){
default xml namespace = nsname;
return function(a){ trace(a.data.@x); };
}; But again, I don't exactly understand how the chained MethodFrame iteration in avmplus relates to this, I don't know how to observe it. |
ff1ce9b
to
a44e385
Compare
dae00c7
to
5c03419
Compare
No description provided.