Skip to content

Instantly share code, notes, and snippets.

View chriswhocodes's full-sized avatar

Chris Newland chriswhocodes

View GitHub Profile
@chriswhocodes
chriswhocodes / gist:5516d24078205dc218dead870853e018
Created May 25, 2016 07:52
JavaFX crash on VideoDataBuffer.convertToFormat
Process: java [900]
Path:
/Library/Java/JavaVirtualMachines/jdk1.8.0_92_openjfx/Contents/Home/bin/java
Identifier: java
Version: 1.0 (1.0)
Code Type: X86-64 (Native)
Parent Process: eclipse [601]
Responsible: java [900]
User ID: 501
@chriswhocodes
chriswhocodes / PathtracerMT.java
Last active March 14, 2019 23:33
Multithreaded version of @shelajev Java port of the postcard raytracer by Fabien Sanglard
package org.example.pathtracer.multithreaded;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
@chriswhocodes
chriswhocodes / gist:0ee21a9c33472d5bc35ce050fc961e03
Created January 8, 2019 19:15
OpenJDK hg diff for floating point min/max intrinsics hg diff -c 53041:f15af1e2c683
diff -r 6aeb6a23fb83 -r f15af1e2c683 src/hotspot/cpu/aarch64/aarch64.ad
--- a/src/hotspot/cpu/aarch64/aarch64.ad Tue Dec 18 16:22:46 2018 -0500
+++ b/src/hotspot/cpu/aarch64/aarch64.ad Tue Dec 18 16:50:35 2018 +0000
@@ -12601,6 +12601,63 @@
%}
+// Math.max(FF)F
+instruct maxF_reg_reg(vRegF dst, vRegF src1, vRegF src2) %{
+ match(Set dst (MaxF src1 src2));
chris@vultr:~/openjfx8_clean$ /home/chris/gradle-4.8.1/bin/gradle clean openZip -PCOMPILE_TARGETS=armv6hf
> Configure project :
all tool packages are present [armv6hf-02.tgz, gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tgz]
*****************************************************************
Unsupported gradle version 4.8.1 in use.
Only version 4.8 is supported. Use this version at your own risk
*****************************************************************
gradle.gradleVersion: 4.8.1
OS_NAME: linux
@chriswhocodes
chriswhocodes / TestFileChooser.java
Created January 24, 2014 15:46
JavaFX FileChooser.ExtensionFilter *.* not working on OSX
import java.io.File;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
public class TestFileChooser extends Application
{
@chriswhocodes
chriswhocodes / JavaCard.java
Last active December 25, 2015 16:59
Andrew Kensler's business card raytracer converted to Java
package com.chrisnewland.raytrace;
import java.io.FileOutputStream;
/*
* Standing on the shoulders of giants.
* I didn't invent this raytracer, just converted it from C to Java with the help of this web page by Fabien Sanglard:
* http://fabiensanglard.net/rayTracing_back_of_business_card/index.php
* The original code is by Andrew Kensler. Comments copied from Fabien Sanglard's notes.
*/
@chriswhocodes
chriswhocodes / gist:6839214
Created October 5, 2013 10:23
Normalise a double in a range and scale to a dimension (with optional invert). Useful for chart scaling.
public static double normalise(double value, double min, double max, double size, boolean invert)
{
double range = max - min;
double result = 0;
if (range != 0)
{
result = (value - min) / range;
}
<?xml version='1.0' encoding='UTF-8'?>
<hotspot_log version='160 1' process='1441' time_ms='1437572649560'>
<vm_version>
<name>
Java HotSpot(TM) 64-Bit Server VM
</name>
<release>
25.51-b03
</release>
<info>
@chriswhocodes
chriswhocodes / run.js
Created June 9, 2015 21:00
Example JavaScript that dumps different bytecode with Nashorn 8u60b18 and 9b67
var sum = 0;
for (var i = 0; i < 1000000; i++)
{
sum = addOne(sum);
sum = addTwo(sum);
}
print(sum);
@chriswhocodes
chriswhocodes / gist:e3a85c3613b084e45356
Created June 9, 2015 21:04
Output of run.js under Nashorn 8u60b18
8u60b18
Result of
$JAVA_HOME/bin/jjs -co --dump-debug-dir=. run.js
chris@debian:~/jitwatch/sandbox/sources/jdk/nashorn/internal/scripts$ ls -l
total 8
-rw-r--r-- 1 chris chris 871 Jun 9 21:57 JO5P0.class
-rw-r--r-- 1 chris chris 3216 Jun 9 21:57 Script$run.class