This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
[dependencies] | |
wasmer = { version = "4.3.4" } | |
*/ | |
use wasmer::{Cranelift, Function, Imports, Instance, Module, RuntimeError, Store, Value}; | |
fn static_return_32_then_64_then_32(lhs: i32, rhs: i32) -> (i32, i64, i32) { | |
(lhs, lhs as i64 + rhs as i64, rhs) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following is based on a fresh Ubuntu 18.04.2 LTS with gcc, make and perl already | |
# installed (not that perl has anything to do with any of this..) | |
# | |
# This is based on JDK 11 but for JDK 12 I've confirmed it builds ok with binutils-2.29 | |
# and binutils-2.32 | |
apt install mercurial | |
# Be nice if this didn't check out the universe | |
hg clone http://hg.openjdk.java.net/jdk/jdk11/ | |
cd jdk11/src/utils/hsdis/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev g++-multilib mercurial texinfo | |
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u | |
cd jdk8u | |
hg update jdk8u92-b14 | |
sed -ri 's/subrepos="[^"]+"/subrepos="hotspot"/' ./make/scripts/hgforest.sh # only get hotspot | |
sed -ri 's/subrepos="[^"]+"/subrepos="hotspot"/' ./common/bin/hgforest.sh # only get hotspot | |
chmod +x ./get_source.sh; ./get_source.sh | |
cd hotspot/src/share/tools/hsdis | |
wget http://ftp.heanet.ie/mirrors/ftp.gnu.org/gnu/binutils/binutils-2.29.tar.gz | |
tar -xzf binutils-2.29.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.neverfear.services.jvmmonitor.api; | |
import static java.lang.System.out; | |
import java.net.URISyntaxException; | |
import java.util.List; | |
import java.util.Set; | |
import sun.jvmstat.monitor.HostIdentifier; | |
import sun.jvmstat.monitor.Monitor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void tag_invalidate(memory_t * memory) { | |
TAG_TYPE * start = PTR_START_TAG(memory); | |
*start = TAG_INVALID_VALUE; | |
TAG_TYPE * end = PTR_END_TAG(memory); | |
*end = TAG_INVALID_VALUE; | |
} | |
bool tag_free(memory_t * memory) { | |
if (tag_underran(memory) || tag_overran(memory)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool tag_underran(memory_t * memory) { | |
return *PTR_START_TAG(memory) != VALID_START_TAG; | |
} | |
bool tag_overran(memory_t * memory) { | |
return *PTR_END_TAG(memory) != VALID_END_TAG; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define TAG_TYPE int | |
#define TAG_SIZE sizeof(TAG_TYPE) | |
#define VALID_START_TAG 0xDEADBEEF | |
#define VALID_END_TAG 0xCAFEBABE | |
#define TAG_INVALID_VALUE 0xBADC0DE5 | |
#define PTR_START_TAG(memory) (TAG_TYPE *)(memory->ptr - TAG_SIZE) | |
#define PTR_END_TAG(memory) (TAG_TYPE *)(memory->ptr + memory->size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "dogtag.h" | |
bool tag_alloc(memory_t * memory, size_t size) { | |
void * ptr = malloc(size + (2 * TAG_SIZE)); | |
if (ptr == NULL) { | |
return false; | |
} | |
TAG_TYPE * startPtr = ptr; | |
*startPtr = VALID_START_TAG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.neverfear.ha; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import java.util.concurrent.locks.Lock; | |
import org.jgroups.JChannel; | |
import org.jgroups.blocks.locking.LockService; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FailoverManager implements AutoCloseable, ChannelListener, Receiver { | |
private static final Logger LOGGER = LoggerFactory.getLogger(FailoverManager.class); | |
private static final String HA_CLUSTER = "ha-cluster"; | |
private final JChannel channel; | |
private final int maximumClusterSize; | |
private final LeadershipResolver decider; |
NewerOlder