How to use @webassemblyjs/helper-compiler - 2 common examples

To help you get started, we’ve selected a few @webassemblyjs/helper-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xtuc / webassemblyjs / packages / webassemblyjs / src / interpreter / partial-evaluation.js View on Github external
export function evaluate(
  allocator: Allocator,
  code: Array
): ?StackLocal {
  const ir = listOfInstructionsToIr(code);

  // Create an empty module instance for the context
  const moduleInstance = modulevalue.createInstance(
    ir,
    allocator,
    t.module(undefined, [])
  );

  const stackFrame = createStackFrame([], moduleInstance, allocator);

  const main = ir.funcTable.find(f => f.name === "main");
  assert(typeof main === "object");

  return executeStackFrame(ir, main.startAt, stackFrame);
}
github xtuc / webassemblyjs / packages / helper-test-framework / src / fake-compiler.js View on Github external
export function compileASTNodes(nodes: Array): IR {
  nodes.push(instruction("end"));
  addFakeLocsListOfInstructions(nodes);

  return listOfInstructionsToIr(nodes);
}

@webassemblyjs/helper-compiler

MIT
Latest version published 1 month ago

Package Health Score

78 / 100
Full package analysis

Popular @webassemblyjs/helper-compiler functions

Similar packages