Skip to content

Instantly share code, notes, and snippets.

View pepyakin's full-sized avatar

Sergei Shulepov pepyakin

View GitHub Profile
// #![feature(log_syntax)]
// #![feature(trace_macros)]
// trace_macros!(true);
#[derive(Debug, PartialEq, Eq)]
pub struct FuncInstance;
pub struct MemoryInstance;
@pepyakin
pepyakin / macro.rs
Last active January 3, 2018 14:52
cargo expand
struct Resolver;
impl<'a> Data<'a> {
fn resolver() -> Resolver {
Resolver
}
}
impl ImportResolver for Resolver {
fn resolve_func(&self, name: &str, _signature: &FunctionType) -> FuncRef {
if name == "add" {
#![feature(prelude_import)]
#![no_std]
// Copyright 2017 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
extern crate parity_wasm;
use std::env;
use std::fmt;
use std::rc::Rc;
use parity_wasm::elements::Module;
use parity_wasm::interpreter::{
Error as InterpreterError, HostModule, HostModuleBuilder,
ModuleInstance, UserError, HostState, StateKey};
extern crate parity_wasm;
use std::env;
use std::fmt;
use std::rc::Rc;
use parity_wasm::elements::Module;
use parity_wasm::interpreter::{Error as InterpreterError, HostModule, HostModuleBuilder,
ModuleInstance, UserError};
#[derive(Debug)]
extern crate parity_wasm;
use std::env;
use std::fmt;
use std::rc::Rc;
use parity_wasm::elements::Module;
use parity_wasm::interpreter::{Error as InterpreterError, HostModule, HostModuleBuilder,
ModuleInstance, UserError};
#[derive(Debug)]
extern crate parity_wasm;
use std::rc::Rc;
use parity_wasm::elements::Module;
use parity_wasm::interpreter::{
ModuleInstance, HostModule, HostModuleBuilder, Error
};
mod tictactoe {
use std::collections::HashMap;
@pepyakin
pepyakin / suicidal.ll
Created November 15, 2017 13:30
rustc 1.23.0-nightly (8b22e70b2 2017-10-31)
; ModuleID = 'suicidal0-c5be23406fd320ed2cb4254d08f783fa.rs'
source_filename = "suicidal0-c5be23406fd320ed2cb4254d08f783fa.rs"
target datalayout = "e-p:32:32-i64:64-v128:32:128-n32-S128"
target triple = "asmjs-unknown-emscripten"
%str_slice = type { i8*, i32 }
%"core::fmt::Write::write_fmt::Adapter<string::String>" = type { %"alloc::string::String"*, [0 x i8] }
%"alloc::string::String" = type { %"alloc::vec::Vec<u8>", [0 x i8] }
%"alloc::vec::Vec<u8>" = type { %"alloc::raw_vec::RawVec<u8, alloc::heap::Heap>", [0 x i8], i32, [0 x i8] }
%"alloc::raw_vec::RawVec<u8, alloc::heap::Heap>" = type { %"core::ptr::Unique<u8>", [0 x i8], i32, [0 x i8], %"alloc::heap::Heap", [0 x i8] }
@pepyakin
pepyakin / suicidal-cd0157297bb82573.ll
Last active November 15, 2017 13:31
rustc 1.21.0-nightly (230a379a4 2017-08-18)
; ModuleID = 'suicidal.cgu-0.rs'
source_filename = "suicidal.cgu-0.rs"
target datalayout = "e-p:32:32-i64:64-v128:32:128-n32-S128"
target triple = "asmjs-unknown-emscripten"
%str_slice = type { i8*, i32 }
%"core::fmt::Write::write_fmt::Adapter<string::String>" = type { %"alloc::string::String"*, [0 x i8] }
%"alloc::string::String" = type { %"alloc::vec::Vec<u8>", [0 x i8] }
%"alloc::vec::Vec<u8>" = type { %"alloc::raw_vec::RawVec<u8, alloc::heap::Heap>", [0 x i8], i32, [0 x i8] }
%"alloc::raw_vec::RawVec<u8, alloc::heap::Heap>" = type { %"core::ptr::Unique<u8>", [0 x i8], i32, [0 x i8], %"alloc::heap::Heap", [0 x i8] }