Skip to content

Instantly share code, notes, and snippets.

View retronym's full-sized avatar

Jason Zaugg retronym

View GitHub Profile
object FindCollectionReturningHofs extends App {
import scala.tools.nsc._
val global = new Global(new Settings)
import global._
import global.settings
settings.usejavacp.value = true
settings.embeddedDefaults(getClass.getClassLoader)
+++ MANIFEST.MF
Manifest-Version: 1.0
Automatic-Module-Name: scala.tools.nsc
Bundle-ManifestVersion: 2
Bundle-Name: Scala Compiler
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-SymbolicName: org.scala-lang.scala-compiler
Bundle-Version: 2.12.15.v20210703-050957-52d9dbd
Class-Path: scala-reflect.jar scala-library.jar
[
{
"jmhVersion" : "1.29",
"benchmark" : "org.sample.Jdk11PerfRegressionBenchmark.setPhase",
"mode" : "avgt",
"threads" : 1,
"forks" : 2,
"jvm" : "/Users/jz/.jabba/jdk/[email protected]/Contents/Home/bin/java",
"jvmArgs" : [
],
after boxUnbox
// access flags 0x1000001
public crash()V
L0
LINENUMBER 5 L0
L1
LINENUMBER 6 L1
ICONST_0
ISTORE 2
L0
LINENUMBER 5 L0
L1
LINENUMBER 6 L1
ACONST_NULL
ASTORE 3
L2
ACONST_NULL
ASTORE 5
GOTO L3
L0
LINENUMBER 5 L0
L1
LINENUMBER 6 L1
ACONST_NULL
ASTORE 3
L2
NEW scala/runtime/ObjectRef
DUP
ALOAD 3
https://gist.github.com/d1af6aaaa9cbeb618f0f82593a58ca62
package p1
class Test {
def crash: Unit = {
var box: AnyRef = null
def writeBox(a: AnyRef): Unit = {
box = a
}
<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-partest</artifactId>
<packaging>jar</packaging>
<description>Scala Compiler Testing Tool</description>
<url>https://www.scala-lang.org/</url>
<version>2.12.13-bin-SNAPSHOT</version>
<licenses>
[error] Options accepted by async:
[error] allkernel=<bool> Only include kernel-mode events.
[error] alluser=<bool> Only include user-mode events.
[error] ann=<bool> Annotate Java method names.
[error] cstack=<mode> How to traverse C stack: Supported: [fp, lbr, no].
[error] dir=<dir> Output directory.
[error] direction=<direction> Direction(s) of flame graph. Supported: [forward,
[error] reverse, both]. (default: [both])
[error] event=<event> Event to sample: cpu, alloc, wall, lock, cache-misses,
[error] etc. (default: [cpu])