Skip to content

Instantly share code, notes, and snippets.

View tkfx's full-sized avatar

Alex Zhitnitsky tkfx

View GitHub Profile
....
0x00007fd715060743: vmovsd 0x10(%r8,%rcx,8),%xmm0 ;*daload
; - Opt::loopUnrolling@26 (line 179)
0x00007fd71506074a: vmovsd 0x10(%rbp),%xmm1 ;*daload
; - Opt::loopUnrolling@36 (line 179)
0x00007fd71506074f: vmulsd 0x10(%r12,%r9,8),%xmm1,%xmm1
0x00007fd715060756: vaddsd %xmm0,%xmm1,%xmm0 ;*dadd
; - Opt::loopUnrolling@38 (line 179)
0x00007fd71506075a: vmovsd %xmm0,0x10(%r8,%rcx,8) ;*dastore
; - Opt::loopUnrolling@39 (line 179)
private static double[] loopUnrolling2(double[][] matrix1, double[] vector1) {
double[] result = new double[vector1.length];
for (int i = 0; i < matrix1.length; i++) {
result[i] += matrix1[i][0] * vector1[0];
result[i] += matrix1[i][1] * vector1[1];
result[i] += matrix1[i][2] * vector1[2];
// and maybe it will expand even further - e.g. 4 iterations, thus
// adding code to fix the indexing
// which we would waste more time doing correctly and efficiently
private static double[] loopUnrolling(double[][] matrix1, double[] vector1) {
double[] result = new double[vector1.length];
for (int i = 0; i < matrix1.length; i++) {
for (int j = 0; j < vector1.length; j++) {
result[i] += matrix1[i][j] * vector1[j];
}
}
return result;
private static void calcLine(int a, int b, int from, int to) {
Line l = new Line(a, b);
for (int x = from; x <= to; x++) {
int y = l.getY(x);
System.err.println("(" + x + ", " + y + ")");
}
}
static class Line {
public final int a;
private static void calcLine(int a, int b, int from, int to) {
Line l = new Line(a, b);
for (int x = from; x <= to; x++) {
int y = (l.a * x + l.b);
System.err.println("(" + x + ", " + y + ")");
}
}
private static final ThreadLocal<Integer> counter = new ThreadLocal<Integer>();
private static void handleRequest() {
if (counter.get() == null) {
counter.set(0);
}
counter.set(counter.get() + 1);
0x00007fd71508b1ec: mov 0x1b0(%r15),%r10 ;*invokestatic currentThread
; - java.lang.ThreadLocal::get@0 (line 143)
; - Opt::handleRequest@3 (line 70)
0x00007fd71508b1f3: mov 0x50(%r10),%r11d ;*getfield threadLocals
; - java.lang.ThreadLocal::getMap@1 (line 213)
; - java.lang.ThreadLocal::get@6 (line 144)
; - Opt::handleRequest@3 (line 70)
private static final ThreadLocal<Integer> counter = new ThreadLocal<Integer>() {
@Override protected Integer initialValue() {
return 0;
}
};
private static void handleRequest() {
counter.set(counter.get() + 1);
java.lang.NullPointerException: null
at com.sparktale.bugtale.server.app.servlet.billing.GetUserBillingServlet.internalWork(GetUserBillingServlet.java:64) [GetUserBillingServlet.class:na]
at com.sparktale.bugtale.server.app.servlet.billing.GetUserBillingServlet.internalWork(GetUserBillingServlet.java:27) [GetUserBillingServlet.class:na]
at com.sparktale.bugtale.server.app.servlet.AppServicesProtoServlet.work(AppServicesProtoServlet.java:82) [AppServicesProtoServlet.class:na]
at com.sparktale.bugtale.server.app.servlet.AppServicesProtoServlet.work(AppServicesProtoServlet.java:21) [AppServicesProtoServlet.class:na]
at com.sparktale.bugtale.server.common.servlet.CommonServlet.handleRequest(CommonServlet.java:144) [CommonServlet.class:na]
at com.sparktale.bugtale.server.common.servlet.CommonServlet.doPost(CommonServlet.java:64) [CommonServlet.class:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) [servlet-api.jar:na]
at javax.servl
java.lang.NullPointerException: null
at com.sparktale.bugtale.server.app.servlet.billing.GetUserBillingServlet.internalWork(GetUserBillingServlet.java:64) [GetUserBillingServlet.class:na]
at com.sparktale.bugtale.server.app.servlet.billing.GetUserBillingServlet.internalWork(GetUserBillingServlet.java:27) [GetUserBillingServlet.class:na]
at com.sparktale.bugtale.server.app.servlet.AppServicesProtoServlet.work(AppServicesProtoServlet.java:82) [AppServicesProtoServlet.class:na]
at com.sparktale.bugtale.server.app.servlet.AppServicesProtoServlet.work(AppServicesProtoServlet.java:21) [AppServicesProtoServlet.class:na]
at com.sparktale.bugtale.server.common.servlet.CommonServlet.handleRequest(CommonServlet.java:144) [CommonServlet.class:na]
at com.sparktale.bugtale.server.common.servlet.CommonServlet.doPost(CommonServlet.java:64) [CommonServlet.class:na]