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

[analyzer] evaluation order problem #6643

Closed
Simn opened this Issue Oct 5, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@Simn
Member

Simn commented Oct 5, 2017

I don't have a reproducible example yet, but I'm looking at this generated code:

::format::hxb::HxbType_obj::TAbstractP(_hx_array_unsafe_get(this8,this->input->readInt32()),this->readTyperefParams());

It comes from a call to an enum constructor. Probably fusion's fault.

@Simn Simn self-assigned this Oct 5, 2017

@Simn

This comment has been minimized.

Show comment
Hide comment
@Simn

Simn Oct 5, 2017

Member

Ouch, that's way too easy to reproduce...

enum MyEnum {
	MyCtor(a:Int, b:Int);
}

class Main {
	static public function main() {
		var r = MyCtor(sideEffect(), sideEffect());
		trace(r);
	}

	static var x = 0;

	static function sideEffect() {
		return x++;
	}
}

Generated code with -D analyzer-optimize:

HX_VARI(  ::MyEnum,r) = ::MyEnum_obj::MyCtor(::Main_obj::sideEffect(),::Main_obj::sideEffect());

Not a regression since preview.1. Didn't check again 3.4.

Member

Simn commented Oct 5, 2017

Ouch, that's way too easy to reproduce...

enum MyEnum {
	MyCtor(a:Int, b:Int);
}

class Main {
	static public function main() {
		var r = MyCtor(sideEffect(), sideEffect());
		trace(r);
	}

	static var x = 0;

	static function sideEffect() {
		return x++;
	}
}

Generated code with -D analyzer-optimize:

HX_VARI(  ::MyEnum,r) = ::MyEnum_obj::MyCtor(::Main_obj::sideEffect(),::Main_obj::sideEffect());

Not a regression since preview.1. Didn't check again 3.4.

@Simn Simn closed this in 2a4fc20 Oct 5, 2017

Simn added a commit that referenced this issue Oct 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment