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

fix: Adjust aot profile generation #731

Merged
merged 2 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}

public static initialize(context: DotnetPublicAPI, unoConfig: Uno.WebAssembly.Bootstrap.UnoConfig): AotProfilerSupport {
if (context.Module.ENVIRONMENT_IS_WEB && unoConfig.generate_aot_profile) {
if (Bootstrapper.ENVIRONMENT_IS_WEB && unoConfig.generate_aot_profile) {
return new AotProfilerSupport(context, unoConfig);
}
return null;
Expand Down
11 changes: 4 additions & 7 deletions src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ namespace Uno.WebAssembly.Bootstrap {
// Module may not be initialized yet (.NET 8 and later)
(<any>this._context).Module = this._context.Module || {};

this._context.Module.ENVIRONMENT_IS_WEB = Bootstrapper.ENVIRONMENT_IS_WEB;
this._context.Module.ENVIRONMENT_IS_NODE = Bootstrapper.ENVIRONMENT_IS_NODE;

this.setupRequire();
this.setupEmscriptenPreRun();

Expand All @@ -170,7 +167,7 @@ namespace Uno.WebAssembly.Bootstrap {
}

private async setupHotReload() {
if (this._context.Module.ENVIRONMENT_IS_WEB && this.hasDebuggingEnabled()) {
if (Bootstrapper.ENVIRONMENT_IS_WEB && this.hasDebuggingEnabled()) {
await HotReloadSupport.tryInitializeExports(this._getAssemblyExports);

this._hotReloadSupport = new HotReloadSupport(this._context, this._unoConfig);
Expand Down Expand Up @@ -523,7 +520,7 @@ namespace Uno.WebAssembly.Bootstrap {

asset = asset.replace("/managed/", `/${this._unoConfig.uno_remote_managedpath}/`);

if (this._context.Module.ENVIRONMENT_IS_NODE) {
if (Bootstrapper.ENVIRONMENT_IS_NODE) {
var fs = require('fs');

console.log('Loading... ' + asset);
Expand Down Expand Up @@ -568,7 +565,7 @@ namespace Uno.WebAssembly.Bootstrap {

// Uno.Wasm.Bootstrap is using "requirejs" by default, which is an AMD implementation
// But when run with NodeJS or Electron, it's using CommonJS instead of AMD
this._isUsingCommonJS = this._unoConfig.uno_shell_mode !== "BrowserEmbedded" && (this._context.Module.ENVIRONMENT_IS_NODE || this.isElectron());
this._isUsingCommonJS = this._unoConfig.uno_shell_mode !== "BrowserEmbedded" && (Bootstrapper.ENVIRONMENT_IS_NODE || this.isElectron());

if (this._unoConfig.enable_debugging) console.log("Done loading the BCL");

Expand Down Expand Up @@ -642,7 +639,7 @@ namespace Uno.WebAssembly.Bootstrap {
}

private attachDebuggerHotkey() {
if (this._context.Module.ENVIRONMENT_IS_WEB) {
if (Bootstrapper.ENVIRONMENT_IS_WEB) {

let loadAssemblyUrls = this._monoConfig.assets.map(a => a.name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

private attachHotKey() {

if (this._context.Module.ENVIRONMENT_IS_WEB) {
if (Bootstrapper.ENVIRONMENT_IS_WEB) {

if (LogProfilerSupport._logProfilerEnabled) {
// Use the combination shift+alt+D because it isn't used by the major browsers
Expand Down
2 changes: 0 additions & 2 deletions src/Uno.Wasm.Bootstrap/ts/types/dotnet/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ declare interface EmscriptenModule {
/**
* BEGIN UNO SPECIFIC
*/
ENVIRONMENT_IS_NODE: boolean;
ENVIRONMENT_IS_WEB: boolean;
aotProfileData: any;
/**
* END UNO SPECIFIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<None Include="$(MSBuildThisFileDirectory)side_module\side.wasm" />
<None Include="$(MSBuildThisFileDirectory)test.cpp" />
</ItemGroup>
<ItemGroup Condition="'$(UseAOT)'=='true' or '$(WasmShellGenerateAOTProfile)'=='true'">
<ItemGroup Condition="'$(UseAOT)'=='true' or '$(WasmShellGenerateAOTProfile)'=='true' or '$(WasmShellEnableLogProfiler)'=='true'">
<Content Include="$(MSBuildThisFileDirectory)native/**/*.bc" />
<WasmShellNativeCompile Include="$(MSBuildThisFileDirectory)test.cpp" />
</ItemGroup>
Expand Down