Appearance
Sum1To1000
1から1000までの整数を加算し、sum = 5050をDebug.Logへ出力するサンプル。_startを実行するたびにローカル変数相当のsとiを初期化します。
json
{
"version": 1,
"comment": "1から1000までの整数を加算し、sum = 5050をDebug.Logへ出力するサンプル。_startを実行するたびにローカル変数相当のsとiを初期化します。",
"data": [
{
"name": "__s_0",
"type": "SystemInt32",
"value": 0
},
{
"name": "__i_0",
"type": "SystemInt32",
"value": 0
},
{
"name": "__s_next_0",
"type": "SystemInt32",
"value": 0
},
{
"name": "__i_next_0",
"type": "SystemInt32",
"value": 0
},
{
"name": "__constant_0",
"type": "SystemInt32",
"value": 0
},
{
"name": "__constant_1",
"type": "SystemInt32",
"value": 1
},
{
"name": "__constant_1000",
"type": "SystemInt32",
"value": 1000
},
{
"name": "__condition_0",
"type": "SystemBoolean",
"value": false
},
{
"name": "__sum_prefix_0",
"type": "SystemString",
"value": "sum = "
},
{
"name": "__message_0",
"type": "SystemString",
"value": ""
}
],
"code": [
{
"name": "_start",
"export": true,
"instructions": [
{
"op": "PUSH",
"operand": "__constant_0"
},
{
"op": "PUSH",
"operand": "__s_0"
},
{
"op": "COPY"
},
{
"op": "PUSH",
"operand": "__constant_1"
},
{
"op": "PUSH",
"operand": "__i_0"
},
{
"op": "COPY"
},
{
"op": "JUMP",
"operand": "_loop"
}
]
},
{
"name": "_loop",
"export": false,
"instructions": [
{
"op": "PUSH",
"operand": "__i_0"
},
{
"op": "PUSH",
"operand": "__constant_1000"
},
{
"op": "EXTERN",
"signature": "SystemInt32.__op_LessThanOrEqual__SystemInt32_SystemInt32__SystemBoolean",
"argumentCount": 2,
"return": "__condition_0"
},
{
"op": "JUMP_IF_FALSE",
"operand": "_end"
},
{
"op": "PUSH",
"operand": "__s_0"
},
{
"op": "PUSH",
"operand": "__i_0"
},
{
"op": "EXTERN",
"signature": "SystemInt32.__op_Addition__SystemInt32_SystemInt32__SystemInt32",
"argumentCount": 2,
"return": "__s_next_0"
},
{
"op": "PUSH",
"operand": "__s_0"
},
{
"op": "COPY"
},
{
"op": "PUSH",
"operand": "__i_0"
},
{
"op": "PUSH",
"operand": "__constant_1"
},
{
"op": "EXTERN",
"signature": "SystemInt32.__op_Addition__SystemInt32_SystemInt32__SystemInt32",
"argumentCount": 2,
"return": "__i_next_0"
},
{
"op": "PUSH",
"operand": "__i_0"
},
{
"op": "COPY"
},
{
"op": "JUMP",
"operand": "_loop"
}
]
},
{
"name": "_end",
"export": false,
"instructions": [
{
"op": "PUSH",
"operand": "__sum_prefix_0"
},
{
"op": "PUSH",
"operand": "__s_0"
},
{
"op": "EXTERN",
"signature": "SystemString.__Concat__SystemObject_SystemObject__SystemString",
"argumentCount": 2,
"return": "__message_0"
},
{
"op": "EXTERN",
"signature": "UnityEngineDebug.__Log__SystemObject__SystemVoid",
"argumentCount": 1
}
]
}
]
}