Skip to content

Commit

Permalink
[browser] delete unused mono_wasm_* functions (#82767)
Browse files Browse the repository at this point in the history
* delete unused mono_wasm_get_icudt_name
* remove unused mono_wasm_array_length
* remove unused GlobalizationNative_GetICUDTName
  • Loading branch information
pavelsavara authored Mar 1, 2023
1 parent 8d938ec commit e50633d
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 61 deletions.
1 change: 0 additions & 1 deletion src/mono/wasi/mono-include/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ MonoArray* mono_wasm_obj_array_new (int size);
void mono_wasm_obj_array_set (MonoArray *array, int idx, MonoObject *obj);
MonoArray* mono_wasm_string_array_new (int size);
MonoString *mono_wasm_string_from_js (const char *str);
int mono_wasm_array_length(MonoArray* array);
char *mono_wasm_string_get_utf8 (MonoString *str);

MonoMethod* lookup_dotnet_method(const char* assembly_name, const char* namespace, const char* type_name, const char* method_name, int num_params);
4 changes: 0 additions & 4 deletions src/mono/wasm/runtime/cwraps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const fn_signatures: SigLine[] = [
[true, "mono_background_exec", null, []],
[true, "mono_set_timeout_exec", null, []],
[true, "mono_wasm_load_icu_data", "number", ["number"]],
[true, "mono_wasm_get_icudt_name", "string", ["string"]],
[false, "mono_wasm_add_assembly", "number", ["string", "number", "number"]],
[true, "mono_wasm_add_satellite_assembly", "void", ["string", "string", "number", "number"]],
[false, "mono_wasm_load_runtime", null, ["string", "number"]],
Expand All @@ -47,7 +46,6 @@ const fn_signatures: SigLine[] = [
[true, "mono_wasm_string_get_utf8", "number", ["number"]],
[true, "mono_wasm_string_from_utf16_ref", "void", ["number", "number", "number"]],
[true, "mono_wasm_get_obj_type", "number", ["number"]],
[true, "mono_wasm_array_length", "number", ["number"]],
[true, "mono_wasm_array_length_ref", "number", ["number"]],
[true, "mono_wasm_array_get", "number", ["number", "number"]],
[true, "mono_wasm_array_get_ref", "void", ["number", "number", "number"]],
Expand Down Expand Up @@ -141,7 +139,6 @@ export interface t_Cwraps {
mono_background_exec(): void;
mono_set_timeout_exec(): void;
mono_wasm_load_icu_data(offset: VoidPtr): number;
mono_wasm_get_icudt_name(name: string): string;
mono_wasm_add_assembly(name: string, data: VoidPtr, size: number): number;
mono_wasm_add_satellite_assembly(name: string, culture: string, data: VoidPtr, size: number): void;
mono_wasm_load_runtime(unused: string, debugLevel: number): void;
Expand All @@ -166,7 +163,6 @@ export interface t_Cwraps {
*/
mono_wasm_string_get_utf8(str: MonoString): CharPtr;
mono_wasm_string_from_utf16_ref(str: CharPtr, len: number, result: MonoObjectRef): void;
mono_wasm_array_length(array: MonoArray): number;

mono_wasm_array_length_ref(array: MonoObjectRef): number;
mono_wasm_array_get_ref(array: MonoObjectRef, idx: number, result: MonoObjectRef): void;
Expand Down
7 changes: 0 additions & 7 deletions src/mono/wasm/runtime/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1218,13 +1218,6 @@ mono_wasm_try_unbox_primitive_and_get_type_ref (MonoObject **objRef, void *resul
return retval;
}

// FIXME: Ref
EMSCRIPTEN_KEEPALIVE int
mono_wasm_array_length (MonoArray *array)
{
return mono_array_length (array);
}

EMSCRIPTEN_KEEPALIVE int
mono_wasm_array_length_ref (MonoArray **array)
{
Expand Down
1 change: 0 additions & 1 deletion src/mono/wasm/runtime/es6/dotnet.es6.lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ const linked_functions = [

// pal_icushim_static.c
"mono_wasm_load_icu_data",
"mono_wasm_get_icudt_name",

#if USE_PTHREADS
/// mono-threads-wasm.c
Expand Down
3 changes: 1 addition & 2 deletions src/mono/wasm/runtime/exports-linker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MonoWasmThreads from "consts:monoWasmThreads";
import { mono_wasm_fire_debugger_agent_message_with_data, mono_wasm_fire_debugger_agent_message_with_data_to_pause, mono_wasm_debugger_log, mono_wasm_add_dbg_command_received, mono_wasm_set_entrypoint_breakpoint } from "./debug";

import { mono_wasm_release_cs_owned_object } from "./gc-handles";
import { mono_wasm_load_icu_data, mono_wasm_get_icudt_name } from "./icu";
import { mono_wasm_load_icu_data } from "./icu";
import { mono_wasm_bind_cs_function } from "./invoke-cs";
import { mono_wasm_bind_js_function, mono_wasm_invoke_bound_function, mono_wasm_invoke_import } from "./invoke-js";
import { mono_interp_tier_prepare_jiterpreter } from "./jiterpreter";
Expand Down Expand Up @@ -93,7 +93,6 @@ export function export_linker(): any {

// pal_icushim_static.c
mono_wasm_load_icu_data,
mono_wasm_get_icudt_name,

// threading exports, if threading is enabled
...mono_wasm_threads_exports,
Expand Down
8 changes: 0 additions & 8 deletions src/mono/wasm/runtime/icu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ export function mono_wasm_load_icu_data(offset: VoidPtr): boolean {
return ok;
}

// Get icudt.dat exact filename that matches given culture, examples:
// "ja" -> "icudt_CJK.dat"
// "en_US" (or "en-US" or just "en") -> "icudt_EFIGS.dat"
// etc, see "mono_wasm_get_icudt_name" implementation in pal_icushim_static.c
export function mono_wasm_get_icudt_name(culture: string): string {
return cwraps.mono_wasm_get_icudt_name(culture);
}

// Performs setup for globalization.
// @globalizationMode is one of "icu", "invariant", or "auto".
// "auto" will use "icu" if any ICU data archives have been loaded,
Expand Down
2 changes: 0 additions & 2 deletions src/native/libs/System.Globalization.Native/pal_icushim.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ PALEXPORT int32_t GlobalizationNative_GetICUVersion(void);

PALEXPORT int32_t GlobalizationNative_LoadICUData(const char* path);

PALEXPORT const char* GlobalizationNative_GetICUDTName(const char* culture);

#endif
36 changes: 0 additions & 36 deletions src/native/libs/System.Globalization.Native/pal_icushim_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ static int32_t load_icu_data(const void* pData);
#ifdef __EMSCRIPTEN__
#include <emscripten.h>

EMSCRIPTEN_KEEPALIVE const char* mono_wasm_get_icudt_name(const char* culture);

EMSCRIPTEN_KEEPALIVE const char* mono_wasm_get_icudt_name(const char* culture)
{
return GlobalizationNative_GetICUDTName(culture);
}

EMSCRIPTEN_KEEPALIVE int32_t mono_wasm_load_icu_data(const void* pData);

EMSCRIPTEN_KEEPALIVE int32_t mono_wasm_load_icu_data(const void* pData)
Expand Down Expand Up @@ -200,35 +193,6 @@ GlobalizationNative_LoadICUData(const char* path)
return GlobalizationNative_LoadICU();
}

const char* GlobalizationNative_GetICUDTName(const char* culture)
{
// Based on https://github.com/dotnet/icu/tree/maint/maint-67/icu-filters

// Use full one if culture is null or empty
if (!culture || strlen(culture) < 2)
return "icudt.dat";

// CJK: starts with "ja", "ko" or "zh"
if (!strncasecmp("ja", culture, 2) ||
!strncasecmp("ko", culture, 2) ||
!strncasecmp("zh", culture, 2))
return "icudt_CJK.dat"; // contains "en" as well.

// EFIGS
const char* efigsCultures[15] = {
"en-US", "fr-FR", "es-ES", "it-IT", "de-DE",
"en_US", "fr_FR", "es_ES", "it_IT", "de_DE",
"en", "fr", "es", "it", "de"
};

for (int i = 0; i < 15; i++)
if (!strcasecmp(culture, efigsCultures[i]))
return "icudt_EFIGS.dat";

// full except CJK cultures
return "icudt_no_CJK.dat";
}

int32_t GlobalizationNative_LoadICU(void)
{
#if !defined(LOCAL_BUILD)
Expand Down

0 comments on commit e50633d

Please sign in to comment.