Skip to content

Instantly share code, notes, and snippets.

View tanishiking's full-sized avatar
🎓

Rikito Taniguchi tanishiking

🎓
View GitHub Profile

Why

WebAssembly interacts with the external environment through imported and exported functions. If it's a simple function that takes an integer and returns an integer, there is no problem.

However, when trying to use complex data types (such as strings or arrays), the limitation of WebAssembly 1.0 having only 4 types (i32, i64, f32, f64) becomes an issue.

To represent strings or user-defined types, we have to represent it using these 4 types, and there are no predefined rules on how to represent them in linear memory. The consumers of these modules need to understand how these data structures are laid out in linear memory and implement glue code accordingly.

Why WASI?

To communicate with the systems provided by the operating system, you need to call system calls. However, WebAssembly is designed as a complete sandbox, and Wasm modules cannot directly access OS system calls.

To call system calls from Wasm, you need to import functions that have access to system calls from the host environment.

#[link(wasm_import_module = "syscall")]
extern "C" {
    fn write(pointer: i32, length: i32);
/**
  * The `String` class represents character strings. All string literals in Kotlin programs, such as `"abc"`, are
  * implemented as instances of this class.
  */
 public class String internal @WasmPrimitiveConstructor constructor(
     private var leftIfInSum: String?,
     @kotlin.internal.IntrinsicConstEvaluation
     public override val length: Int,
     private var _chars: WasmCharArray,

The future of semanticDB, TASTy, and the overlap that they have #73


ckipp01

on Aug 22 Maintainer So I don't have a specific point to bring up for this topic, but lately on Discord there have been multiple different places where conversations about the usage of SemanticDB and TASTY are discussed. We currently have an ecosystem that heavily relies on semanticDB for tooling, but also TASTy is starting to be used in various places. There are also other tools/formats like SCIP that are using semanticDB to produce SCIP.

Especially to outsiders this web gets pretty confusing. Why do we need both? Can't X work for both use-cases, etc. I think it may be a good idea to have a session where we discuss the pros and cons of both and potentially look at solutions in tooling that only require using one these to avoid the situation where we have tools relying on both semanticDB and TASTy.

@tanishiking
tanishiking / sprees-metals.md
Last active September 15, 2023 11:04
Note for Scala Sprees Madrid 2023 (scalameta/metals)
#include <libunwind.h>
#include <stdio.h>
// Call this function to get a backtrace.
void backtrace() {
unw_cursor_t cursor;
unw_context_t context;
// Initialize cursor to current frame for local unwinding.
unw_getcontext(&context);
This file has been truncated, but you can view the full file.
--- before 2023-04-20 14:27:08
+++ after 2023-04-20 14:28:58
@@ -5,33 +5,33 @@
ret unit
}
var @"M4MainG4type" : {{ptr, int, int, ptr}, int, int, {ptr}, [ptr x 4]} = structvalue {structvalue {@"M15java.lang.ClassG4type" : ptr, int 639, int -1, const structvalue {@"M16java.lang.StringG4type" : ptr, const structvalue {@"M35scala.scalanative.runtime.CharArrayG4type" : ptr, int 4, int 0, arrayvalue char {char 77, char 97, char 105, char 110}}, int 0, int 4, int 2390489}}, int 8, int 639, structvalue {const arrayvalue long {long -1}}, arrayvalue ptr {@"M16java.lang.ObjectD12scala_$eq$eqL16java.lang.ObjectzEO" : ptr, @"M16java.lang.ObjectD8toStringL16java.lang.StringEO" : ptr, @"M16java.lang.ObjectD8hashCodeiEO" : ptr, @"M16java.lang.ObjectD6equalsL16java.lang.ObjectzEO" : ptr}}
-didopt def @"M5Main$D10$anonfun$1L28scala.scalanative.unsafe.PtriEPT5Main$" : (@"T5Main$", @"T28scala.scalanative.unsafe.Ptr") => int {
-%3000000(%1 : @"T5Main$", %2 : @"T28scala.scalanative.unsafe.Ptr"):
- %3000004 = ine[@"T5Main$"]
package dotty.tools.dotc
package transform
import ast.{TreeTypeMap, tpd}
import config.Printers.tailrec
import core.*
import Contexts.*, Flags.*, Symbols.*
import Constants.Constant
import NameKinds.{TailLabelName, TailLocalName, TailTempName}
import StdNames.nme