這是我的字節碼程序代碼,用於計算只能使用iconst_1的斐波那契數列的前20個數字。現在編寫一個JVM字節碼程序來計算並打印Fibonacci序列中的前20個數字
iconst_1
istore_1
iconst_1
istore_2
iconst_1
istore_3
getstatiC#2
iconst_1
invokevirtual #3
getstatiC#2
iconst_1
invokevirtual #3
iconst_1
istore_4
iload_4
bipush 18
if_icmpgt 51
iload_1
iload_2
iadd
istore_3
getstatiC#2
iload_3
invokevirtual #3
iload_2
istore_1
iload_3
istore_2
iinc 4,1
goto 23
return
我的主要問題是,它是在一個名爲fibonacci.bc的形式,我需要編譯並運行它,以確保它的工作原理。首先需要在程序中解決任何問題,例如語法等。我將如何在JVM上做這件事?
爲了在您的問題中粘貼代碼,您需要在每個代碼行之前添加四個空格或使用工具欄中的「代碼」按鈕。 – Vova
非常感謝您 – user276019
您正在尋找一個用於Java字節碼的_assembler_。這應該讓你的搜索開始。 –