- Install Docker Desktop
 
Because we already have an official CockroachDB docker image, we will use that in our docker-compose.yml file. We recommend you use one of the current tags instead of latest.
| import java.nio.ByteBuffer | |
| import java.util | |
| import io.circe.parser._ | |
| import io.circe.syntax._ | |
| import io.circe.{Decoder, Encoder, _} | |
| import org.apache.kafka.common.errors.SerializationException | |
| import org.apache.kafka.common.serialization.{Deserializer, Serde, Serializer} | |
| import scala.util.Try | 
| FROM gitpod/workspace-full | |
| USER gitpod | |
| RUN brew install coursier/formulas/coursier | |
| ENV COURSIER_CACHE /workspace/.coursier/cache/v1 | |
| RUN cs setup --yes --jvm 14 --apps sbt-launcher,scala,scalafmt,mill,mill-interactive | 
| import scala.deriving._ | |
| import scala.compiletime.{erasedValue, summonInline} | |
| // super primitive (but composable via typeclass derivation) JSON reader | |
| trait Reader[A] { | |
| def read(json: ujson.Value): A | |
| } | |
| object Reader { | |
| given Reader[Int] = new Reader[Int] { | 
Because we already have an official CockroachDB docker image, we will use that in our docker-compose.yml file. We recommend you use one of the current tags instead of latest.
| final case class CustomArgMsg(key: String, value: String, trackable: Boolean) | 
Here's an error that I got spuriously but rerunning the compilation made it go away.
[E] [E1] config/src/main/scala-2.11-13/bloop/config/ConfigCodecs.scala:119:42
[E]      Cannot evaluate a parameter of the 'make' macro call for type 'bloop.config.Config.JvmConfig'. It should not depend on code from the same compilation module where the 'make' macro is called. Use a separated submodule of the project to compile all such dependencies before their usage for generation of codecs. Cause:
[E]      java.lang.AssertionError: assertion failed: pkgClass = package <root>, sym = package com, existing = package com (depth=0)
[E]      L119:     JsonCodecMaker.make[Config.JvmConfig](CodecMakerConfig.withTransientEmpty(false))
[E]                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E] config/src/main/scala-2.11-13/bloop/config/ConfigCodecs.scala: L119 [E1]
| #!/bin/bash | |
| # Requirements (on non-EMR machines): | |
| # * init-ctl or systemctl | |
| # * packages python3.6 python3.6-venv python3.6-dev | |
| # * python3 -V has to be 3.6+ (update-alternatives) | |
| # * JAVA_HOME pointing to java 8 (openjdk or oracle) | |
| # * SPARK_HOME set and included in PATH (see https://polynote.org/docs/01-installation.html) | |
| set -ex | 
| object RuntimeUtils { | |
| def requestThreadDump: String = { | |
| // Get the PID of the current JVM process | |
| val selfName = java.lang.management.ManagementFactory.getRuntimeMXBean().getName() | |
| val selfPid = selfName.substring(0, selfName.indexOf('@')) | |
| // Attach to the VM | |
| import com.sun.tools.attach.VirtualMachine | |
| import sun.tools.attach.HotSpotVirtualMachine; | |
| val vm = VirtualMachine.attach(selfPid); | 
| // unfortunately | |
| // opaque type Fix[F[_]] = F[Fix[F]] | |
| // won't work (no recursion in opaque type), but this implementation is safe, but scary due to asInstanceOf | |
| object FixImpl { | |
| type Fix[F[_]] | |
| inline def fix[F[_]](f: F[Fix[F]]): Fix[F] = f.asInstanceOf[Fix[F]] | |
| inline def unfix[F[_]](f: Fix[F]): F[Fix[F]] = f.asInstanceOf[F[Fix[F]]] | |
| } | 
This document was originally written several years ago. At the time I was working as an execution core verification engineer at Arm. The following points are coloured heavily by working in and around the execution cores of various processors. Apply a pinch of salt; points contain varying degrees of opinion.
It is still my opinion that RISC-V could be much better designed; though I will also say that if I was building a 32 or 64-bit CPU today I'd likely implement the architecture to benefit from the existing tooling.
Mostly based upon the RISC-V ISA spec v2.0. Some updates have been made for v2.2
The RISC-V ISA has pursued minimalism to a fault. There is a large emphasis on minimizing instruction count, normalizing encoding, etc. This pursuit of minimalism has resulted in false orthogonalities (such as reusing the same instruction for branches, calls and returns) and a requirement for superfluous instructions which impacts code density both in terms of size and