Mercurial > hg > graal-jvmci-8
comparison src/share/vm/asm/assembler.hpp @ 7197:1acccb7c0b01
8003850: add support for constants in stub code
Summary: remember the code section and switch back to the proper one when adding constants.
Reviewed-by: twisti, kvn
Contributed-by: goetz.lindenmaier@sap.com
author | kvn |
---|---|
date | Tue, 27 Nov 2012 17:41:38 -0800 |
parents | b9a9ed0f8eeb |
children | 6ab62ad83507 |
comparison
equal
deleted
inserted
replaced
7196:2aff40cb4703 | 7197:1acccb7c0b01 |
---|---|
346 // Inform assembler when generating stub code and relocation info | 346 // Inform assembler when generating stub code and relocation info |
347 address start_a_stub(int required_space); | 347 address start_a_stub(int required_space); |
348 void end_a_stub(); | 348 void end_a_stub(); |
349 // Ditto for constants. | 349 // Ditto for constants. |
350 address start_a_const(int required_space, int required_align = sizeof(double)); | 350 address start_a_const(int required_space, int required_align = sizeof(double)); |
351 void end_a_const(); | 351 void end_a_const(CodeSection* cs); // Pass the codesection to continue in (insts or stubs?). |
352 | 352 |
353 // constants support | 353 // constants support |
354 // | |
355 // We must remember the code section (insts or stubs) in c1 | |
356 // so we can reset to the proper section in end_a_const(). | |
354 address long_constant(jlong c) { | 357 address long_constant(jlong c) { |
358 CodeSection* c1 = _code_section; | |
355 address ptr = start_a_const(sizeof(c), sizeof(c)); | 359 address ptr = start_a_const(sizeof(c), sizeof(c)); |
356 if (ptr != NULL) { | 360 if (ptr != NULL) { |
357 *(jlong*)ptr = c; | 361 *(jlong*)ptr = c; |
358 _code_pos = ptr + sizeof(c); | 362 _code_pos = ptr + sizeof(c); |
359 end_a_const(); | 363 end_a_const(c1); |
360 } | 364 } |
361 return ptr; | 365 return ptr; |
362 } | 366 } |
363 address double_constant(jdouble c) { | 367 address double_constant(jdouble c) { |
368 CodeSection* c1 = _code_section; | |
364 address ptr = start_a_const(sizeof(c), sizeof(c)); | 369 address ptr = start_a_const(sizeof(c), sizeof(c)); |
365 if (ptr != NULL) { | 370 if (ptr != NULL) { |
366 *(jdouble*)ptr = c; | 371 *(jdouble*)ptr = c; |
367 _code_pos = ptr + sizeof(c); | 372 _code_pos = ptr + sizeof(c); |
368 end_a_const(); | 373 end_a_const(c1); |
369 } | 374 } |
370 return ptr; | 375 return ptr; |
371 } | 376 } |
372 address float_constant(jfloat c) { | 377 address float_constant(jfloat c) { |
378 CodeSection* c1 = _code_section; | |
373 address ptr = start_a_const(sizeof(c), sizeof(c)); | 379 address ptr = start_a_const(sizeof(c), sizeof(c)); |
374 if (ptr != NULL) { | 380 if (ptr != NULL) { |
375 *(jfloat*)ptr = c; | 381 *(jfloat*)ptr = c; |
376 _code_pos = ptr + sizeof(c); | 382 _code_pos = ptr + sizeof(c); |
377 end_a_const(); | 383 end_a_const(c1); |
378 } | 384 } |
379 return ptr; | 385 return ptr; |
380 } | 386 } |
381 address address_constant(address c) { | 387 address address_constant(address c) { |
388 CodeSection* c1 = _code_section; | |
382 address ptr = start_a_const(sizeof(c), sizeof(c)); | 389 address ptr = start_a_const(sizeof(c), sizeof(c)); |
383 if (ptr != NULL) { | 390 if (ptr != NULL) { |
384 *(address*)ptr = c; | 391 *(address*)ptr = c; |
385 _code_pos = ptr + sizeof(c); | 392 _code_pos = ptr + sizeof(c); |
386 end_a_const(); | 393 end_a_const(c1); |
387 } | 394 } |
388 return ptr; | 395 return ptr; |
389 } | 396 } |
390 address address_constant(address c, RelocationHolder const& rspec) { | 397 address address_constant(address c, RelocationHolder const& rspec) { |
398 CodeSection* c1 = _code_section; | |
391 address ptr = start_a_const(sizeof(c), sizeof(c)); | 399 address ptr = start_a_const(sizeof(c), sizeof(c)); |
392 if (ptr != NULL) { | 400 if (ptr != NULL) { |
393 relocate(rspec); | 401 relocate(rspec); |
394 *(address*)ptr = c; | 402 *(address*)ptr = c; |
395 _code_pos = ptr + sizeof(c); | 403 _code_pos = ptr + sizeof(c); |
396 end_a_const(); | 404 end_a_const(c1); |
397 } | 405 } |
398 return ptr; | 406 return ptr; |
399 } | 407 } |
400 | 408 |
401 // Bootstrapping aid to cope with delayed determination of constants. | 409 // Bootstrapping aid to cope with delayed determination of constants. |