diff options
| -rw-r--r-- | src/Makefile | 36 | ||||
| -rw-r--r-- | src/buildvm.c | 3 | ||||
| -rw-r--r-- | src/buildvm_ppcspe.h | 1100 | ||||
| -rw-r--r-- | src/lib_jit.c | 4 |
4 files changed, 1122 insertions, 21 deletions
diff --git a/src/Makefile b/src/Makefile index ed5f0bf5..24d32656 100644 --- a/src/Makefile +++ b/src/Makefile | |||
| @@ -257,6 +257,7 @@ DASM_DISTFLAGS= -LN | |||
| 257 | DASM_FLAGS_X86= | 257 | DASM_FLAGS_X86= |
| 258 | DASM_FLAGS_X64= -D X64 | 258 | DASM_FLAGS_X64= -D X64 |
| 259 | DASM_FLAGS_X64WIN= -D X64 -D X64WIN | 259 | DASM_FLAGS_X64WIN= -D X64 -D X64WIN |
| 260 | DASM_FLAGS_PPCSPE= -D SPE | ||
| 260 | 261 | ||
| 261 | BUILDVM_O= buildvm.o buildvm_asm.o buildvm_peobj.o buildvm_lib.o buildvm_fold.o | 262 | BUILDVM_O= buildvm.o buildvm_asm.o buildvm_peobj.o buildvm_lib.o buildvm_fold.o |
| 262 | BUILDVM_T= buildvm | 263 | BUILDVM_T= buildvm |
| @@ -296,9 +297,9 @@ LUAJIT_SO= libluajit.so | |||
| 296 | LUAJIT_T= luajit | 297 | LUAJIT_T= luajit |
| 297 | 298 | ||
| 298 | ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(BUILDVM_T) | 299 | ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(BUILDVM_T) |
| 299 | ALL_GEN= $(LJVM_S) lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h \ | 300 | ALL_HDRGEN= lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h |
| 300 | $(LIB_VMDEFP) lj_folddef.h | 301 | ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP) |
| 301 | ALL_DYNGEN= buildvm_*.h | 302 | ALL_DYNGEN= buildvm_x86.h buildvm_x64.h buildvm_x64win.h buildvm_ppcspe.h |
| 302 | WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk | 303 | WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk |
| 303 | ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM) | 304 | ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM) |
| 304 | 305 | ||
| @@ -381,28 +382,19 @@ distclean: clean | |||
| 381 | $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X86) -o buildvm_x86.h buildvm_x86.dasc | 382 | $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X86) -o buildvm_x86.h buildvm_x86.dasc |
| 382 | $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X64) -o buildvm_x64.h buildvm_x86.dasc | 383 | $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X64) -o buildvm_x64.h buildvm_x86.dasc |
| 383 | $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X64WIN) -o buildvm_x64win.h buildvm_x86.dasc | 384 | $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X64WIN) -o buildvm_x64win.h buildvm_x86.dasc |
| 385 | $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_PPCSPE) -o buildvm_ppcspe.h buildvm_ppc.dasc | ||
| 384 | 386 | ||
| 385 | depend: | 387 | depend: |
| 386 | @test -f lj_bcdef.h || touch lj_bcdef.h | 388 | @for file in $(ALL_HDRGEN) $(ALL_DYNGEN); do \ |
| 387 | @test -f lj_ffdef.h || touch lj_ffdef.h | 389 | test -f $$file || touch $$file; \ |
| 388 | @test -f lj_libdef.h || touch lj_libdef.h | 390 | done |
| 389 | @test -f lj_recdef.h || touch lj_recdef.h | ||
| 390 | @test -f lj_folddef.h || touch lj_folddef.h | ||
| 391 | @test -f buildvm_x86.h || touch buildvm_x86.h | ||
| 392 | @test -f buildvm_x64.h || touch buildvm_x64.h | ||
| 393 | @test -f buildvm_x64win.h || touch buildvm_x64win.h | ||
| 394 | @$(HOST_CC) $(HOST_ACFLAGS) -MM *.c | \ | 391 | @$(HOST_CC) $(HOST_ACFLAGS) -MM *.c | \ |
| 395 | sed -e "s| [^ ]*/dasm_\S*\.h||g" \ | 392 | sed -e "s| [^ ]*/dasm_\S*\.h||g" \ |
| 396 | -e "s| buildvm_\S*\.h||g" \ | 393 | -e "s| buildvm_\S*\.h||g" \ |
| 397 | -e "s| lj_target_\S*\.h| lj_target_*.h|g" >Makefile.dep | 394 | -e "s| lj_target_\S*\.h| lj_target_*.h|g" >Makefile.dep |
| 398 | @test -s lj_bcdef.h || $(HOST_RM) lj_bcdef.h | 395 | @for file in $(ALL_HDRGEN) $(ALL_DYNGEN); do \ |
| 399 | @test -s lj_ffdef.h || $(HOST_RM) lj_ffdef.h | 396 | test -s $$file || $(HOST_RM) $$file; \ |
| 400 | @test -s lj_libdef.h || $(HOST_RM) lj_libdef.h | 397 | done |
| 401 | @test -s lj_recdef.h || $(HOST_RM) lj_recdef.h | ||
| 402 | @test -s lj_folddef.h || $(HOST_RM) lj_folddef.h | ||
| 403 | @test -s buildvm_x86.h || $(HOST_RM) buildvm_x86.h | ||
| 404 | @test -s buildvm_x64.h || $(HOST_RM) buildvm_x64.h | ||
| 405 | @test -s buildvm_x64win.h || $(HOST_RM) buildvm_x64win.h | ||
| 406 | 398 | ||
| 407 | .PHONY: default all amalg clean cleaner distclean depend | 399 | .PHONY: default all amalg clean cleaner distclean depend |
| 408 | 400 | ||
| @@ -422,7 +414,11 @@ buildvm_x64win.h: buildvm_x86.dasc | |||
| 422 | $(E) "DYNASM $@" | 414 | $(E) "DYNASM $@" |
| 423 | $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_X64WIN) -o $@ buildvm_x86.dasc | 415 | $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_X64WIN) -o $@ buildvm_x86.dasc |
| 424 | 416 | ||
| 425 | buildvm.o: buildvm_x86.h buildvm_x64.h buildvm_x64win.h $(DASM_DIR)/dasm_*.h | 417 | buildvm_ppcspe.h: buildvm_ppc.dasc |
| 418 | $(E) "DYNASM $@" | ||
| 419 | $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_PPCSPE) -o $@ buildvm_ppc.dasc | ||
| 420 | |||
| 421 | buildvm.o: $(ALL_DYNGEN) $(DASM_DIR)/dasm_*.h | ||
| 426 | 422 | ||
| 427 | $(BUILDVM_T): $(BUILDVM_O) | 423 | $(BUILDVM_T): $(BUILDVM_O) |
| 428 | $(E) "HOSTLINK $@" | 424 | $(E) "HOSTLINK $@" |
diff --git a/src/buildvm.c b/src/buildvm.c index b11dbbea..c2011070 100644 --- a/src/buildvm.c +++ b/src/buildvm.c | |||
| @@ -73,6 +73,9 @@ static int collect_reloc(BuildCtx *ctx, uint8_t *addr, int idx, int type); | |||
| 73 | #else | 73 | #else |
| 74 | #include "buildvm_x64.h" | 74 | #include "buildvm_x64.h" |
| 75 | #endif | 75 | #endif |
| 76 | #elif LJ_TARGET_PPCSPE | ||
| 77 | #include "../dynasm/dasm_ppc.h" | ||
| 78 | #include "buildvm_ppcspe.h" | ||
| 76 | #else | 79 | #else |
| 77 | #error "No support for this architecture (yet)" | 80 | #error "No support for this architecture (yet)" |
| 78 | #endif | 81 | #endif |
diff --git a/src/buildvm_ppcspe.h b/src/buildvm_ppcspe.h new file mode 100644 index 00000000..9a066bc6 --- /dev/null +++ b/src/buildvm_ppcspe.h | |||
| @@ -0,0 +1,1100 @@ | |||
| 1 | /* | ||
| 2 | ** This file has been pre-processed with DynASM. | ||
| 3 | ** http://luajit.org/dynasm.html | ||
| 4 | ** DynASM version 1.2.1, DynASM ppc version 1.2.1 | ||
| 5 | ** DO NOT EDIT! The original file is in "buildvm_ppc.dasc". | ||
| 6 | */ | ||
| 7 | |||
| 8 | #if DASM_VERSION != 10201 | ||
| 9 | #error "Version mismatch between DynASM and included encoding engine" | ||
| 10 | #endif | ||
| 11 | |||
| 12 | #define DASM_SECTION_CODE_OP 0 | ||
| 13 | #define DASM_SECTION_CODE_SUB 1 | ||
| 14 | #define DASM_MAXSECTION 2 | ||
| 15 | static const unsigned int build_actionlist[462] = { | ||
| 16 | 0x00010001, | ||
| 17 | 0x00060014, | ||
| 18 | 0x7c810808, | ||
| 19 | 0x00060015, | ||
| 20 | 0x7c810808, | ||
| 21 | 0x00060016, | ||
| 22 | 0x7c810808, | ||
| 23 | 0x00060017, | ||
| 24 | 0x7c810808, | ||
| 25 | 0x00060018, | ||
| 26 | 0x7c810808, | ||
| 27 | 0x00060019, | ||
| 28 | 0x7c810808, | ||
| 29 | 0x0006001a, | ||
| 30 | 0x7c810808, | ||
| 31 | 0x0006001b, | ||
| 32 | 0x7c810808, | ||
| 33 | 0x0006001c, | ||
| 34 | 0x7c810808, | ||
| 35 | 0x0006001d, | ||
| 36 | 0x7c810808, | ||
| 37 | 0x0006001e, | ||
| 38 | 0x7c810808, | ||
| 39 | 0x0006001f, | ||
| 40 | 0x7c810808, | ||
| 41 | 0x00060020, | ||
| 42 | 0x7c810808, | ||
| 43 | 0x00060021, | ||
| 44 | 0x7c810808, | ||
| 45 | 0x00060022, | ||
| 46 | 0x7c810808, | ||
| 47 | 0x00060023, | ||
| 48 | 0x7c810808, | ||
| 49 | 0x00060024, | ||
| 50 | 0x7c810808, | ||
| 51 | 0x00060025, | ||
| 52 | 0x7c810808, | ||
| 53 | 0x00060026, | ||
| 54 | 0x7c810808, | ||
| 55 | 0x00060027, | ||
| 56 | 0x7c810808, | ||
| 57 | 0x00060028, | ||
| 58 | 0x7c810808, | ||
| 59 | 0x00060029, | ||
| 60 | 0x00000000, | ||
| 61 | 0x7c810808, | ||
| 62 | 0x0006002a, | ||
| 63 | 0x7c810808, | ||
| 64 | 0x0006002b, | ||
| 65 | 0x7c810808, | ||
| 66 | 0x0006002c, | ||
| 67 | 0x7c810808, | ||
| 68 | 0x0006002d, | ||
| 69 | 0x7c810808, | ||
| 70 | 0x0006002e, | ||
| 71 | 0x7c810808, | ||
| 72 | 0x0006002f, | ||
| 73 | 0x7c810808, | ||
| 74 | 0x00060030, | ||
| 75 | 0x7c810808, | ||
| 76 | 0x00060031, | ||
| 77 | 0x7c810808, | ||
| 78 | 0x00060032, | ||
| 79 | 0x7c810808, | ||
| 80 | 0x00060033, | ||
| 81 | 0x7c810808, | ||
| 82 | 0x00060034, | ||
| 83 | 0x7c810808, | ||
| 84 | 0x00060035, | ||
| 85 | 0x7c810808, | ||
| 86 | 0x00060036, | ||
| 87 | 0x7c810808, | ||
| 88 | 0x00060037, | ||
| 89 | 0x7c810808, | ||
| 90 | 0x00060038, | ||
| 91 | 0x7c810808, | ||
| 92 | 0x00060039, | ||
| 93 | 0x7c810808, | ||
| 94 | 0x0006003a, | ||
| 95 | 0x7c810808, | ||
| 96 | 0x0006003b, | ||
| 97 | 0x7c810808, | ||
| 98 | 0x0006003c, | ||
| 99 | 0x7c810808, | ||
| 100 | 0x0006003d, | ||
| 101 | 0x7c810808, | ||
| 102 | 0x0006003e, | ||
| 103 | 0x7c810808, | ||
| 104 | 0x7c810808, | ||
| 105 | 0x0006003f, | ||
| 106 | 0x00000000, | ||
| 107 | 0x7c810808, | ||
| 108 | 0x7c810808, | ||
| 109 | 0x00060040, | ||
| 110 | 0x7c810808, | ||
| 111 | 0x7c810808, | ||
| 112 | 0x00060041, | ||
| 113 | 0x7c810808, | ||
| 114 | 0x00060042, | ||
| 115 | 0x7c810808, | ||
| 116 | 0x7c810808, | ||
| 117 | 0x00060043, | ||
| 118 | 0x7c810808, | ||
| 119 | 0x7c810808, | ||
| 120 | 0x00060044, | ||
| 121 | 0x7c810808, | ||
| 122 | 0x00060045, | ||
| 123 | 0x7c810808, | ||
| 124 | 0x7c810808, | ||
| 125 | 0x00060046, | ||
| 126 | 0x7c810808, | ||
| 127 | 0x7c810808, | ||
| 128 | 0x00060047, | ||
| 129 | 0x7c810808, | ||
| 130 | 0x00060048, | ||
| 131 | 0x7c810808, | ||
| 132 | 0x7c810808, | ||
| 133 | 0x00060049, | ||
| 134 | 0x7c810808, | ||
| 135 | 0x7c810808, | ||
| 136 | 0x0006004a, | ||
| 137 | 0x7c810808, | ||
| 138 | 0x7c810808, | ||
| 139 | 0x0006004b, | ||
| 140 | 0x7c810808, | ||
| 141 | 0x7c810808, | ||
| 142 | 0x0006004c, | ||
| 143 | 0x7c810808, | ||
| 144 | 0x0006004d, | ||
| 145 | 0x7c810808, | ||
| 146 | 0x0006004e, | ||
| 147 | 0x7c810808, | ||
| 148 | 0x7c810808, | ||
| 149 | 0x7c810808, | ||
| 150 | 0x0006004f, | ||
| 151 | 0x7c810808, | ||
| 152 | 0x00060050, | ||
| 153 | 0x7c810808, | ||
| 154 | 0x00060051, | ||
| 155 | 0x7c810808, | ||
| 156 | 0x00060052, | ||
| 157 | 0x7c810808, | ||
| 158 | 0x00060053, | ||
| 159 | 0x7c810808, | ||
| 160 | 0x00060054, | ||
| 161 | 0x7c810808, | ||
| 162 | 0x00060055, | ||
| 163 | 0x00000000, | ||
| 164 | 0x7c810808, | ||
| 165 | 0x00060056, | ||
| 166 | 0x7c810808, | ||
| 167 | 0x00060057, | ||
| 168 | 0x7c810808, | ||
| 169 | 0x00060058, | ||
| 170 | 0x7c810808, | ||
| 171 | 0x00060059, | ||
| 172 | 0x7c810808, | ||
| 173 | 0x0006005a, | ||
| 174 | 0x7c810808, | ||
| 175 | 0x0006005b, | ||
| 176 | 0x7c810808, | ||
| 177 | 0x0006005c, | ||
| 178 | 0x7c810808, | ||
| 179 | 0x0006005d, | ||
| 180 | 0x7c810808, | ||
| 181 | 0x0006005e, | ||
| 182 | 0x7c810808, | ||
| 183 | 0x0006005f, | ||
| 184 | 0x7c810808, | ||
| 185 | 0x00060060, | ||
| 186 | 0x7c810808, | ||
| 187 | 0x00060061, | ||
| 188 | 0x7c810808, | ||
| 189 | 0x00060062, | ||
| 190 | 0x00060063, | ||
| 191 | 0x7c810808, | ||
| 192 | 0x7c810808, | ||
| 193 | 0x00060064, | ||
| 194 | 0x7c810808, | ||
| 195 | 0x7c810808, | ||
| 196 | 0x7c810808, | ||
| 197 | 0x00060065, | ||
| 198 | 0x7c810808, | ||
| 199 | 0x7c810808, | ||
| 200 | 0x7c810808, | ||
| 201 | 0x00060066, | ||
| 202 | 0x7c810808, | ||
| 203 | 0x7c810808, | ||
| 204 | 0x7c810808, | ||
| 205 | 0x00060067, | ||
| 206 | 0x7c810808, | ||
| 207 | 0x7c810808, | ||
| 208 | 0x7c810808, | ||
| 209 | 0x00060068, | ||
| 210 | 0x7c810808, | ||
| 211 | 0x7c810808, | ||
| 212 | 0x00060069, | ||
| 213 | 0x7c810808, | ||
| 214 | 0x7c810808, | ||
| 215 | 0x0006006a, | ||
| 216 | 0x7c810808, | ||
| 217 | 0x7c810808, | ||
| 218 | 0x0006006b, | ||
| 219 | 0x00000000, | ||
| 220 | 0x7c810808, | ||
| 221 | 0x0006006c, | ||
| 222 | 0x7c810808, | ||
| 223 | 0x0006006d, | ||
| 224 | 0x7c810808, | ||
| 225 | 0x0006006e, | ||
| 226 | 0x7c810808, | ||
| 227 | 0x0006006f, | ||
| 228 | 0x7c810808, | ||
| 229 | 0x00060070, | ||
| 230 | 0x7c810808, | ||
| 231 | 0x7c810808, | ||
| 232 | 0x00060071, | ||
| 233 | 0x7c810808, | ||
| 234 | 0x7c810808, | ||
| 235 | 0x00060072, | ||
| 236 | 0x7c810808, | ||
| 237 | 0x7c810808, | ||
| 238 | 0x00060073, | ||
| 239 | 0x7c810808, | ||
| 240 | 0x7c810808, | ||
| 241 | 0x00060074, | ||
| 242 | 0x7c810808, | ||
| 243 | 0x7c810808, | ||
| 244 | 0x00060075, | ||
| 245 | 0x7c810808, | ||
| 246 | 0x7c810808, | ||
| 247 | 0x7c810808, | ||
| 248 | 0x00060076, | ||
| 249 | 0x7c810808, | ||
| 250 | 0x7c810808, | ||
| 251 | 0x7c810808, | ||
| 252 | 0x7c810808, | ||
| 253 | 0x00060077, | ||
| 254 | 0x7c810808, | ||
| 255 | 0x7c810808, | ||
| 256 | 0x7c810808, | ||
| 257 | 0x7c810808, | ||
| 258 | 0x00060078, | ||
| 259 | 0x7c810808, | ||
| 260 | 0x7c810808, | ||
| 261 | 0x7c810808, | ||
| 262 | 0x7c810808, | ||
| 263 | 0x00060079, | ||
| 264 | 0x7c810808, | ||
| 265 | 0x7c810808, | ||
| 266 | 0x7c810808, | ||
| 267 | 0x7c810808, | ||
| 268 | 0x0006007a, | ||
| 269 | 0x7c810808, | ||
| 270 | 0x7c810808, | ||
| 271 | 0x7c810808, | ||
| 272 | 0x7c810808, | ||
| 273 | 0x0006007b, | ||
| 274 | 0x7c810808, | ||
| 275 | 0x0006007c, | ||
| 276 | 0x7c810808, | ||
| 277 | 0x0006007d, | ||
| 278 | 0x7c810808, | ||
| 279 | 0x7c810808, | ||
| 280 | 0x7c810808, | ||
| 281 | 0x0006007e, | ||
| 282 | 0x7c810808, | ||
| 283 | 0x7c810808, | ||
| 284 | 0x7c810808, | ||
| 285 | 0x0006007f, | ||
| 286 | 0x7c810808, | ||
| 287 | 0x7c810808, | ||
| 288 | 0x7c810808, | ||
| 289 | 0x00060080, | ||
| 290 | 0x7c810808, | ||
| 291 | 0x7c810808, | ||
| 292 | 0x7c810808, | ||
| 293 | 0x00060081, | ||
| 294 | 0x00000000, | ||
| 295 | 0x7c810808, | ||
| 296 | 0x7c810808, | ||
| 297 | 0x7c810808, | ||
| 298 | 0x00060082, | ||
| 299 | 0x7c810808, | ||
| 300 | 0x00060083, | ||
| 301 | 0x7c810808, | ||
| 302 | 0x00060084, | ||
| 303 | 0x00000000, | ||
| 304 | 0x7c810808, | ||
| 305 | 0x00000000, | ||
| 306 | 0x00060085, | ||
| 307 | 0x7c810808, | ||
| 308 | 0x00060086, | ||
| 309 | 0x7c810808, | ||
| 310 | 0x00060087, | ||
| 311 | 0x7c810808, | ||
| 312 | 0x00060088, | ||
| 313 | 0x00000000, | ||
| 314 | 0x7c810808, | ||
| 315 | 0x00000000, | ||
| 316 | 0x00060089, | ||
| 317 | 0x7c810808, | ||
| 318 | 0x0006008a, | ||
| 319 | 0x00000000, | ||
| 320 | 0x7c810808, | ||
| 321 | 0x00000000, | ||
| 322 | 0x0006008b, | ||
| 323 | 0x00000000, | ||
| 324 | 0x7c810808, | ||
| 325 | 0x00000000, | ||
| 326 | 0x0006008c, | ||
| 327 | 0x00000000, | ||
| 328 | 0x7c810808, | ||
| 329 | 0x00000000, | ||
| 330 | 0x0006008d, | ||
| 331 | 0x7c810808, | ||
| 332 | 0x0006008e, | ||
| 333 | 0x7c810808, | ||
| 334 | 0x0006008f, | ||
| 335 | 0x7c810808, | ||
| 336 | 0x00060090, | ||
| 337 | 0x7c810808, | ||
| 338 | 0x00060091, | ||
| 339 | 0x7c810808, | ||
| 340 | 0x00060092, | ||
| 341 | 0x7c810808, | ||
| 342 | 0x00060093, | ||
| 343 | 0x7c810808, | ||
| 344 | 0x00060094, | ||
| 345 | 0x7c810808, | ||
| 346 | 0x00060095, | ||
| 347 | 0x7c810808, | ||
| 348 | 0x00060096, | ||
| 349 | 0x7c810808, | ||
| 350 | 0x00000000, | ||
| 351 | 0x00080000, | ||
| 352 | 0x00000000, | ||
| 353 | 0x7c810808, | ||
| 354 | 0x00000000, | ||
| 355 | 0x7c810808, | ||
| 356 | 0x00000000, | ||
| 357 | 0x7c810808, | ||
| 358 | 0x00000000, | ||
| 359 | 0x7c810808, | ||
| 360 | 0x00000000, | ||
| 361 | 0x7c810808, | ||
| 362 | 0x00000000, | ||
| 363 | 0x7c810808, | ||
| 364 | 0x00000000, | ||
| 365 | 0x7c810808, | ||
| 366 | 0x00000000, | ||
| 367 | 0x7c810808, | ||
| 368 | 0x00000000, | ||
| 369 | 0x7c810808, | ||
| 370 | 0x00000000, | ||
| 371 | 0x7c810808, | ||
| 372 | 0x00000000, | ||
| 373 | 0x7c810808, | ||
| 374 | 0x00000000, | ||
| 375 | 0x7c810808, | ||
| 376 | 0x00000000, | ||
| 377 | 0x7c810808, | ||
| 378 | 0x00000000, | ||
| 379 | 0x7c810808, | ||
| 380 | 0x00000000, | ||
| 381 | 0x7c810808, | ||
| 382 | 0x00000000, | ||
| 383 | 0x7c810808, | ||
| 384 | 0x00000000, | ||
| 385 | 0x7c810808, | ||
| 386 | 0x00000000, | ||
| 387 | 0x7c810808, | ||
| 388 | 0x00000000, | ||
| 389 | 0x7c810808, | ||
| 390 | 0x00000000, | ||
| 391 | 0x7c810808, | ||
| 392 | 0x00000000, | ||
| 393 | 0x7c810808, | ||
| 394 | 0x00000000, | ||
| 395 | 0x7c810808, | ||
| 396 | 0x00000000, | ||
| 397 | 0x7c810808, | ||
| 398 | 0x00000000, | ||
| 399 | 0x7c810808, | ||
| 400 | 0x00000000, | ||
| 401 | 0x7c810808, | ||
| 402 | 0x00000000, | ||
| 403 | 0x7c810808, | ||
| 404 | 0x00000000, | ||
| 405 | 0x7c810808, | ||
| 406 | 0x00000000, | ||
| 407 | 0x7c810808, | ||
| 408 | 0x00000000, | ||
| 409 | 0x7c810808, | ||
| 410 | 0x00000000, | ||
| 411 | 0x7c810808, | ||
| 412 | 0x00000000, | ||
| 413 | 0x7c810808, | ||
| 414 | 0x00000000, | ||
| 415 | 0x7c810808, | ||
| 416 | 0x00000000, | ||
| 417 | 0x7c810808, | ||
| 418 | 0x00000000, | ||
| 419 | 0x7c810808, | ||
| 420 | 0x00000000, | ||
| 421 | 0x7c810808, | ||
| 422 | 0x00000000, | ||
| 423 | 0x7c810808, | ||
| 424 | 0x00000000, | ||
| 425 | 0x7c810808, | ||
| 426 | 0x00000000, | ||
| 427 | 0x7c810808, | ||
| 428 | 0x00000000, | ||
| 429 | 0x7c810808, | ||
| 430 | 0x00000000, | ||
| 431 | 0x7c810808, | ||
| 432 | 0x00000000, | ||
| 433 | 0x7c810808, | ||
| 434 | 0x00000000, | ||
| 435 | 0x7c810808, | ||
| 436 | 0x00000000, | ||
| 437 | 0x7c810808, | ||
| 438 | 0x00000000, | ||
| 439 | 0x7c810808, | ||
| 440 | 0x00000000, | ||
| 441 | 0x7c810808, | ||
| 442 | 0x00000000, | ||
| 443 | 0x7c810808, | ||
| 444 | 0x00000000, | ||
| 445 | 0x7c810808, | ||
| 446 | 0x00000000, | ||
| 447 | 0x7c810808, | ||
| 448 | 0x00000000, | ||
| 449 | 0x7c810808, | ||
| 450 | 0x00000000, | ||
| 451 | 0x7c810808, | ||
| 452 | 0x00000000, | ||
| 453 | 0x7c810808, | ||
| 454 | 0x00000000, | ||
| 455 | 0x7c810808, | ||
| 456 | 0x00000000, | ||
| 457 | 0x7c810808, | ||
| 458 | 0x00000000, | ||
| 459 | 0x7c810808, | ||
| 460 | 0x00000000, | ||
| 461 | 0x7c810808, | ||
| 462 | 0x00000000, | ||
| 463 | 0x7c810808, | ||
| 464 | 0x00000000, | ||
| 465 | 0x7c810808, | ||
| 466 | 0x00000000, | ||
| 467 | 0x7c810808, | ||
| 468 | 0x00000000, | ||
| 469 | 0x7c810808, | ||
| 470 | 0x00000000, | ||
| 471 | 0x7c810808, | ||
| 472 | 0x00000000, | ||
| 473 | 0x7c810808, | ||
| 474 | 0x00000000, | ||
| 475 | 0x7c810808, | ||
| 476 | 0x00000000, | ||
| 477 | 0x00010000 | ||
| 478 | }; | ||
| 479 | |||
| 480 | enum { | ||
| 481 | GLOB_vm_returnp, | ||
| 482 | GLOB_vm_returnc, | ||
| 483 | GLOB_vm_return, | ||
| 484 | GLOB_vm_leave_cp, | ||
| 485 | GLOB_vm_leave_unw, | ||
| 486 | GLOB_vm_unwind_c, | ||
| 487 | GLOB_vm_unwind_c_eh, | ||
| 488 | GLOB_vm_unwind_ff, | ||
| 489 | GLOB_vm_unwind_ff_eh, | ||
| 490 | GLOB_vm_growstack_c, | ||
| 491 | GLOB_vm_growstack_l, | ||
| 492 | GLOB_vm_resume, | ||
| 493 | GLOB_vm_pcall, | ||
| 494 | GLOB_vm_call, | ||
| 495 | GLOB_vm_call_dispatch, | ||
| 496 | GLOB_vm_call_dispatch_f, | ||
| 497 | GLOB_vm_cpcall, | ||
| 498 | GLOB_cont_dispatch, | ||
| 499 | GLOB_cont_cat, | ||
| 500 | GLOB_vmeta_tgets, | ||
| 501 | GLOB_vmeta_tgetb, | ||
| 502 | GLOB_vmeta_tgetv, | ||
| 503 | GLOB_vmeta_tsets, | ||
| 504 | GLOB_vmeta_tsetb, | ||
| 505 | GLOB_vmeta_tsetv, | ||
| 506 | GLOB_vmeta_comp, | ||
| 507 | GLOB_cont_nop, | ||
| 508 | GLOB_cont_ra, | ||
| 509 | GLOB_cont_condt, | ||
| 510 | GLOB_cont_condf, | ||
| 511 | GLOB_vmeta_equal, | ||
| 512 | GLOB_vmeta_arith_vn, | ||
| 513 | GLOB_vmeta_arith_nv, | ||
| 514 | GLOB_vmeta_unm, | ||
| 515 | GLOB_vmeta_arith_vv, | ||
| 516 | GLOB_vmeta_binop, | ||
| 517 | GLOB_vmeta_len, | ||
| 518 | GLOB_vmeta_call_ra, | ||
| 519 | GLOB_vmeta_call, | ||
| 520 | GLOB_vmeta_for, | ||
| 521 | GLOB_ff_assert, | ||
| 522 | GLOB_ff_type, | ||
| 523 | GLOB_ff_getmetatable, | ||
| 524 | GLOB_ff_setmetatable, | ||
| 525 | GLOB_ff_rawget, | ||
| 526 | GLOB_ff_tonumber, | ||
| 527 | GLOB_ff_tostring, | ||
| 528 | GLOB_ff_next, | ||
| 529 | GLOB_fff_res2, | ||
| 530 | GLOB_ff_pairs, | ||
| 531 | GLOB_ff_ipairs_aux, | ||
| 532 | GLOB_fff_res0, | ||
| 533 | GLOB_ff_ipairs, | ||
| 534 | GLOB_ff_pcall, | ||
| 535 | GLOB_ff_xpcall, | ||
| 536 | GLOB_ff_coroutine_resume, | ||
| 537 | GLOB_ff_coroutine_wrap_aux, | ||
| 538 | GLOB_ff_coroutine_yield, | ||
| 539 | GLOB_ff_math_abs, | ||
| 540 | GLOB_fff_res1, | ||
| 541 | GLOB_fff_res, | ||
| 542 | GLOB_ff_math_floor, | ||
| 543 | GLOB_ff_math_ceil, | ||
| 544 | GLOB_ff_math_sqrt, | ||
| 545 | GLOB_ff_math_log, | ||
| 546 | GLOB_ff_math_log10, | ||
| 547 | GLOB_ff_math_exp, | ||
| 548 | GLOB_ff_math_sin, | ||
| 549 | GLOB_ff_math_cos, | ||
| 550 | GLOB_ff_math_tan, | ||
| 551 | GLOB_ff_math_asin, | ||
| 552 | GLOB_ff_math_acos, | ||
| 553 | GLOB_ff_math_atan, | ||
| 554 | GLOB_ff_math_sinh, | ||
| 555 | GLOB_ff_math_cosh, | ||
| 556 | GLOB_ff_math_tanh, | ||
| 557 | GLOB_ff_math_atan2, | ||
| 558 | GLOB_ff_math_fmod, | ||
| 559 | GLOB_ff_math_deg, | ||
| 560 | GLOB_ff_math_rad, | ||
| 561 | GLOB_ff_math_ldexp, | ||
| 562 | GLOB_ff_math_frexp, | ||
| 563 | GLOB_ff_math_modf, | ||
| 564 | GLOB_ff_math_pow, | ||
| 565 | GLOB_ff_math_min, | ||
| 566 | GLOB_ff_math_max, | ||
| 567 | GLOB_ff_string_len, | ||
| 568 | GLOB_ff_string_byte, | ||
| 569 | GLOB_ff_string_char, | ||
| 570 | GLOB_fff_newstr, | ||
| 571 | GLOB_ff_string_sub, | ||
| 572 | GLOB_fff_emptystr, | ||
| 573 | GLOB_ff_string_rep, | ||
| 574 | GLOB_ff_string_reverse, | ||
| 575 | GLOB_ff_string_lower, | ||
| 576 | GLOB_ff_string_upper, | ||
| 577 | GLOB_ff_table_getn, | ||
| 578 | GLOB_ff_bit_tobit, | ||
| 579 | GLOB_ff_bit_band, | ||
| 580 | GLOB_ff_bit_bor, | ||
| 581 | GLOB_ff_bit_bxor, | ||
| 582 | GLOB_ff_bit_bswap, | ||
| 583 | GLOB_ff_bit_bnot, | ||
| 584 | GLOB_fff_resbit, | ||
| 585 | GLOB_fff_fallback_bit_op, | ||
| 586 | GLOB_ff_bit_lshift, | ||
| 587 | GLOB_ff_bit_rshift, | ||
| 588 | GLOB_ff_bit_arshift, | ||
| 589 | GLOB_ff_bit_rol, | ||
| 590 | GLOB_ff_bit_ror, | ||
| 591 | GLOB_fff_fallback, | ||
| 592 | GLOB_fff_gcstep, | ||
| 593 | GLOB_vm_record, | ||
| 594 | GLOB_vm_rethook, | ||
| 595 | GLOB_vm_inshook, | ||
| 596 | GLOB_cont_hook, | ||
| 597 | GLOB_vm_hotloop, | ||
| 598 | GLOB_vm_callhook, | ||
| 599 | GLOB_vm_hotcall, | ||
| 600 | GLOB_vm_exit_handler, | ||
| 601 | GLOB_vm_exit_interp, | ||
| 602 | GLOB_vm_floor, | ||
| 603 | GLOB_vm_ceil, | ||
| 604 | GLOB_vm_trunc, | ||
| 605 | GLOB_vm_mod, | ||
| 606 | GLOB_vm_exp, | ||
| 607 | GLOB_vm_exp2, | ||
| 608 | GLOB_vm_pow, | ||
| 609 | GLOB_vm_powi_sse, | ||
| 610 | GLOB_vm_foldfpm, | ||
| 611 | GLOB_vm_foldarith, | ||
| 612 | GLOB__MAX | ||
| 613 | }; | ||
| 614 | static const char *const globnames[] = { | ||
| 615 | "vm_returnp", | ||
| 616 | "vm_returnc", | ||
| 617 | "vm_return", | ||
| 618 | "vm_leave_cp", | ||
| 619 | "vm_leave_unw", | ||
| 620 | "vm_unwind_c", | ||
| 621 | "vm_unwind_c_eh", | ||
| 622 | "vm_unwind_ff", | ||
| 623 | "vm_unwind_ff_eh", | ||
| 624 | "vm_growstack_c", | ||
| 625 | "vm_growstack_l", | ||
| 626 | "vm_resume", | ||
| 627 | "vm_pcall", | ||
| 628 | "vm_call", | ||
| 629 | "vm_call_dispatch", | ||
| 630 | "vm_call_dispatch_f", | ||
| 631 | "vm_cpcall", | ||
| 632 | "cont_dispatch", | ||
| 633 | "cont_cat", | ||
| 634 | "vmeta_tgets", | ||
| 635 | "vmeta_tgetb", | ||
| 636 | "vmeta_tgetv", | ||
| 637 | "vmeta_tsets", | ||
| 638 | "vmeta_tsetb", | ||
| 639 | "vmeta_tsetv", | ||
| 640 | "vmeta_comp", | ||
| 641 | "cont_nop", | ||
| 642 | "cont_ra", | ||
| 643 | "cont_condt", | ||
| 644 | "cont_condf", | ||
| 645 | "vmeta_equal", | ||
| 646 | "vmeta_arith_vn", | ||
| 647 | "vmeta_arith_nv", | ||
| 648 | "vmeta_unm", | ||
| 649 | "vmeta_arith_vv", | ||
| 650 | "vmeta_binop", | ||
| 651 | "vmeta_len", | ||
| 652 | "vmeta_call_ra", | ||
| 653 | "vmeta_call", | ||
| 654 | "vmeta_for", | ||
| 655 | "ff_assert", | ||
| 656 | "ff_type", | ||
| 657 | "ff_getmetatable", | ||
| 658 | "ff_setmetatable", | ||
| 659 | "ff_rawget", | ||
| 660 | "ff_tonumber", | ||
| 661 | "ff_tostring", | ||
| 662 | "ff_next", | ||
| 663 | "fff_res2", | ||
| 664 | "ff_pairs", | ||
| 665 | "ff_ipairs_aux", | ||
| 666 | "fff_res0", | ||
| 667 | "ff_ipairs", | ||
| 668 | "ff_pcall", | ||
| 669 | "ff_xpcall", | ||
| 670 | "ff_coroutine_resume", | ||
| 671 | "ff_coroutine_wrap_aux", | ||
| 672 | "ff_coroutine_yield", | ||
| 673 | "ff_math_abs", | ||
| 674 | "fff_res1", | ||
| 675 | "fff_res", | ||
| 676 | "ff_math_floor", | ||
| 677 | "ff_math_ceil", | ||
| 678 | "ff_math_sqrt", | ||
| 679 | "ff_math_log", | ||
| 680 | "ff_math_log10", | ||
| 681 | "ff_math_exp", | ||
| 682 | "ff_math_sin", | ||
| 683 | "ff_math_cos", | ||
| 684 | "ff_math_tan", | ||
| 685 | "ff_math_asin", | ||
| 686 | "ff_math_acos", | ||
| 687 | "ff_math_atan", | ||
| 688 | "ff_math_sinh", | ||
| 689 | "ff_math_cosh", | ||
| 690 | "ff_math_tanh", | ||
| 691 | "ff_math_atan2", | ||
| 692 | "ff_math_fmod", | ||
| 693 | "ff_math_deg", | ||
| 694 | "ff_math_rad", | ||
| 695 | "ff_math_ldexp", | ||
| 696 | "ff_math_frexp", | ||
| 697 | "ff_math_modf", | ||
| 698 | "ff_math_pow", | ||
| 699 | "ff_math_min", | ||
| 700 | "ff_math_max", | ||
| 701 | "ff_string_len", | ||
| 702 | "ff_string_byte", | ||
| 703 | "ff_string_char", | ||
| 704 | "fff_newstr", | ||
| 705 | "ff_string_sub", | ||
| 706 | "fff_emptystr", | ||
| 707 | "ff_string_rep", | ||
| 708 | "ff_string_reverse", | ||
| 709 | "ff_string_lower", | ||
| 710 | "ff_string_upper", | ||
| 711 | "ff_table_getn", | ||
| 712 | "ff_bit_tobit", | ||
| 713 | "ff_bit_band", | ||
| 714 | "ff_bit_bor", | ||
| 715 | "ff_bit_bxor", | ||
| 716 | "ff_bit_bswap", | ||
| 717 | "ff_bit_bnot", | ||
| 718 | "fff_resbit", | ||
| 719 | "fff_fallback_bit_op", | ||
| 720 | "ff_bit_lshift", | ||
| 721 | "ff_bit_rshift", | ||
| 722 | "ff_bit_arshift", | ||
| 723 | "ff_bit_rol", | ||
| 724 | "ff_bit_ror", | ||
| 725 | "fff_fallback", | ||
| 726 | "fff_gcstep", | ||
| 727 | "vm_record", | ||
| 728 | "vm_rethook", | ||
| 729 | "vm_inshook", | ||
| 730 | "cont_hook", | ||
| 731 | "vm_hotloop", | ||
| 732 | "vm_callhook", | ||
| 733 | "vm_hotcall", | ||
| 734 | "vm_exit_handler", | ||
| 735 | "vm_exit_interp", | ||
| 736 | "vm_floor", | ||
| 737 | "vm_ceil", | ||
| 738 | "vm_trunc", | ||
| 739 | "vm_mod", | ||
| 740 | "vm_exp", | ||
| 741 | "vm_exp2", | ||
| 742 | "vm_pow", | ||
| 743 | "vm_powi_sse", | ||
| 744 | "vm_foldfpm", | ||
| 745 | "vm_foldarith", | ||
| 746 | (const char *)0 | ||
| 747 | }; | ||
| 748 | static const char *const extnames[] = { | ||
| 749 | (const char *)0 | ||
| 750 | }; | ||
| 751 | #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field)) | ||
| 752 | #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field)) | ||
| 753 | #define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto)) | ||
| 754 | |||
| 755 | /* Generate subroutines used by opcodes and other parts of the VM. */ | ||
| 756 | /* The .code_sub section should be last to help static branch prediction. */ | ||
| 757 | static void build_subroutines(BuildCtx *ctx) | ||
| 758 | { | ||
| 759 | dasm_put(Dst, 0); | ||
| 760 | dasm_put(Dst, 1); | ||
| 761 | dasm_put(Dst, 45); | ||
| 762 | dasm_put(Dst, 91); | ||
| 763 | dasm_put(Dst, 148); | ||
| 764 | dasm_put(Dst, 204); | ||
| 765 | dasm_put(Dst, 279); | ||
| 766 | #if LJ_HASJIT | ||
| 767 | dasm_put(Dst, 288); | ||
| 768 | #endif | ||
| 769 | dasm_put(Dst, 290); | ||
| 770 | #if LJ_HASJIT | ||
| 771 | dasm_put(Dst, 298); | ||
| 772 | #endif | ||
| 773 | dasm_put(Dst, 300); | ||
| 774 | #if LJ_HASJIT | ||
| 775 | dasm_put(Dst, 304); | ||
| 776 | #endif | ||
| 777 | dasm_put(Dst, 306); | ||
| 778 | #if LJ_HASJIT | ||
| 779 | dasm_put(Dst, 308); | ||
| 780 | #endif | ||
| 781 | dasm_put(Dst, 310); | ||
| 782 | #if LJ_HASJIT | ||
| 783 | dasm_put(Dst, 312); | ||
| 784 | #endif | ||
| 785 | dasm_put(Dst, 314); | ||
| 786 | } | ||
| 787 | |||
| 788 | /* Generate the code for a single instruction. */ | ||
| 789 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) | ||
| 790 | { | ||
| 791 | dasm_put(Dst, 335, defop); | ||
| 792 | |||
| 793 | switch (op) { | ||
| 794 | |||
| 795 | /* -- Comparison ops ---------------------------------------------------- */ | ||
| 796 | |||
| 797 | /* Remember: all ops branch for a true comparison, fall through otherwise. */ | ||
| 798 | |||
| 799 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: | ||
| 800 | dasm_put(Dst, 337); | ||
| 801 | break; | ||
| 802 | |||
| 803 | case BC_ISEQV: case BC_ISNEV: | ||
| 804 | dasm_put(Dst, 339); | ||
| 805 | break; | ||
| 806 | |||
| 807 | case BC_ISEQS: case BC_ISNES: | ||
| 808 | dasm_put(Dst, 341); | ||
| 809 | break; | ||
| 810 | |||
| 811 | case BC_ISEQN: case BC_ISNEN: | ||
| 812 | dasm_put(Dst, 343); | ||
| 813 | break; | ||
| 814 | |||
| 815 | case BC_ISEQP: case BC_ISNEP: | ||
| 816 | dasm_put(Dst, 345); | ||
| 817 | break; | ||
| 818 | |||
| 819 | /* -- Unary test and copy ops ------------------------------------------- */ | ||
| 820 | |||
| 821 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: | ||
| 822 | dasm_put(Dst, 347); | ||
| 823 | break; | ||
| 824 | |||
| 825 | /* -- Unary ops --------------------------------------------------------- */ | ||
| 826 | |||
| 827 | case BC_MOV: | ||
| 828 | dasm_put(Dst, 349); | ||
| 829 | break; | ||
| 830 | case BC_NOT: | ||
| 831 | dasm_put(Dst, 351); | ||
| 832 | break; | ||
| 833 | case BC_UNM: | ||
| 834 | dasm_put(Dst, 353); | ||
| 835 | break; | ||
| 836 | case BC_LEN: | ||
| 837 | dasm_put(Dst, 355); | ||
| 838 | break; | ||
| 839 | |||
| 840 | /* -- Binary ops -------------------------------------------------------- */ | ||
| 841 | |||
| 842 | case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: | ||
| 843 | dasm_put(Dst, 357); | ||
| 844 | break; | ||
| 845 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: | ||
| 846 | dasm_put(Dst, 359); | ||
| 847 | break; | ||
| 848 | case BC_MULVN: case BC_MULNV: case BC_MULVV: | ||
| 849 | dasm_put(Dst, 361); | ||
| 850 | break; | ||
| 851 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: | ||
| 852 | dasm_put(Dst, 363); | ||
| 853 | break; | ||
| 854 | case BC_MODVN: | ||
| 855 | dasm_put(Dst, 365); | ||
| 856 | break; | ||
| 857 | case BC_MODNV: case BC_MODVV: | ||
| 858 | dasm_put(Dst, 367); | ||
| 859 | break; | ||
| 860 | case BC_POW: | ||
| 861 | dasm_put(Dst, 369); | ||
| 862 | break; | ||
| 863 | |||
| 864 | case BC_CAT: | ||
| 865 | dasm_put(Dst, 371); | ||
| 866 | break; | ||
| 867 | |||
| 868 | /* -- Constant ops ------------------------------------------------------ */ | ||
| 869 | |||
| 870 | case BC_KSTR: | ||
| 871 | dasm_put(Dst, 373); | ||
| 872 | break; | ||
| 873 | case BC_KSHORT: | ||
| 874 | dasm_put(Dst, 375); | ||
| 875 | break; | ||
| 876 | case BC_KNUM: | ||
| 877 | dasm_put(Dst, 377); | ||
| 878 | break; | ||
| 879 | case BC_KPRI: | ||
| 880 | dasm_put(Dst, 379); | ||
| 881 | break; | ||
| 882 | case BC_KNIL: | ||
| 883 | dasm_put(Dst, 381); | ||
| 884 | break; | ||
| 885 | |||
| 886 | /* -- Upvalue and function ops ------------------------------------------ */ | ||
| 887 | |||
| 888 | case BC_UGET: | ||
| 889 | dasm_put(Dst, 383); | ||
| 890 | break; | ||
| 891 | case BC_USETV: | ||
| 892 | dasm_put(Dst, 385); | ||
| 893 | break; | ||
| 894 | case BC_USETS: | ||
| 895 | dasm_put(Dst, 387); | ||
| 896 | break; | ||
| 897 | case BC_USETN: | ||
| 898 | dasm_put(Dst, 389); | ||
| 899 | break; | ||
| 900 | case BC_USETP: | ||
| 901 | dasm_put(Dst, 391); | ||
| 902 | break; | ||
| 903 | case BC_UCLO: | ||
| 904 | dasm_put(Dst, 393); | ||
| 905 | break; | ||
| 906 | |||
| 907 | case BC_FNEW: | ||
| 908 | dasm_put(Dst, 395); | ||
| 909 | break; | ||
| 910 | |||
| 911 | /* -- Table ops --------------------------------------------------------- */ | ||
| 912 | |||
| 913 | case BC_TNEW: | ||
| 914 | dasm_put(Dst, 397); | ||
| 915 | break; | ||
| 916 | case BC_TDUP: | ||
| 917 | dasm_put(Dst, 399); | ||
| 918 | break; | ||
| 919 | |||
| 920 | case BC_GGET: | ||
| 921 | case BC_GSET: | ||
| 922 | dasm_put(Dst, 401); | ||
| 923 | break; | ||
| 924 | |||
| 925 | case BC_TGETV: | ||
| 926 | dasm_put(Dst, 403); | ||
| 927 | break; | ||
| 928 | case BC_TGETS: | ||
| 929 | dasm_put(Dst, 405); | ||
| 930 | break; | ||
| 931 | case BC_TGETB: | ||
| 932 | dasm_put(Dst, 407); | ||
| 933 | break; | ||
| 934 | |||
| 935 | case BC_TSETV: | ||
| 936 | dasm_put(Dst, 409); | ||
| 937 | break; | ||
| 938 | case BC_TSETS: | ||
| 939 | dasm_put(Dst, 411); | ||
| 940 | break; | ||
| 941 | case BC_TSETB: | ||
| 942 | dasm_put(Dst, 413); | ||
| 943 | break; | ||
| 944 | |||
| 945 | case BC_TSETM: | ||
| 946 | dasm_put(Dst, 415); | ||
| 947 | break; | ||
| 948 | |||
| 949 | /* -- Calls and vararg handling ----------------------------------------- */ | ||
| 950 | |||
| 951 | case BC_CALLM: | ||
| 952 | dasm_put(Dst, 417); | ||
| 953 | break; | ||
| 954 | case BC_CALL: | ||
| 955 | dasm_put(Dst, 419); | ||
| 956 | break; | ||
| 957 | |||
| 958 | case BC_CALLMT: | ||
| 959 | dasm_put(Dst, 421); | ||
| 960 | break; | ||
| 961 | case BC_CALLT: | ||
| 962 | dasm_put(Dst, 423); | ||
| 963 | break; | ||
| 964 | |||
| 965 | case BC_ITERC: | ||
| 966 | dasm_put(Dst, 425); | ||
| 967 | break; | ||
| 968 | |||
| 969 | case BC_VARG: | ||
| 970 | dasm_put(Dst, 427); | ||
| 971 | break; | ||
| 972 | |||
| 973 | /* -- Returns ----------------------------------------------------------- */ | ||
| 974 | |||
| 975 | case BC_RETM: | ||
| 976 | dasm_put(Dst, 429); | ||
| 977 | break; | ||
| 978 | |||
| 979 | case BC_RET: | ||
| 980 | dasm_put(Dst, 431); | ||
| 981 | break; | ||
| 982 | |||
| 983 | case BC_RET0: case BC_RET1: | ||
| 984 | dasm_put(Dst, 433); | ||
| 985 | break; | ||
| 986 | |||
| 987 | /* -- Loops and branches ------------------------------------------------ */ | ||
| 988 | |||
| 989 | case BC_FORL: | ||
| 990 | #if LJ_HASJIT | ||
| 991 | dasm_put(Dst, 435); | ||
| 992 | #endif | ||
| 993 | break; | ||
| 994 | |||
| 995 | case BC_JFORI: | ||
| 996 | case BC_JFORL: | ||
| 997 | #if !LJ_HASJIT | ||
| 998 | break; | ||
| 999 | #endif | ||
| 1000 | case BC_FORI: | ||
| 1001 | case BC_IFORL: | ||
| 1002 | dasm_put(Dst, 437); | ||
| 1003 | break; | ||
| 1004 | |||
| 1005 | case BC_ITERL: | ||
| 1006 | #if LJ_HASJIT | ||
| 1007 | dasm_put(Dst, 439); | ||
| 1008 | #endif | ||
| 1009 | break; | ||
| 1010 | |||
| 1011 | case BC_JITERL: | ||
| 1012 | #if !LJ_HASJIT | ||
| 1013 | break; | ||
| 1014 | #endif | ||
| 1015 | case BC_IITERL: | ||
| 1016 | dasm_put(Dst, 441); | ||
| 1017 | break; | ||
| 1018 | |||
| 1019 | case BC_LOOP: | ||
| 1020 | dasm_put(Dst, 443); | ||
| 1021 | #if LJ_HASJIT | ||
| 1022 | #endif | ||
| 1023 | break; | ||
| 1024 | |||
| 1025 | case BC_ILOOP: | ||
| 1026 | dasm_put(Dst, 445); | ||
| 1027 | break; | ||
| 1028 | |||
| 1029 | case BC_JLOOP: | ||
| 1030 | dasm_put(Dst, 447); | ||
| 1031 | break; | ||
| 1032 | |||
| 1033 | case BC_JMP: | ||
| 1034 | dasm_put(Dst, 449); | ||
| 1035 | break; | ||
| 1036 | |||
| 1037 | /* -- Function headers -------------------------------------------------- */ | ||
| 1038 | |||
| 1039 | case BC_FUNCF: | ||
| 1040 | #if LJ_HASJIT | ||
| 1041 | dasm_put(Dst, 451); | ||
| 1042 | #endif | ||
| 1043 | case BC_FUNCV: /* NYI: compiled vararg functions. */ | ||
| 1044 | break; | ||
| 1045 | |||
| 1046 | case BC_JFUNCF: | ||
| 1047 | #if !LJ_HASJIT | ||
| 1048 | break; | ||
| 1049 | #endif | ||
| 1050 | case BC_IFUNCF: | ||
| 1051 | dasm_put(Dst, 453); | ||
| 1052 | break; | ||
| 1053 | |||
| 1054 | case BC_JFUNCV: | ||
| 1055 | #if !LJ_HASJIT | ||
| 1056 | break; | ||
| 1057 | #endif | ||
| 1058 | dasm_put(Dst, 455); | ||
| 1059 | break; /* NYI: compiled vararg functions. */ | ||
| 1060 | |||
| 1061 | case BC_IFUNCV: | ||
| 1062 | dasm_put(Dst, 457); | ||
| 1063 | break; | ||
| 1064 | |||
| 1065 | case BC_FUNCC: | ||
| 1066 | case BC_FUNCCW: | ||
| 1067 | dasm_put(Dst, 459); | ||
| 1068 | break; | ||
| 1069 | |||
| 1070 | /* ---------------------------------------------------------------------- */ | ||
| 1071 | |||
| 1072 | default: | ||
| 1073 | fprintf(stderr, "Error: undefined opcode BC_%s\n", bc_names[op]); | ||
| 1074 | exit(2); | ||
| 1075 | break; | ||
| 1076 | } | ||
| 1077 | } | ||
| 1078 | |||
| 1079 | static int build_backend(BuildCtx *ctx) | ||
| 1080 | { | ||
| 1081 | int op; | ||
| 1082 | |||
| 1083 | dasm_growpc(Dst, BC__MAX); | ||
| 1084 | |||
| 1085 | build_subroutines(ctx); | ||
| 1086 | |||
| 1087 | dasm_put(Dst, 461); | ||
| 1088 | for (op = 0; op < BC__MAX; op++) | ||
| 1089 | build_ins(ctx, (BCOp)op, op); | ||
| 1090 | |||
| 1091 | return BC__MAX; | ||
| 1092 | } | ||
| 1093 | |||
| 1094 | /* Emit pseudo frame-info for all assembler functions. */ | ||
| 1095 | static void emit_asm_debug(BuildCtx *ctx) | ||
| 1096 | { | ||
| 1097 | /* NYI */ | ||
| 1098 | UNUSED(ctx); | ||
| 1099 | } | ||
| 1100 | |||
diff --git a/src/lib_jit.c b/src/lib_jit.c index 4cabb2f7..bfceab62 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c | |||
| @@ -543,10 +543,12 @@ static uint32_t jit_cpudetect(lua_State *L) | |||
| 543 | luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)"); | 543 | luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)"); |
| 544 | #endif | 544 | #endif |
| 545 | #endif | 545 | #endif |
| 546 | UNUSED(L); | 546 | #elif LJ_TARGET_PPC |
| 547 | /* Nothing to do. */ | ||
| 547 | #else | 548 | #else |
| 548 | #error "Missing CPU detection for this architecture" | 549 | #error "Missing CPU detection for this architecture" |
| 549 | #endif | 550 | #endif |
| 551 | UNUSED(L); | ||
| 550 | return flags; | 552 | return flags; |
| 551 | } | 553 | } |
| 552 | 554 | ||
