text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>inActivity.this.tv.append(s); } }); } static { System.loadLibrary("wasm3-jni"); } public native void runMain(); } <|fim_prefix|>/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * yo...
fim
wasm3/wasm3
java
<|fim_suffix|>Wasm3 v" M3_VERSION "%s on %s\n", (wasm3_arch || wasm3_env) ? " self-hosting" : "", wasm3_arch ? wasm3_arch : M3_ARCH); printf("Build: " __DATE__ " " __TIME__ ", " M3_COMPILER_VER "\n"); } void print_usage() { puts("Usage:"); puts(" wasm3 [options] <file> [args...]")...
fim
wasm3/wasm3
c
<|fim_prefix|>// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy. // All rights reserved. // #include <stdint.h> #include <stddef.h> #include "wasm3.h" #define FATAL(...) __builtin_trap() int LLVMFuzzerTestOneInput(const uint8_t *data, ...
fim
wasm3/wasm3
c
#include <cstdio> #include <cstring> #include <fstream> #include "wasm3_cpp.h" #include "wasm/test_prog.wasm.h" int sum(int a, int b) { return a + b; } void * ext_memcpy (void* dst, const void* arg, int32_t size) { return memcpy(dst, arg, (size_t) size); } int main(void) { std::cout << "Loading WebAssem...
fim
wasm3/wasm3
cpp
<|fim_prefix|>#include <stddef.h> #include <stdint.h> extern int sum(int, int); extern int ext_memcpy(void*, cons<|fim_suffix|>arg1 - arg2; return sum(x, y) / 2; } int64_t WASM_EXPORT test_memcpy(void) { int64_t x = 0; int32_t low = 0x01234567; int32_t high = 0x89abcdef; ext_memcpy(&x, &low, 4); ...
fim
wasm3/wasm3
c
<|fim_prefix|>unsigned char test_prog_wasm[] = { 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x22, 0x07, 0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x60, 0x01, 0x7f, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x01, 0x7f, 0x60, 0x03, 0x7f, 0x7f, 0x7f, 0x01, 0x7f, 0x60, 0x00, 0x01, 0x7e, 0x60, 0x01, 0x7f, 0x01, 0x7f,...
fim
wasm3/wasm3
c
<|fim_suffix|>r<Ret(Args...)> { using Func = Ret(Args...); static const void *wrap_fn([[maybe_unused]] IM3Runtime rt, IM3ImportContext _ctx, stack_type _sp, mem_type mem) { std::tuple<Args...> args; // The order here matters: m3ApiReturnType should go before calli...
fim
wasm3/wasm3
c
<|fim_suffix|>%s", result); Serial.print("Result: "); Serial.println(value); } void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); delay(10); while (!Serial) {} Serial.println(); Serial.println("Wasm3 v" M3_VERSION " on Arduino (" M3_ARCH "), build " __DATE__ " " __TIME__); dig...
fim
wasm3/wasm3
cpp
<|fim_prefix|>// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy<|fim_suffix|>SysTick(); led.mode(Pinmode::out); puts("Wasm3 v" M3_VERSION " on BluePill, build " __DATE__ " " __TIME__ "\n"); led = 0; run_wasm(); led = 1; } <|fim...
fim
wasm3/wasm3
cpp
<|fim_prefix|>// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy. // All rights reserved. // #include "esp_system.h" #include <stdio.h> #include <time.h> #include <unistd.h> #include "wasm3.h" #include "extra/fib32.wasm.h" #define FATA...
fim
wasm3/wasm3
cpp
<|fim_prefix|>// // m3_api_esp_wasi.c // // Created by Volodymyr Shymanskyy on 01/07/20. // Copyright © 2019 Volodymyr Shymanskyy. All rights reserved. // #define _POSIX_C_SOURCE 200809L #include "m3_api_esp_wasi.h" #include "m3_env.h" #include "m3_exception.h" #if defined(ESP32) typedef uint32_t __wasi_size_t;...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_api_esp_wasi.h // // Created by Volodymyr Shymanskyy on 01/07/20. // Copyright © 2019 Volodymyr Shymanskyy. All rights reserved. <|fim_suffix|>pi_esp_wasi_h #define m3_api_esp_wasi_h #include "m3_core.h" d_m3BeginExternC typedef struct m3_wasi_context_t { i32 exit_co...
fim
wasm3/wasm3
c
<|fim_prefix|>// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy. // All rights reserved. // #include "esp_system.h" #include <stdio.h> #include <|fim_suffix|>untime, "_start"); if (result) FATAL("m3_FindFunction: %s", result); p...
fim
wasm3/wasm3
cpp
<|fim_prefix|>// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy. // All rights reserved. // #include "esp_system.h" #include <stdio.h> #include <time.h> #include <unistd.h> #include "wasm3.h" #include "extra/fib32.wasm.h" #define FATA...
fim
wasm3/wasm3
cpp
/* * * Automatically generated file; DO NOT EDIT. * Espressif IoT Development Framework Configuration * */ #define CONFIG_ENABLE_ARDUINO_DEPENDS 1 #define CONFIG_AUTOSTART_ARDUINO 1 #define CONFIG_ARDUINO_RUNNING_CORE 1 #define CONFIG_ARDUINO_UDP_RUN_CORE1 1 #define CONFIG_ARDUINO_EVENT_RUN_CORE1 1 #define CONFIG...
fim
wasm3/wasm3
c
<|fim_suffix|>d\n", value); } void setup() { Serial.begin(115200); delay(10); Serial.print("\nWasm3 v" M3_VERSION " on ESP8266, build " __DATE__ " " __TIME__ "\n"); u32 start = millis(); run_wasm(); u32 end = millis(); Serial.print(String("Elapsed: ") + (end - start) + " ms\n"); } void loop() { de...
fim
wasm3/wasm3
cpp
#ifndef __CONSOLE_H #define __CONSOLE_H #ifdef __cplusplus extern "C" { #endif typedef void (*console_write_hook)(char); typedef char (*console_read_hook)(void); typedef int (*console_read_nonblock_hook)(void); void console_set_write_hook(console_write_hook h); void console_set_read_hook(console_read_hook r, console...
fim
wasm3/wasm3
c
<|fim_suffix|> unsigned int len); #ifdef __cplusplus } #endif #endif <|fim_prefix|>#ifndef __CRC_H #define __CRC_H #ifdef __cplusplus extern "C" { #end<|fim_middle|>if unsigned short crc16(const unsigned char *buffer, int len); unsigned int crc32(const unsigned char *buffer,<|endoftext|>
fim
wasm3/wasm3
c
<|fim_suffix|>ne CSR_IRQ_MASK 0xBC0 #define CSR_IRQ_PENDING 0xFC0 #define CSR_DCACHE_INFO 0xCC0 #endif /* CSR_DEFS__H */ <|fim_prefix|>#ifndef CSR_DEFS__H #define CSR_DEFS__H #define CSR_MSTATUS_MI<|fim_middle|>E 0x8 #defi<|endoftext|>
fim
wasm3/wasm3
c
<|fim_prefix|>//-------------------------------------------------------------------------------- // Auto-generated by Migen (ae42105) & LiteX (3a72688b) on 2019-08-23 13:21:26 //-------------------------------------------------------------------------------- #ifndef __GENERATED_CSR_H #define __GENERATED_CSR_H #include ...
fim
wasm3/wasm3
c
<|fim_suffix|>SH_SIZE 0x00200000 #endif <|fim_prefix|>#ifndef __GENERATED_MEM_H #define __GENERATED_MEM_H #define VEXRISCV_DEBUG_BASE 0xf00f0000 #define VEXRISCV_DEBUG_SIZE 0x00000010 #define SRAM_BASE 0x10000000 #define SRAM_SIZE 0x00020000 #define ROM_BASE 0x00000000 #define ROM_SIZE 0x00002000 #define SPIFLASH_...
fim
wasm3/wasm3
c
<|fim_suffix|>int8_t *)addr) = value; } static inline uint8_t csr_readb(uint32_t addr) { return *(volatile uint8_t *)addr; } static inline void csr_writew(uint16_t value, uint32_t addr) { *((volatile uint16_t *)addr) = value; } static inline uint16_t csr_readw(uint32_t addr) { return *(volatile uint16_t *)addr; }...
fim
wasm3/wasm3
c
<|fim_suffix|> 2 #endif /* __HW_FLAGS_H */ <|fim_prefix|>#ifndef __HW_FLAGS_H #define __HW_FLAGS_H #define UART_EV_TX 0x1 #define UART_EV_RX 0x2 #define DFII_CONTROL_SEL 0x01 #define DFII_CONTROL_CKE 0x02 #define DFII_CONTROL_ODT 0x04 #define DFII_CONTROL_RESET_N 0x08 #define DFII_COMMAND_CS 0x01 #define DFII_C...
fim
wasm3/wasm3
c
<|fim_prefix|>#ifndef __IRQ_H #define __IRQ_H #ifdef __cplusplus extern "C" { #endif #include <system.h> #ifdef __picorv32__ // PicoRV32 has a very limited interrupt support, implemented via custom // instructions. It also doesn't have a global interrupt enable/disable, so // we have to emulate it via saving and res...
fim
wasm3/wasm3
c
<|fim_suffix|>for the 'init_printf' function, so it is safe to call it from interrupts too, although this may result in mixed output. If you rely on re-entrancy, take care that your 'putc' function is re-entrant! The printf and sprintf functions are actually macros that translate to 'tfp_printf' and 'tfp_sprintf'. ...
fim
wasm3/wasm3
c
<|fim_suffix|>int8_t ms); enum led_registers { LEDDCR0 = 8, LEDDBR = 9, LEDDONR = 10, LEDDOFR = 11, LEDDBCRR = 5, LEDDBCFR = 6, LEDDPWRR = 1, LEDDPWRG = 2, LEDDPWRB = 3, }; void rgb_write(uint8_t value, uint8_t addr); #endif /* _RGB_H_ */<|fim_prefix|>#ifndef _RGB_H_ #define _RGB_...
fim
wasm3/wasm3
c
<|fim_prefix|>#ifndef BB_SPI_H_ #define BB_SPI_H_ #include <stdint.h> enum spi_state { SS_UNCONFIGURED = 0, SS_SINGLE, SS_DUAL_RX, SS_DUAL_TX, SS_QUAD_RX, SS_QUAD_TX, SS_HARDWARE, }; enum spi_type { ST_UNCONFIGURED, ST_SINGLE, ST_DUAL, ST_QUAD, ST_QPI, }; enum spi_pin { SP_MOSI, SP_MISO, SP_HOLD, SP...
fim
wasm3/wasm3
c
<|fim_prefix|>#ifndef<|fim_suffix|>write_to_flash(unsigned int addr, const unsigned char *c, unsigned int len); #endif /* __SPIFLASH_H */ <|fim_middle|> __SPIFLASH_H #define __SPIFLASH_H void write_to_flash_page(unsigned int addr, const unsigned char *c, unsigned int len); void erase_flash_sector(unsigned int addr); ...
fim
wasm3/wasm3
c
<|fim_suffix|>f __cplusplus } #endif #include <generated/csr.h> __attribute__((noreturn)) void reboot(void); __attribute__((noreturn)) static inline void warmboot_to_image(uint8_t image_index) { reboot_ctrl_write(0xac | (image_index & 3) << 0); while (1); } #endif /* __SYSTEM_H */ <|fim_prefix|>#ifndef __SYSTEM_H ...
fim
wasm3/wasm3
c
<|fim_prefix|>#ifndef __T<|fim_suffix|>plusplus extern "C" { #endif void time_init(void); int elapsed(int *last_event, int period); void msleep(int ms); #ifdef __cplusplus } #endif #endif /* __TIME_H */ <|fim_middle|>IME_H #define __TIME_H #ifdef __c<|endoftext|>
fim
wasm3/wasm3
c
<|fim_prefix|>#ifndef TOBOOT_API_H_ #define TOBOOT_API_H_ #include <stdint.h> /// Store this configuration struct at offset 0x94 from the start /// of your binary image. /// You may set all RESERVED values to 0. as they will be calculated /// when the program is written to flash. struct toboot_configuration { ///...
fim
wasm3/wasm3
c
<|fim_suffix|>BOOT_V1_APP_MAGIC 0x6fb0 #define TOBOOT_V1_APP_PAGE_MASK 0x00ff0000 #define TOBOOT_V1_APP_PAGE_SHIFT 16 uint32_t tb_first_free_address(void); uint32_t tb_first_free_sector(void); const struct toboot_configuration *tb_get_config(void); uint32_t tb_config_hash(const struct toboot_configuration *cfg); void ...
fim
wasm3/wasm3
c
<|fim_prefix|>/* Teensyduino Core Library * http://www.pjrc.com/teensy/ * Copyright (c) 2013 PJRC.COM, LLC. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, includ...
fim
wasm3/wasm3
c
<|fim_prefix|>#ifndef __USB_H #define __USB_H #ifdef __cplusplus extern "C" { #endif #include <stdint.h> struct usb_setup_request; void usb_isr(void); void usb_init(void); void usb_connect(void); void usb_disco<|fim_suffix|>len); void usb_poll(void); int usb_wait_for_send_done(void); void usb_recv_done(void); void ...
fim
wasm3/wasm3
c
<|fim_suffix|>Call Management Functional Descriptor */ struct usb_cdc_call_management_descriptor { uint8_t bFunctionLength; uint8_t bDescriptorType; uint8_t bDescriptorSubtype; uint8_t bmCapabilities; uint8_t bDataInterface; } __attribute__((packed)); /* Table 4: Abstract Control Management Functional Descriptor ...
fim
wasm3/wasm3
c
<|fim_suffix|>CONFIG_ATTR_REMOTE_WAKEUP 0x20 /* Other Speed Configuration is the same as Configuration Descriptor. * - Table 9-11 */ /* USB Standard Interface Descriptor - Table 9-12 */ struct usb_interface_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bInterfaceNumber; uint8_t bAlternateSett...
fim
wasm3/wasm3
c
/* * Copyright (c) 2016, Devan Lai * * Permission to use, copy, modify, and/or distribute this software * for any purpose with or without fee is hereby granted, provided * that the above copyright notice and this permission notice * appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCL...
fim
wasm3/wasm3
c
<|fim_suffix|>maintenance, but unfortunately slow for small inputs */ XXH32_state_t state; XXH32_reset(&state, seed); XXH32_update(&state, input, len); return XXH32_digest(&state); #else XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; if (XXH_FORCE_ALIGN_CHECK) { i...
fim
wasm3/wasm3
c
<|fim_suffix|>32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); /* Default result type for XXH functions are primitive unsigned 32 and 64 bits. * The canonical representation uses human-readable write convention, aka big-endian (large digits first). * These functions allow transformation of hash resul...
fim
wasm3/wasm3
c
<|fim_suffix|>tail-- = (char)(r.rem + ((9L < r.rem) ? ('A' - 10L) : '0')); uarg = r.quot; } } else *tail-- = '0'; memcpy(head, ++tail, i); return str; } <|fim_prefix|>/* ** LTOA.C ** ** Converts a long integer to a string. **...
fim
wasm3/wasm3
c
// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy. // All rights reserved. // #include <stdio.h> #include <stdbool.h> #include <string.h> #include <irq.h> #include <usb.h> #include <time.h> #include <rgb.h> #include <spi.h> #include <gene...
fim
wasm3/wasm3
c
<|fim_suffix|>reathe in/out void rgb_in_time(uint8_t ms) { rgb_write(BREATHE_ENABLE| BREATHE_MODE_FIXED | BREATHE_RATE_MS(ms), LEDDBCRR); } void rgb_out_time(uint8_t ms) { rgb_write(BREATHE_ENABLE | BREATHE_MODE_FIXED | BREATHE_RATE_MS(ms), LEDDBCFR); } <|fim_prefix|>#include <stdint.h> #include <rgb.h> #inclu...
fim
wasm3/wasm3
c
<|fim_suffix|>value_write(1); } <|fim_prefix|>#include <generated/csr.h> #include <time.h> void time_init(void) { int t; timer0_en_write(0); t = 2*SYSTEM_CLOCK_FREQUENCY; timer0_reload_write(t); timer0_load_write(t); timer0_en_write<|fim_middle|>(1); } int elapsed(int *last_event, int period) { int t, dt; t...
fim
wasm3/wasm3
c
<|fim_suffix|>Endpoint descriptor USB_DT_ENDPOINT_SIZE, // bLength USB_DT_ENDPOINT, // bDescriptorType 0x82, // bEndpointAddress USB_ENDPOINT_ATTR_BULK, // bmAttributes LSB(64), ...
fim
wasm3/wasm3
c
#include <stdint.h> #include <unistd.h> #include <usb.h> #include <system.h> #include <usb-desc.h> static uint8_t reply_buffer[8]; static uint8_t usb_configuration = 0; // #define USB_MAX_PACKET_SIZE 64 // static uint32_t rx_buffer[USB_MAX_PACKET_SIZE/4]; volatile uint8_t terminal_is_connected; __attribute__((sectio...
fim
wasm3/wasm3
c
<|fim_suffix|> if (ep0_buffer_len < buffer_len) buffer_len = ep0_buffer_len; usb_ep0out_buffer_len[usb_ep0out_rd_ptr] = 0; memcpy(buffer, (void *)&usb_ep0out_buffer[usb_ep0out_rd_ptr], buffer_len); usb_ep0out_rd_ptr = (usb_ep0out_rd_ptr + 1...
fim
wasm3/wasm3
c
<|fim_suffix|> on HiFive1 (" M3_ARCH "), build " __DATE__ " " __TIME__ "\n"); // TODO: fix clock (shows wrong time) clock_t start = clock(); run_wasm(); clock_t end = clock(); printf("Elapsed: %ld ms\n", (end - start)*1000 / CLOCKS_PER_SEC); } <|fim_prefix|>// // Wasm3 - high performance WebAssemb...
fim
wasm3/wasm3
c
<|fim_prefix|>// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy. // All rights reserved. // #include "wm_include.h" #include "wasm3.h" #include "extra/fib32.wasm.h" #define FATAL(msg, ...) { printf("Fatal: " msg "\n", ##__VA_ARGS__); r...
fim
wasm3/wasm3
c
<|fim_suffix|> clock_t end = clock(); uint32_t elapsed_time = (end - start)*1000 / CLOCKS_PER_SEC ; printf("Elapsed: %d ms\n", elapsed_time); return 0; } <|fim_prefix|>// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy. // ...
fim
wasm3/wasm3
c
<|fim_prefix|>// // Wasm3 - high performance WebAssembly interpreter written in C. // // Copyright © 2019 Steven Massey, Volodymyr Shymanskyy. // All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <emscripten.h> #include "wasm3.h" #include "m3_env.h" IM3Environment env; EMSCRIPTEN_KEEPALIVE ...
fim
wasm3/wasm3
c
<|fim_suffix|>nces[i] = instance; let result = instance.exports[func](...args); //console.log(i, result); } })(); <|fim_prefix|>'use strict'; if (typeof(process) != 'undefined') { // Node.js environment? var scriptArgs = process.argv.slice(2); const fs = require('fs'); var readFile = (fn) => new Uint8...
fim
wasm3/wasm3
javascript
<|fim_suffix|>e); } console.log(`Memory size: ${instance.exports.memory.buffer.byteLength/(1024*1024)} MB`); })(); <|fim_prefix|>'use strict'; /* Node.js ------- node --v8-options | grep -A1 wasm --print_wasm_code --code-comments --wasm_interpret_all --trace_wasm_interpreter SpiderMonkey ----...
fim
wasm3/wasm3
javascript
<|fim_suffix|>ike to expose to Swift. // typedef void (*print_cbk_t)(const char* buff, int len); void redirect_output (print_cbk_t f); int run_app (void); <|fim_prefix|>// // Use this <|fim_middle|>file to import your target's public headers that you would l<|endoftext|>
fim
wasm3/wasm3
c
<|fim_suffix|>{ struct utsname systemInfo; uname(&systemInfo); printf("Wasm3 v" M3_VERSION " on iOS (" M3_ARCH ")\n"); printf("Build " __DATE__ " " __TIME__ "\n"); printf("Device: %s\n\n", systemInfo.machine); run_wasm(); return 0; } // // Swift Bridging // #include "Bridging-Header.h" ...
fim
wasm3/wasm3
c
// // m3_extensions.c // // Created by Steven Massey on 3/30/21. // Copyright © 2021 Steven Massey. All rights reserved. // #include "wasm3_ext.h" #include "m3_env.h" #include "m3_bind.h" #include "m3_exception.h" IM3Module m3_NewModule (IM3Environment i_environment) { IM3Module module = m3_AllocStruct (M3...
fim
wasm3/wasm3
c
<|fim_suffix|>------------------------------------------- // Creates an empty module. IM3Module m3_NewModule (IM3Environment i_environment); // To append a new function, set io_functionIndex to negative. On return, the new function index will be set. // To overwrite a...
fim
wasm3/wasm3
c
<|fim_prefix|>unsigned char coremark_minimal_wasm[] = { 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x3e, 0x0a, 0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x60, 0x00, 0x00, 0x60, 0x02, 0x7f, 0x7f, 0x00, 0x60, 0x03, 0x7f, 0x7f, 0x7f, 0x00, 0x60, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x60, 0x00, 0x01, 0x7f, 0x60...
fim
wasm3/wasm3
c
<|fim_prefix|>unsigned char fib32_wasm[] = { 0x00<|fim_suffix|>0x00, 0x41, 0x01, 0x6b, 0x10, 0x00, 0x6a, 0x0f, 0x0b }; unsigned int fib32_wasm_len = 62; <|fim_middle|>, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01, 0x03, 0x66,...
fim
wasm3/wasm3
c
<|fim_prefix|>unsigned char fib32_tail_wasm[] = { 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0d, 0x02, 0x60, 0x03, 0x7f, 0x7f, 0x7f, 0x01, 0x7f, 0x60, 0x01, 0x7f, 0x01, 0x7f, 0x03, 0x03, 0x02, 0x00, 0x01, 0x07, 0x07, 0x01, 0x03, 0x66, 0x6<|fim_suffix|>05, 0x20, 0x00, 0x41, 0x01, 0x6b, 0x20, 0x02, 0x2...
fim
wasm3/wasm3
c
<|fim_prefix|>un<|fim_suffix|>0x7d, 0x10, 0x00, 0x7c, 0x0f, 0x0b }; unsigned int fib64_wasm_len = 62; <|fim_middle|>signed char fib64_wasm[] = { 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60, 0x01, 0x7e, 0x01, 0x7e, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01, 0x03, 0x66, 0x69, 0x62, 0x00,...
fim
wasm3/wasm3
c
<|fim_suffix|> __wasi_exitcode_t rval ) __attribute__(( // __import_module__("wasi_snapshot_preview1"), // __import_name__("proc_exit")) )); /** * Send a signal to the process of the calling thread. * Note: This is similar to `raise` in POSIX. */ __wasi_errno_t __wasi_proc_raise( /** * The signal ...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_api_libc.c // // Created by Volodymyr Shymanskyy on 11/20/19. // Copyright © 2019 Volodymyr Shymanskyy. All rights reserved. // #define _POSIX_C_SOURCE 200809L #include "m3_api_libc.h" #include "m3_env.h" #include "m3_exception.h" #include <time.h> #include <errno.h> #include <stdio.h> ty...
fim
wasm3/wasm3
c
<|fim_suffix|>; d_m3EndExternC #endif // m3_api_libc_h <|fim_prefix|>// // m3_api_libc.h // // Created by Volodymyr Shymanskyy on 11/20/19. // Copyright © 2019 Vol<|fim_middle|>odymyr Shymanskyy. All rights reserved. // #ifndef m3_api_libc_h #define m3_api_libc_h #include "m3_core.h" d_m3BeginExternC M3Result ...
fim
wasm3/wasm3
c
<|fim_suffix|> wasi_context->exit_code = 0; wasi_context->argc = 0; wasi_context->argv = 0; } static const char* namespaces[2] = { "wasi_unstable", "wasi_snapshot_preview1" }; // Some functions are incompatible between WASI versions _ (SuppressLookupFailure (m3_LinkRawFunction (module, ...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_api_tracer.c // // Created by Volodymyr Shymanskyy on 02/18/20. // Copyright © 2020 Volodymyr Shymanskyy. All rights reserved. // #include "m3_api_tracer.h" #include "m3_env.h" #include "m3_exception.h" #if defined(d_m3HasTracer) static FILE* trace = NULL; m3ApiRawFunction(m3_env_log_exe...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_api_tracer.h // // Created by Volodymyr Shymanskyy on 02/18/20. //<|fim_suffix|>er_h #define m3_api_tracer_h #include "m3_core.h" d_m3BeginExternC M3Result m3_LinkTracer (IM3Module io_module); d_m3EndExternC #endif // m3_api_tracer_h <|fim_middle|> Copyright © 2020 Volodymyr Shym...
fim
wasm3/wasm3
c
<|fim_suffix|>lor"; env[2] = "LANG=en_US.UTF-8"; env[3] = "PWD=/"; env[4] = "HOME=/"; env[5] = "PATH=/"; env[6] = "WASM3=1"; env[7] = "WASM3_ARCH=" M3_ARCH; env[8] = NULL; #define PREOPENS_COUNT 2 uvwasi_preopen_t preopens[PREOPENS_COUNT]; preopens[0].mapped_path = "/"; pr...
fim
wasm3/wasm3
c
<|fim_suffix|>eturn(errno_to_wasi(errno)); } m3ApiWriteMem64(time, convert_timespec(&tp)); m3ApiReturn(__WASI_ERRNO_SUCCESS); } m3ApiRawFunction(m3_wasi_generic_proc_exit) { m3ApiGetArg (uint32_t, code) m3_wasi_context_t* context = (m3_wasi_context_t*)(_ctx->userdata); if (context) { ...
fim
wasm3/wasm3
c
<|fim_suffix|> argv; } m3_wasi_context_t; M3Result m3_LinkWASI (IM3Module io_module); #if defined(d_m3HasUVWASI) M3Result m3_LinkWASIWithOptions (IM3Module io_module, uvwasi_options_t uvwasiOptions); #endif m3_wasi_context_t* m3_GetWasiContext(); d_m3EndExternC #endif // m3_api_w...
fim
wasm3/wasm3
c
<|fim_suffix|>i_function, NULL); } <|fim_prefix|>// // m3_bind.c // // Created by Steven Massey on 4/29/19. // Copyright © 2019 Steven Massey. All rights reserved. // #include "m3_env.h" #include "m3_exception.h" #include "m3_info.h" u8 ConvertTypeCharToTypeId (char i_code) { switch (i_code) { case 'v':...
fim
wasm3/wasm3
c
<|fim_suffix|>h */ <|fim_prefix|>// // m3_bind.h <|fim_middle|>// // Created by Steven Massey on 2/27/20. // Copyright © 2020 Steven Massey. All rights reserved. // #ifndef m3_bind_h #define m3_bind_h #include "m3_env.h" d_m3BeginExternC u8 ConvertTypeCharToTypeId (char i_code); M3Result Signatur...
fim
wasm3/wasm3
c
<|fim_suffix|> M3CodeMappingPage * page = i_page->info.mapping; d_m3Assert (page->size < page->capacity); M3CodeMapEntry * entry = & page->entries[page->size++]; pc_t pc = GetPagePC (i_page); entry->pcOffset = pc - page->basePC; ...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_code.h // // Created by Steven Massey on 4/19/19. // Copyright © 2019 Steven Massey. All rights reserved. // #ifndef m3_code_h #define m3_code_h #include "m3_core.h" d_m3BeginExternC typedef struct M3CodePage { M3CodePageHeader info; code_t code ...
fim
wasm3/wasm3
c
<|fim_suffix|>typedef M3Compilation * IM3Compilation; typedef M3Result (* M3Compiler) (IM3Compilation, m3opcode_t); //----------------------------------------------------------------------------------------------------------------------------------- typedef struct M3OpInfo { #ifdef DEBUG ...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_config.h // // Created by Steven Massey on 5/4/19. // Copyright © 2019 Steven Massey. All rights reserved. // #ifndef m3_config_h #define m3_config_h #include "m3_config_platforms.h" // general -------------------------------------------------------------------- # ifndef d_m3CodePageAlignS...
fim
wasm3/wasm3
c
<|fim_suffix|># define d_m3MaxFunctionStackHeight 256 # endif # endif # ifndef d_m3FixedHeap # if defined(ARDUINO_AMEBA) # define d_m3FixedHeap (128*1024) # elif defined(BLUE_PILL) || defined(FOMU) # define d_m3FixedHeap (12*1024) # elif defined(ARDUINO...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_core.c // // Created by Steven Massey on 4/15/19. // Copyright © 2019 Steven Massey. All rights reserved. // #define M3_IMPLEMENT_ERROR_STRINGS #include "m3_config.h" #include "wasm3.h" #include "m3_core.h" #include "m3_env.h" void m3_Abort(const char* message) { #ifdef DEBUG fprintf(st...
fim
wasm3/wasm3
c
<|fim_suffix|>es_t * io_bytes, cbytes_t i_end); #endif M3Result Read_u8 (u8 * o_value, bytes_t * io_bytes, cbytes_t i_end); M3Result Read_opcode (m3opcode_t * o_value, bytes_t * io_bytes, cbytes_t i_end); M3Result ReadLebUnsigned (u64 * o_value, u32 i_maxNumBits, bytes_t ...
fim
wasm3/wasm3
c
<|fim_suffix|>, ...) { va_list ap; va_start(ap, i_function); M3Result r = m3_GetResultsVL(i_function, ap); va_end(ap); return r; } M3Result m3_GetResultsVL (IM3Function i_function, va_list o_rets) { IM3Runtime runtime = i_function->module->runtime; IM3FuncType ftype = i_function->funcType...
fim
wasm3/wasm3
c
<|fim_suffix|> allFunctions; // allocated functions count M3Function * functions; i32 startFunction; u32 numDataSegments; M3DataSegment * dataSegments; //u32 importedGlobals; u32 num...
fim
wasm3/wasm3
c
<|fim_suffix|>oto _catch; } } #define _throw(ERROR) { result = ERROR; EXCEPTION_PRINT (result); goto _catch; } #define _throwif(ERROR, COND) if (M3_UNLIKELY(COND)) { _throw(ERROR); } #define _throwifnull(PTR) _throwif (m3Err_mallocFailed, !(PTR)) #endif // m3_exce...
fim
wasm3/wasm3
c
<|fim_prefix|>// // <|fim_suffix|>ts reserved. // // EMPTY FOR NOW <|fim_middle|> m3_exec.c // // Created by Steven Massey on 4/17/19. // Copyright © 2019 Steven Massey. All righ<|endoftext|>
fim
wasm3/wasm3
c
<|fim_suffix|> fp0: %" PRIf64 "\n", _fp0); #endif m3stack_t sp = _sp; for (u32 i = 0; i < stackHeight; ++i) { cstr_t kind = ""; printf ("%p %5s %2d: 0x%" PRIx64 " i:%" PRIi64 "\n", sp, kind, i, (u64) *(sp), (i64) *(sp)); ++sp; } printf ("-...
fim
wasm3/wasm3
c
<|fim_suffix|>3OpDefaultArgs d_m3BaseOpDefaultArgs # define d_m3ClearRegisters d_m3BaseClearRegisters # endif #define d_m3RetSig static inline m3ret_t vectorcall # if (d_m3EnableOpProfiling || d_m3EnableOpTracing) typedef m3ret_t (vectorcall * IM3Operation) (d_m3OpSig, cstr_t i_ope...
fim
wasm3/wasm3
c
<|fim_suffix|> u16 GetFuncTypeNumResults (const IM3FuncType i_funcType) { return i_funcType ? i_funcType->numRets : 0; } u8 GetFuncTypeResultType (const IM3FuncType i_funcType, u16 i_index) { u8 type = c_m3Type_unknown; if (i_funcType) { if (i_index < i_funcType->numRets) { ...
fim
wasm3/wasm3
c
<|fim_suffix|> codePageRefs; // array of all pages used u32 numCodePageRefs; # endif # if defined (DEBUG) u32 hits; u32 index; # endif u16 maxStackSlots; u16 numRetSl...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_info.c // // Created by Steven Massey on 4/27/19. // Copyright © 2019 Steven Massey. All rights reserved. // #include "m3_env.h" #include "m3_info.h" #include "m3_compile.h" #if defined(DEBUG) || (d_m3EnableStrace >= 2) size_t SPrintArg (char * o_string, size_t i_stringBufferSize, voidptr...
fim
wasm3/wasm3
c
<|fim_prefix|>// // m3_info.h // // Created by Steven Massey on 12/6/19. // Copyr<|fim_suffix|>info_h <|fim_middle|>ight © 2019 Steven Massey. All rights reserved. // #ifndef m3_info_h #define m3_info_h #include "m3_compile.h" d_m3BeginExternC void ProfileHit (cstr_t i_operationName); #i...
fim
wasm3/wasm3
c
<|fim_suffix|>snan(b))) return NAN; if (M3_UNLIKELY(a == 0 and a == b)) return signbit(a) ? b : a; return a > b ? a : b; } static inline f64 min_f64(f64 a, f64 b) { if (M3_UNLIKELY(isnan(a) or isnan(b))) return NAN; if (M3_UNLIKELY(a == 0 and a == b)) return signbit(a) ? a : b; return a > b ? b : a...
fim
wasm3/wasm3
c
<|fim_suffix|> buff = m3_AllocArray(char, 16); snprintf(buff, 16, "$global%d", i); global->name = buff; } } } #endif IM3Function Module_GetFunction (IM3Module i_module, u32 i_functionIndex) { IM3Function func = NULL; if (i_functionIndex < i_module->numFunctions) { ...
fim
wasm3/wasm3
c
<|fim_suffix|> u8 section; _ (ReadLEB_u7 (& section, & pos, end)); if (section != 0) { // Ensure sections appear only once and in order while (sectionsOrder[expectedSection++] != section) { _throwif(m3Err_misorderedWasmSection, expectedSection >= 12); ...
fim
wasm3/wasm3
c
<|fim_suffix|> { *raw_return = (VALUE); return m3Err_none;} # define m3ApiMultiValueReturn(NAME, VALUE) { *NAME = (VALUE); } # define m3ApiTrap(VALUE) { return VALUE; } # define m3ApiSuccess() { return m3Err_none; } # if defined(M3_BIG_ENDIAN) # define m3ApiReadMem8(ptr) ...
fim
wasm3/wasm3
c
<|fim_prefix|>// // wasm3_defs.h // // Created by Volodymyr Shymanskyy on 11/20/19. // Copyright © 2019 Volodymyr Shymanskyy. All rights reserved. // #ifndef wasm3_defs_h #define wasm3_defs_h #define M3_STR__(x) #x #define M3_STR(x) M3_STR__(x) #define M3_CONCAT__(a,b) a##b #define M3_CONCAT(a,b) M3_CONCAT__(...
fim
wasm3/wasm3
c
// // m3_test.c // // Created by Steven Massey on 2/27/20. // Copyright © 2020 Steven Massey. All rights reserved. // #include <stdio.h> #include "wasm3_ext.h" #include "m3_bind.h" #define Test(NAME) if (RunTest (argc, argv, #NAME) != 0) #define DisabledTest(NAME) printf ("\ndisabled: %s\n", #NAME); if (false) #d...
fim
wasm3/wasm3
c
<|fim_prefix|>#include <stdint.h> #define NULL (0) typedef double f64; typedef float f32; typedef uint64_t u64; typedef int64_t i64; typedef uint32_t u32; typedef int32_t i32; typedef uint16_t u16; typedef int16_t i16; typedef uint8_t u8; typedef...
fim
wasm3/wasm3
c
<|fim_suffix|>efine WASM_EXPORT __attribute__((used)) __attribute__((visibility ("default"))) WASM_EXPORT uint32_t fib(uint32_t n) { if(n < 2) { return n; } return fib(n-1) + fib(n-2); } int parseInt(char* str) { int res = 0; for (int i = 0; str[i] != '\0'; ++i) { res = res * 10 + ...
fim
wasm3/wasm3
c
<|fim_prefix|>function fib(n) { if(n < 2) { return n; } return fib(n-1) +<|fim_suffix|>fib(process.argv[2])) <|fim_middle|> fib(n-2) } console.log(<|endoftext|>
fim
wasm3/wasm3
javascript
function fib(f){if(f<2)return f return fib(f-1)+fib(f-2)} console.log(fib(32)); <|endoftext|>
fim
wasm3/wasm3
javascript
import sys def fib(n): if n < 2: return n return fib(n-1) + fib(n-2) print(fib(int(sys.argv[1]))) <|endoftext|>
fim
wasm3/wasm3
python
<|fim_suffix|> pass #fatal(str(e)) elif ( test.type == "action" or test.type == "assert_return" or test.type == "assert_trap" or test.type == "assert_exhaustion" or test.type == "assert_return_canonical_nan" or test.typ...
fim
wasm3/wasm3
python