view release on metacpan or search on metacpan
libjit/ChangeLog view on Meta::CPAN
2007-06-11 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-insn.c (accumulate_relative_offset): remove.
* jit/jit-insn.c (find_base_insn, jit_insn_load_relative)
(jit_insn_store_relative, jit_insn_add_relative): add find_base_insn
function that should finally optimize relative instructions
correctly.
2007-06-10 Aleksey Demakov <ademakov@gmail.com>
* tools/gen-rules-parser.y (gensel_output_clauses): alter selection
logic so that "reg" rules are chosen over "local" in case the value
is used again in the same basic block.
* jit/jit-rules-x86.ins: tweak COPY rules for bytes, shorts, and
ints.
* jit/jit-live.c (forward_propagation, backward_propagation)
(is_copy_insn): do not perform copy propagation if JIT_OP_COPY_INT
is used for byte and short values.
libjit/ChangeLog view on Meta::CPAN
these buffers. This fixes problems on alpha and some x86 linux
distros. [This one is based on the initial solution suggested by
Kirill Kononenko <Kirill.Kononenko@gmail.com>].
* jit/jit-rules-x86.c (_jit_gen_redirector): ifdef out as this
function is not used with the x86 backend.
* jit/jit-reg-alloc.c: improve handling of three-address op codes.
Now the dest register may re-use one of the input registers while
previously it was always assigned to a separate register. Also
restructure the code that will be used for better selection of x87
instructions (this code was not used before and still is not but
this is about to change).
* jit/jit-rules-x86.ins: rewrite all LOAD_RELATIVE and LOAD_ELEMENT
ops for x86 as three-address. Adjust IREM ops so that they work
correctly together with the latest allocator changes.
2006-08-22 Klaus Treichel <ktreichel@web.de>
* jit/jit-alloc.c: Use mmap and munmap to allocate executable memory
libjit/ChangeLog view on Meta::CPAN
* jit/jit-rules-x86.c (_jit_gen_load_value): fix compiler warning.
* tools/gen-rules-parser.y (gensel_output_clauses): fix generation
of clobber and scratch code.
* tools/gen-rules-scanner.l, tools/gen-rules-parser.y: add `any'
keyword.
2006-04-18 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-rules-x86.ins: add instruction selection rules for new
register allocator.
* jit/Makefile.am: build new instruction selection rules.
* configure.in: add --enable-new-reg-alloc option.
2006-04-14 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-reg-alloc.h, jit/jit-reg-alloc.c: new register allocator
improved and extended to support stack registers.
* jit/jit-internal.h (struct _jit_builder):
* jit/jit-function.c (compile_block, jit_function_compile): add
some tracing.
libjit/ChangeLog view on Meta::CPAN
2004-06-14 Rhys Weatherley <rweather@southern-storm.com.au>
* dpas/dpas-internal.h, dpas/dpas-parser.y, dpas/dpas-scanner.l,
jit/jit-rules-x86.c, jit/jit-rules-x86.sel, tests/Makefile.am,
tests/param.pas, tools/gen-apply.c: add some test cases for
parameter passing; fix fastcall/stdcall conventions for x86.
* jit/jit-rules-arm.h, jit/jit-rules-arm.sel, jit/jit-rules-x86.h,
jit/jit-rules-x86.sel, tools/gen-sel-parser.y: enable register
allocation for 64-bit values under x86 and ARM; expand some
64-bit opcodes in the instruction selectors.
2004-06-12 Rhys Weatherley <rweather@southern-storm.com.au>
* jit/jit-insn.c, jit/jit-rules-x86.c, jit/jit-rules-x86.sel:
implement or stub missing x86 instruction selection rules.
* include/jit/jit-insn.h, include/jit/jit-opcode.h,
include/jit/jit-plus.h, jit/jit-function.c, jit/jit-insn.c,
jit/jit-interp.c, jit/jit-opcode.c, jit/jit-rules-interp.c,
jitplus/jit-plus-function.cpp: add the "outgoing_frame_posn"
instruction, to support tail calls.
2004-06-11 Rhys Weatherley <rweather@southern-storm.com.au>
* doc/libjit.texi, jit/jit-insn.c, jit/jit-internal.h,
libjit/ChangeLog view on Meta::CPAN
2004-06-08 Rhys Weatherley <rweather@southern-storm.com.au>
* jit/Makefile.am, jit/jit-cpuid-x86.c, jit/jit-cpuid-x86.h:
add an API for querying the x86 "cpuid" information.
* include/jit/jit-opcode.h, jit/jit-interp.c, jit/jit-opcode.c:
remove obsolete opcodes which violate "_jit_load_opcode"'s rules.
* jit/jit-reg-alloc.c, jit/jit-rules-x86.c, jit/jit-rules-x86.sel:
more x86 instruction selection rules.
* jit/jit-reg-alloc.c (_jit_regs_set_outgoing): implement
missing function.
* jit/jit-gen-arm.h (arm_call): use a more efficient form of
call for offsets beyond the simple target range.
* jit/jit-rules-arm.sel, tools/gen-sel-parser.y,
tools/gen-sel-scanner.l: introduce conditional rules into "gen-sel"
so that we can disable certain rules on ARM platforms that lack
libjit/ChangeLog view on Meta::CPAN
* jit/jit-insn.c: recognise "t = a op b; a = t" and turn it
into "a = a op b" to make it easier for back ends to recognise
special idioms such as increments and decrements.
2004-06-01 Rhys Weatherley <rweather@southern-storm.com.au>
* jit/jit-cache.c, jit/jit-elf-read.c, tools/gen-apply.c:
fix some gcc 3.x compile warnings.
* jit/jit-rules-arm.c, jit/jit-rules-arm.sel: more instruction
selection rules for ARM.
* configure.in, jit/jit-rules.h: enable the x86 back end by
default on platforms where it makes sense, and add the option
"--enable-interpreter" to "configure".
2004-05-31 Rhys Weatherley <rweather@southern-storm.com.au>
* jit/jit-rules-x86.sel: optimize multiplications for x86.
* jit/jit-rules-x86.c, jit/jit-rules-x86.sel, tools/gen-sel-parser.y,
libjit/ChangeLog view on Meta::CPAN
2004-05-30 Rhys Weatherley <rweather@southern-storm.com.au>
* doc/libjit.texi: clarify the text that describes LLVM, at the
request of Chris Lattner, LLVM's author.
* jit/jit-insn.c (jit_insn_convert): use intrinsic functions
for conversions when the back end doesn't support the opcode.
* jit/jit-rules-x86.sel, tools/gen-sel-parser.y,
tools/gen-sel-scanner.l: improve instruction selection for
floating-point "push" operations.
* include/jit/jit-insn.h, jit/jit-insn.c, jit/jit-internal.h,
jit/jit-rules-x86.c: add "jit_insn_defer_pop_stack" and
"jit_insn_flush_defer_pop", to defer the popping of function
call arguments as long as possible.
* jit/jit-rules-x86.sel: fix a cpu vs non-cpu register problem
in the floating-point "push" operations for x86.
libjit/ChangeLog view on Meta::CPAN
* include/jit/jit-insn.h, include/jit/jit-plus.h, jit/jit-insn.c,
jitplus/jit-plus-function.cpp: add "jit_insn_new_block" to simplify
creating a new block that doesn't have an explicit label.
* dpas/dpas-parser.y, include/jit/jit-block.h, jit/jit-block.c,
jit/jit-insn.c: add "jit_block_current_is_dead" to simplify
testing if the last block is reachable or not, taking empty
trailing blocks into account.
* jit/jit-rules-x86.c, jit/jit-rules-x86.sel, tools/gen-sel-parser.y,
tools/gen-sel-scanner.l: more selection cases for the x86 back end.
* jit/Makefile.am, jit/jit-gen-arm.h, jit/jit-rules-arm.c,
jit/jit-rules-arm.sel: add the beginnings of the instruction
selector for ARM.
2004-05-25 Rhys Weatherley <rweather@southern-storm.com.au>
* tools/.cvsignore, tools/Makefile.am, tools/gen-sel-parser.y,
tools/gen-sel-scanner.l: add the "gen-sel" program to the tree,
to assist with building native instruction selectors.
* jit/.cvsignore, jit/Makefile.am, jit/jit-rules-x86.c,
jit/jit-rules-x86.sel, tools/gen-sel-parser.y: check in the
initial instruction selector for x86 (incomplete).
* jit/jit-rules-x86.sel, tools/gen-sel-parser.y,
tools/gen-sel-scanner.l: selectors for branch instructions.
* jit/jit-rules-x86.sel: selectors for call instructions.
2004-05-24 Rhys Weatherley <rweather@southern-storm.com.au>
* include/jit/jit-insn.h, include/jit/jit-opcode.h, jit/jit-block.c,
jit/jit-dump.c, jit/jit-except.c, jit/jit-function.c, jit/jit-insn.c,
jit/jit-internal.h, jit/jit-interp.c, jit/jit-interp.h,
jit/jit-opcode.c, jit/jit-rules-arm.c, jit/jit-rules-interp.c,
jit/jit-rules-x86.c, jit/jit-rules.h, jit/jit-setjmp.h:
rewrite the exception region routines to make them easier
to use from CLI and JVM style systems.
libjit/NEWS view on Meta::CPAN
* Add function indirectors (Klaus Treichel).
* Allocate function redirectors and indirectors in the code cache
(Aleksey Demakov).
* Use mmap to allocate executable memory where available
(Klaus Treichel).
* Now can dump to any stream not just stdout and stderr (Radek Polak).
* Use a global lock during context initialization (Aleksey Demakov).
* Fix problems that take place after compilation is restarted on cache
page overflow (Aleksey Demakov).
Register allocation/instruction selection improvements (Aleksey Demakov):
* Completely rewrite register allocator. The new allocator works with
three-value intermediate instructions rather than with individual
values. This allows to fully analyze the effect of the instruction
and makes it possible to optimize commutative instructions and
eliminate in some cases redundant register spills and loads.
* Support three-address architectures.
* Add register classes.
* The allocator may now allocate scratch registers for instructions.
* The allocator now automatically handles cases when a global register
is clobbered by the instruction (which may happen on the register
constrained x86 architecture).
* Implement value coalescing for copy instructions.
* Provide for efficient handling of x87 floating point stack.
* Add gen-rules program that supersedes gen-sel. It generates code for
new register allocator and extends the syntax of instruction selection
rules to make use of new features such as register classes, scratch
registers, etc.
Alpha:
* Add Alpha backend (not yet fully functional) (Thomas Cort).
x86:
* Update x86 instruction selector for new register allocator and rules
syntax. Take advantage of their new features to generate better code
and/or simplify rules (Aleksey Demakov).
* optimize code generated by throw_builtin, JIT_OP_THROW, JIT_OP_LOAD_PC
if the position-independent option is not set (Kirill Kononenko).
* Implement JIT_OP_IMIN_UN, JIT_OP_ISIGN, JIT_OP_LSIGN, JIT_OP_IABS,
JIT_OP_LABS, JIT_OP_LOW_WORD, JIT_OP_EXPAND_INT, JIT_OP_EXPAND_UINT,
JIT_OP_INT_TO_NFLOAT, JIT_OP_UINT_TO_NFLOAT, JIT_OP_LONG_TO_NFLOAT,
JIT_OP_ULONG_TO_NFLOAT rules (Aleksey Demakov, Kirill Kononenko).
* optimize loading of zero constants. (Aleksey Demakov).
libjit/NEWS view on Meta::CPAN
* The interpreter backend does not use register stack and register
allocator anymore (Aleksey Demakov).
0.0.6 (15 January 2006)
x86:
* Be careful when using EBX in cpuid instructions so as not to confuse
gcc in PIC mode (Rhys W).
* Fixes to floating point instruction selection (Rhys Weatherley).
* Some support for structure copying (Rhys Weatherley).
* Pointer-relative loads and stores (Rhys Weatherley).
* Correct the offset for long-form backwards branches (Evin Robertson).
* Constant pointers in relative offset operations (Rhys Weatherley).
* Merge in Mono's changes to jit-gen-x86.h (Aleksey Demakov).
* Array loads and stores for floating point values (Aleksey Demakov).
* Memcpy, memset, and memmove operations (Aleksey Demakov).
* Return buffer problems in apply function with gcc 4.0.2 (Aleksey Demakov).
x86-64:
libjit/NEWS view on Meta::CPAN
* Optimize "if true goto" into "goto".
* Peephole optimization on branches.
* Adjust ARM codegen macros to support branch elimination instructions.
* Redesign exception handling to use "setjmp" everywhere.
* Remove C++ code from "libjit.so" so that it is a pure C library.
* Use computed goto's in the interpreter if the compiler supports them.
* Don't allow conditional branches to jump out of exception contexts.
* Block movement to allow initialization code to be moved to the start
of a function, or loop condition code to be moved to the end.
* Rewrite the exception region routines to make them easier to use.
* Add the "gen-sel" program, for creating instruction selectors.
* Write instruction selectors for x86 and ARM (only x86 is enabled).
* Portability fixes for ARM, PPC, Alpha, IA64, and amd64.
* Clarify the description of LLVM, at the request of LLVM's author.
* Deferred argument popping after function calls.
* Add "--enable-interpreter" to force the interpreter to be used.
* Implement a simple global register allocator based on usage counts.
* Recognise increment and decrement idioms.
* Align cache flushes properly (Miroslaw Dobrzanski-Neumann).
* Querying of x86 cpuid where necessary.
* Add a constant pool for ARM, to make constant loads more efficient.
* Handle register pairs for 64-bit values properly.
libjit/TODO view on Meta::CPAN
===============
* comprehensive test suite
* ports to ppc, arm, sparc, alpha, coldfire, mips...
* more optimizations:
** redundancy elimination
** alias analysis
** strength reduction
** loop optimization
** array data type, ABCD
* tree-based IR and instruction selection ?
* instruction scheduling ?
* finish ELF writer/reader
libjit/attic/jit-rules-alpha.ins view on Meta::CPAN
/*
* jit-rules-alpha.ins - Instruction selector for alpha.
*
* Copyright (C) 2006 Southern Storm Software, Pty Ltd.
*
* This file is part of the libjit library.
*
* The libjit library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 2.1 of
* the License, or (at your option) any later version.
*
libjit/jit/jit-elf-defs.h view on Meta::CPAN
Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
approach. */
#define DT_VALRNGLO 0x6ffffd00
#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */
#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */
#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */
#define DT_CHECKSUM 0x6ffffdf8
#define DT_PLTPADSZ 0x6ffffdf9
#define DT_MOVEENT 0x6ffffdfa
#define DT_MOVESZ 0x6ffffdfb
#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */
#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
the following DT_* entry. */
#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
#define DT_VALRNGHI 0x6ffffdff
/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
If any adjustment is made to the ELF object after it has been
libjit/jit/jit-elf-defs.h view on Meta::CPAN
#define DT_FILTER 0x7fffffff /* Shared object to get values from */
#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
#define DT_EXTRANUM 3
/* Values of `d_un.d_val' in the DT_FLAGS entry. */
#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */
#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */
#define DF_TEXTREL 0x00000004 /* Object contains text relocations */
#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */
/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
entry in the dynamic section. */
#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */
#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */
#define DF_1_TRANS 0x00000200
#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */
#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */
#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */
#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/
#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */
#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */
#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */
/* Flags for the feature selection in DT_FEATURE_1. */
#define DTF_1_PARINIT 0x00000001
#define DTF_1_CONFEXP 0x00000002
/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */
#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */
#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not
generally available. */
/* Version definition sections. */
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
{
set_regdesc_register(gen, regs, 0, suitable_reg, suitable_other_reg);
}
else
{
jit_exception_builtin(JIT_RESULT_COMPILE_ERROR);
}
}
/*
* Select the best argument order for binary ops. The posibility to select
* the order exists only for commutative ops and for some x87 floating point
* instructions. Those x87 instructions have variants with reversed
* destination register.
*/
static void
choose_input_order(jit_gencode_t gen, _jit_regs_t *regs)
{
jit_value_t value;
value = regs->descs[2].value;
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
desc2->duplicate = 1;
}
}
#ifdef JIT_REG_STACK
/*
* For x87 instructions choose between pop and no-pop variants.
*/
static void
select_nopop_or_pop(jit_gencode_t gen, _jit_regs_t *regs)
{
int keep1, keep2;
if(!regs->x87_arith || !regs->descs[1].value || !regs->descs[2].value)
{
return;
}
/* Equal values should be assigned to one register and this is
going to work only with no-pop instructions. */
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
{
keep2 = (regs->descs[2].used
&& (regs->descs[2].value != regs->descs[0].value)
&& !regs->descs[2].clobber);
}
regs->no_pop = (keep1 || keep2);
}
static void
select_stack_order(jit_gencode_t gen, _jit_regs_t *regs)
{
_jit_regdesc_t *desc1;
_jit_regdesc_t *desc2;
int top_index;
#ifdef JIT_REG_DEBUG
printf("select_stack_order()\n");
#endif
if(!regs->x87_arith || regs->wanted_stack_count != 2)
{
return;
}
desc1 = ®s->descs[1];
desc2 = ®s->descs[2];
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
the output always goes to the same register as the first input
value unless this is a three-address instruction. */
set_regdesc_register(gen, regs, 0,
regs->descs[1].reg,
regs->descs[1].other_reg);
}
}
#if JIT_REG_STACK
/* Choose between x87 pop and no-pop instructions. */
select_nopop_or_pop(gen, regs);
#endif
/* Assign output and input registers. */
if(regs->descs[0].value)
{
if(regs->descs[0].reg < 0)
{
if(regs->ternary)
{
choose_input_register(gen, regs, 0);
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
{
free_output_value(gen, regs);
}
save_input_value(gen, regs, 1);
save_input_value(gen, regs, 2);
#ifdef JIT_REG_STACK
if(regs->wanted_stack_count > 0)
{
/* Adjust assignment of stack registers. */
select_stack_order(gen, regs);
adjust_assignment(gen, regs, 2);
adjust_assignment(gen, regs, 1);
adjust_assignment(gen, regs, 0);
if(regs->ternary)
{
/* Ternary ops with only one stack register are supported. */
if(regs->loaded_stack_count > 0)
{
move_input_value(gen, regs, 0);
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
load_input_value(gen, regs, 2);
}
#ifdef JIT_REG_DEBUG
dump_regs(gen, "leave _jit_regs_gen");
#endif
}
#ifdef JIT_REG_STACK
int
_jit_regs_select(_jit_regs_t *regs)
{
int flags;
flags = 0;
if(regs->no_pop)
{
flags |= _JIT_REGS_NO_POP;
}
if(regs->flip_args)
{
libjit/jit/jit-reg-alloc.h view on Meta::CPAN
#define _JIT_REGS_REVERSIBLE 0X0080
/*
* Flags for _jit_regs_init_dest(), _jit_regs_init_value1(), and
* _jit_regs_init_value2().
*/
#define _JIT_REGS_CLOBBER 0x0001
#define _JIT_REGS_EARLY_CLOBBER 0x0002
/*
* Flags returned by _jit_regs_select_insn().
*/
#define _JIT_REGS_NO_POP 0x0001
#define _JIT_REGS_FLIP_ARGS 0x0002
#define _JIT_REGS_REVERSE 0x0004
/*
* Contains register assignment data for single operand.
*/
typedef struct
{
libjit/jit/jit-reg-alloc.h view on Meta::CPAN
void _jit_regs_set_value2(jit_gencode_t gen, _jit_regs_t *regs, int reg, int other_reg);
void _jit_regs_set_scratch(jit_gencode_t gen, _jit_regs_t *regs, int index, int reg);
void _jit_regs_clobber(_jit_regs_t *regs, int reg);
void _jit_regs_clobber_class(jit_gencode_t gen, _jit_regs_t *regs, _jit_regclass_t *regclass);
void _jit_regs_clobber_all(jit_gencode_t gen, _jit_regs_t *regs);
void _jit_regs_assign(jit_gencode_t gen, _jit_regs_t *regs);
void _jit_regs_gen(jit_gencode_t gen, _jit_regs_t *regs);
#ifdef JIT_REG_STACK
int _jit_regs_select(_jit_regs_t *regs);
#endif
void _jit_regs_commit(jit_gencode_t gen, _jit_regs_t *regs);
int _jit_regs_get_dest(_jit_regs_t *regs);
int _jit_regs_get_value1(_jit_regs_t *regs);
int _jit_regs_get_value2(_jit_regs_t *regs);
int _jit_regs_get_dest_other(_jit_regs_t *regs);
int _jit_regs_get_value1_other(_jit_regs_t *regs);
int _jit_regs_get_value2_other(_jit_regs_t *regs);
libjit/jit/jit-rules-arm.ins view on Meta::CPAN
/*
* jit-rules-arm.ins - Instruction selector for ARM.
*
* Copyright (C) 2004 Southern Storm Software, Pty Ltd.
* Copyright (C) 2008 Michele Tartara <mikyt@users.sourceforge.net>
*
* This file is part of the libjit library.
*
* The libjit library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 2.1 of
* the License, or (at your option) any later version.
libjit/jit/jit-rules-x86-64.ins view on Meta::CPAN
/*
* jit-rules-x86-64.ins - Instruction selector for x86_64.
*
* Copyright (C) 2008 Southern Storm Software, Pty Ltd.
*
* This file is part of the libjit library.
*
* The libjit library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 2.1 of
* the License, or (at your option) any later version.
*
libjit/jit/jit-rules-x86.ins view on Meta::CPAN
/*
* jit-rules-x86.ins - Instruction selector for x86.
*
* Copyright (C) 2004 Southern Storm Software, Pty Ltd.
*
* This file is part of the libjit library.
*
* The libjit library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 2.1 of
* the License, or (at your option) any later version.
*
libjit/jit/jit-rules-x86.ins view on Meta::CPAN
x86_neg_reg(inst, %1);
x86_neg_reg(inst, $1);
x86_alu_reg_imm(inst, X86_SBB, %1, 0);
#endif
}
JIT_OP_FADD, JIT_OP_DADD, JIT_OP_NFADD: stack, x87_arith, commutative
[freg, freg] -> {
int flags;
flags = _jit_regs_select(®s);
if((flags & _JIT_REGS_NO_POP) == 0)
{
x86_fp_op_reg(inst, X86_FADD,
fp_stack_index(gen, $1 + JIT_REG_STACK_START), 1);
}
else if((flags & _JIT_REGS_FLIP_ARGS) != 0)
{
x86_fp_op_reg(inst, X86_FADD,
fp_stack_index(gen, $1 + JIT_REG_STACK_START), 0);
libjit/jit/jit-rules-x86.ins view on Meta::CPAN
{
x86_fp_op(inst, X86_FADD,
fp_stack_index(gen, $2 + JIT_REG_STACK_START));
}
}
JIT_OP_FSUB, JIT_OP_DSUB, JIT_OP_NFSUB: stack, x87_arith_reversible
[freg, freg] -> {
int flags;
flags = _jit_regs_select(®s);
if((flags & _JIT_REGS_NO_POP) == 0)
{
if((flags & _JIT_REGS_REVERSE) == 0)
{
x86_fp_op_reg(inst, X86_FSUB,
fp_stack_index(gen, $1 + JIT_REG_STACK_START), 1);
}
else
{
libjit/jit/jit-rules-x86.ins view on Meta::CPAN
x86_fp_op_reg(inst, X86_FSUBR,
fp_stack_index(gen, $2 + JIT_REG_STACK_START), 0);
}
}
}
JIT_OP_FMUL, JIT_OP_DMUL, JIT_OP_NFMUL: stack, x87_arith, commutative
[freg, freg] -> {
int flags;
flags = _jit_regs_select(®s);
if((flags & _JIT_REGS_NO_POP) == 0)
{
x86_fp_op_reg(inst, X86_FMUL, fp_stack_index(gen, $1 + JIT_REG_STACK_START), 1);
}
else if((flags & _JIT_REGS_FLIP_ARGS) != 0)
{
x86_fp_op_reg(inst, X86_FMUL, fp_stack_index(gen, $1 + JIT_REG_STACK_START), 0);
}
else
{
x86_fp_op(inst, X86_FMUL, fp_stack_index(gen, $2 + JIT_REG_STACK_START));
}
}
JIT_OP_FDIV, JIT_OP_DDIV, JIT_OP_NFDIV: stack, x87_arith_reversible
[freg, freg] -> {
int flags;
flags = _jit_regs_select(®s);
if((flags & _JIT_REGS_NO_POP) == 0)
{
if((flags & _JIT_REGS_REVERSE) == 0)
{
x86_fp_op_reg(inst, X86_FDIV,
fp_stack_index(gen, $1 + JIT_REG_STACK_START), 1);
}
else
{
libjit/jitruby/ext/extconf.rb view on Meta::CPAN
append_to_makefile = ''
rpp_files.each do |rpp_file|
dest_file = rpp_file.sub(/\.rpp$/, '')
append_to_makefile << <<END
#{dest_file}: #{rpp_file} #{rb_files.join(' ')}
$(RUBY) rubypp.rb #{rpp_file} #{dest_file}
END
end
generated_headers = generated_files.select { |x| x =~ /\.h$/ || x =~ /\.inc$/ }
append_to_makefile << <<END
$(OBJS): #{generated_headers.join(' ')}
clean: clean_generated_files
clean_generated_files:
@$(RM) #{generated_files.join(' ')}
install: $(includedir)/rubyjit.h
$(includedir)/rubyjit.h: rubyjit.h
$(INSTALL_PROG) rubyjit.h $(includedir)
libjit/jitruby/setup.rb view on Meta::CPAN
end
end
class ProgramItem < Item
def config_type
'program'
end
end
class SelectItem < Item
def initialize(name, selection, default, desc)
super
@ok = selection.split('/')
end
def config_type
'select'
end
private
def check(val)
unless @ok.include?(val.strip)
setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
end
val.strip
end
end
class ExecItem < Item
def initialize(name, selection, desc, &block)
super name, selection, nil, desc
@ok = selection.split('/')
@action = block
end
def config_type
'exec'
end
def value?
false
end
libjit/jitruby/setup.rb view on Meta::CPAN
def make(task = nil)
command(*[config('makeprog'), task].compact)
end
def extdir?(dir)
File.exist?("#{dir}/MANIFEST") or File.exist?("#{dir}/extconf.rb")
end
def files_of(dir)
Dir.open(dir) {|d|
return d.select {|ent| File.file?("#{dir}/#{ent}") }
}
end
DIR_REJECT = %w( . .. CVS SCCS RCS CVS.adm .svn )
def directories_of(dir)
Dir.open(dir) {|d|
return d.select {|ent| File.dir?("#{dir}/#{ent}") } - DIR_REJECT
}
end
end
# This module requires: #srcdir_root, #objdir_root, #relpath
module HookScriptAPI
def get_config(key)
libjit/jitruby/setup.rb view on Meta::CPAN
File.file?(srcfile(path))
end
def srcentries(path = '.')
Dir.open("#{curr_srcdir()}/#{path}") {|d|
return d.to_a - %w(. ..)
}
end
def srcfiles(path = '.')
srcentries(path).select {|fname|
File.file?(File.join(curr_srcdir(), path, fname))
}
end
def srcdirectories(path = '.')
srcentries(path).select {|fname|
File.dir?(File.join(curr_srcdir(), path, fname))
}
end
end
class ToplevelInstaller
Version = '3.4.1'
libjit/jitruby/setup.rb view on Meta::CPAN
@packages = list
end
def init_installers
@installers = {}
@packages.each do |pack|
@installers[pack] = Installer.new(@config,
"#{@ardir}/packages/#{pack}",
"packages/#{pack}")
end
with = extract_selection(config('with'))
without = extract_selection(config('without'))
@selected = @installers.keys.select {|name|
(with.empty? or with.include?(name)) \
and not without.include?(name)
}
end
def extract_selection(list)
a = list.split(/,/)
a.each do |name|
setup_rb_error "no such package: #{name}" unless @installers.key?(name)
end
a
end
def print_usage(f)
super
f.puts 'Inluded packages:'
f.puts ' ' + @packages.sort.join(' ')
f.puts
end
#
# Task Handlers
#
def exec_config
run_hook 'pre-config'
each_selected_installers {|inst| inst.exec_config }
run_hook 'post-config'
@config.save # must be final
end
def exec_setup
run_hook 'pre-setup'
each_selected_installers {|inst| inst.exec_setup }
run_hook 'post-setup'
end
def exec_install
run_hook 'pre-install'
each_selected_installers {|inst| inst.exec_install }
run_hook 'post-install'
end
def exec_test
run_hook 'pre-test'
each_selected_installers {|inst| inst.exec_test }
run_hook 'post-test'
end
def exec_clean
rm_f @config.savefile
run_hook 'pre-clean'
each_selected_installers {|inst| inst.exec_clean }
run_hook 'post-clean'
end
def exec_distclean
rm_f @config.savefile
run_hook 'pre-distclean'
each_selected_installers {|inst| inst.exec_distclean }
run_hook 'post-distclean'
end
#
# lib
#
def each_selected_installers
Dir.mkdir 'packages' unless File.dir?('packages')
@selected.each do |pack|
$stderr.puts "Processing the package `#{pack}' ..." if verbose?
Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
Dir.chdir "packages/#{pack}"
yield @installers[pack]
Dir.chdir '../..'
end
end
def run_hook(id)
@root_installer.run_hook id
libjit/jitruby/setup.rb view on Meta::CPAN
install fname, dest, mode, @config.install_prefix
end
end
end
def libfiles
glob_reject(%w(*.y *.output), targetfiles())
end
def rubyextentions(dir)
ents = glob_select("*.#{@config.dllext}", targetfiles())
if ents.empty?
setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first"
end
ents
end
def targetfiles
mapdir(existfiles() - hookfiles())
end
libjit/jitruby/setup.rb view on Meta::CPAN
def existfiles
glob_reject(JUNK_FILES, (files_of(curr_srcdir()) | files_of('.')))
end
def hookfiles
%w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt|
%w( config setup install clean distclean ).map {|t| sprintf(fmt, t) }
}.flatten
end
def glob_select(pat, ents)
re = globs2re([pat])
ents.select {|ent| re =~ ent }
end
def glob_reject(pats, ents)
re = globs2re(pats)
ents.reject {|ent| re =~ ent }
end
GLOB2REGEX = {
'.' => '\.',
'$' => '\$',