duangsuse::Echo
现在可以用内联汇编写 Hello world 了吗?duangsuse 试试
#include <stdio.h>
/* inline */ void printf_asm(char *message) {
const char *fmt = "%s";
int i;
__asm__ volatile
(
""
);
__asm__ volatile
(
"call printf"
);
}
int main(int argc, char *argv[]) {
printf_asm("Hello, world!");
}
[DuangSUSE@duangsuse]~/Projects% gcc hello_asm.c
[DuangSUSE@duangsuse]~/Projects% ./a.out
Hello, world!%
... 不行,这也太作弊了 😶 不能这样!!!
#include <stdio.h>
/* inline */ void printf_asm(char *message) {
const char *fmt = "%s\n";
int dummy;
__asm__ volatile
(
"push %[msg]\n\t"
: "=r" (dummy)
: [msg] "b" (message)
);
__asm__ volatile
(
"push %[fmt]\n\t"
: "=r" (dummy)
: [fmt] "b" (fmt)
);
__asm__ volatile ("call printf");
}
int main(int argc, char *argv[]) {
printf_asm("Hello, world!");
}
zsh: segmentation fault (core dumped) ./a.out
哭哭
关于 TCO(尾调用消除(优化)),duangsuse 现在是只会蹦床函数的说,看 ES6 标准教学学的
如果要给 InScript 加,其实也不清楚到底怎么办呢
毕竟也只是一个 AST tree walker 解释器,如果有些特殊的东西就不好办了
如果要给 InScript 加,其实也不清楚到底怎么办呢
毕竟也只是一个 AST tree walker 解释器,如果有些特殊的东西就不好办了
function trampoline(fun) {
while (fun != null && typeof fun == 'function') fun = fun();
return fun;
}
function factorial(current = 2, accum) {
if (accum > 0)
return factorial.bind(this, current * current, accum - 1);
else
return current;
}
trampoline(factorial(null, 10))还是不能用呢(((((
发现
但是还是不能正常工作(
发现
Function.prototype.bind() 的第一个参数是上下文,所以出错,修复了!但是还是不能正常工作(
duangsuse 接下来要用自己之前写的 Lime S-表达式解释器框架,写一个类似于 JSON 的序列化/反序列化语言
在此之前,我会先升级这门语言
在此之前,我会先升级这门语言
duangsuse::Echo
#recommended #mdeia #CS https://gitapk.popf.rip/Syhthesizers-Mirror/Prometheus-spark/src/branch/master/writings/from-miku-to-svs/from_miku_to_svs.md
This media is not supported in your browser
VIEW IN TELEGRAM
duangsuse::Echo
😂 Sticker
(说句比较丧气的话,虽然现在 HotSpot 的优化很厉害,现在很多硬件也很好,不推荐使用 Java 编写任何和 DSP 相关的代码,推荐使用 C/Julia/Python/Octave 等