swiftwasm / swiftwasm/JavaScriptKit
Improve reference behavior
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Swift
- Estrellas
- 986
- Forks
- 76
- Merge medio
- 21 h 11 min
- PR fusionados (30 d)
- 4
Descripción
I made a small change to report whenever an object ref is deleted:
---
Runtime/src/index.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/Runtime/src/index.ts b/Runtime/src/index.ts
index 0e641ff..ddfba4e 100644
--- a/Runtime/src/index.ts
+++ b/Runtime/src/index.ts
@@ -93,6 +93,7 @@ class SwiftRuntimeHeap {
release(ref: ref) {
const value = this._heapValueById.get(ref);
const isObject = typeof value == "object"
+ console.log('dereferencing', value);
if (isObject) {
const entry = this._heapEntryByValue.get(value)!;
entry.rc--;
(copy the content of the code block and run pbpaste | git apply in your terminal to make this change)
It reports many deallocations. The thing that caught my attention was the repeated deallocation of functions (like toString and hasOwnProperty). I wonder if there’s a way to recognize functions that are part of the JavaScript language and either dynamically call them when needed or mark them so they don’t get released.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con Runtime/src/index.ts, especialmente con SwiftRuntimeHeap.release(ref), y reproduce el informe usando el cambio de registro mostrado en el issue. Compara las desasignaciones repetidas de funciones con el tratamiento deseado de las funciones del lenguaje JavaScript; se considera completado cuando se haya implementado un comportamiento acordado para que esas funciones no se liberen incorrectamente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, swift, wasm
- Área
- web-dev
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100