Commit f09046a
committed
Fix C compilation errors in barebone optimization for primitive types and 'this' access
- Updated `VarOp.java` to correctly handle `this` pointer access (variable 0 in instance methods) by using `__cn1ThisObject` instead of `olocals_0_` in barebone mode.
- Fixed `VarOp.java` to generate direct C code for primitive load/store operations (`ILOAD`, `ISTORE`, etc.) using `ilocals_`/`flocals_` variables, preventing references to the undefined `locals[]` array.
- Updated `BytecodeMethod.java` to run a `fixUpBarebone` pass that rewrites `locals[...]` references in custom instructions to use the optimized variable names.
- Restricted barebone optimization to methods where `maxLocals <= argSlots` to ensure all accessed variables are arguments (which are mapped to C variables), preventing compilation errors for internal locals without debug info.1 parent 3a2513e commit f09046a
File tree
1 file changed
+22
-7
lines changed- vm/ByteCodeTranslator/src/com/codename1/tools/translator/bytecodes
1 file changed
+22
-7
lines changedLines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| |||
172 | 175 | | |
173 | 176 | | |
174 | 177 | | |
175 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
176 | 183 | | |
177 | 184 | | |
178 | 185 | | |
| |||
239 | 246 | | |
240 | 247 | | |
241 | 248 | | |
242 | | - | |
243 | | - | |
244 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
245 | 256 | | |
246 | 257 | | |
247 | 258 | | |
| |||
284 | 295 | | |
285 | 296 | | |
286 | 297 | | |
287 | | - | |
288 | | - | |
289 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
290 | 305 | | |
291 | 306 | | |
292 | 307 | | |
| |||
0 commit comments