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

Compilation server gives different result on 1st/2nd compilation #11710

Closed
yuxiaomao opened this issue Jul 4, 2024 · 1 comment
Closed

Compilation server gives different result on 1st/2nd compilation #11710

yuxiaomao opened this issue Jul 4, 2024 · 1 comment
Assignees

Comments

@yuxiaomao
Copy link
Contributor

Project : Hide

When compile with and without the server, haxe gives different results. The version with server seems to have some DCE applied to class and package, and cause strange error.

haxe hide.hxml                # result file bin/hide.js has a size of 9260KB, works fine
haxe hide.hxml --connect 6001 # result file bin/hide.js has a size of 9164KB on 2nd compilation and above

Bisect gives this: #11701
The result remains the same with -D disable-hxb-cache

@kLabz kLabz self-assigned this Jul 15, 2024
@kLabz
Copy link
Contributor

kLabz commented Jul 16, 2024

That's actually a problematic usage of Compiler.include, which we'll restrict to init macros to avoid such issues.

Workaround for hide:

diff --git a/hide.hxml b/hide.hxml
index 4fb931c3..4c5c00a7 100644
--- a/hide.hxml
+++ b/hide.hxml
@@ -3,16 +3,19 @@ common.hxml
 -D prefab2
 -js bin/hide.js
 -main hide.Ide
+--macro hide.tools.Macros.includeShaderSources()
 --macro include("h3d.shader")
 --macro include("h3d.anim")
+--macro include("h3d.prim")
+--macro include("h3d.scene")
+--macro include("h3d.pass")
 --macro include("h2d.col")
 --macro include("hxd.poly2tri")
 --macro include("hxd.clipper")
 --macro include("hxd.earcut")
---macro include("hrt.prefab")
---macro include("hrt.shgraph")
---macro include("hrt.shgraph.nodes")
 --macro include("hide.view")
+--macro include("hide.prefab")
+--macro include("hrt")
 -dce no
 -debug
 #-D shader_debug_dump
diff --git a/hide/Ide.hx b/hide/Ide.hx
index d54cd485..2bde84cb 100644
--- a/hide/Ide.hx
+++ b/hide/Ide.hx
@@ -1327,7 +1327,6 @@ class Ide extends hide.tools.IdeData {
 
 	static function main() {
 		h3d.impl.RenderContext.STRICT = false; // prevent errors with bad renderer
-		hide.tools.Macros.include(["hide.view","h3d.prim","h3d.scene","h3d.pass","hide.prefab","hrt"]);
 		new Ide();
 	}
 
diff --git a/hide/tools/Macros.hx b/hide/tools/Macros.hx
index 1baebc48..e3c41fa6 100644
--- a/hide/tools/Macros.hx
+++ b/hide/tools/Macros.hx
@@ -7,13 +7,6 @@ using haxe.macro.ExprTools;
 
 class Macros {
 
-	public static macro function include( packages : Array<String> ) {
-		includeShaderSources();
-		for( p in packages )
-			haxe.macro.Compiler.include(p);
-		return macro null;
-	}
-
 	#if macro
 
 	static function includeShaderSources() {
yuxiaomao added a commit to HeapsIO/hide that referenced this issue Jul 16, 2024
@kLabz kLabz closed this as completed Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants