view release on metacpan or search on metacpan
libjit/ChangeLog view on Meta::CPAN
2006-10-23 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-rules-x86.ins: JIT_OP_EXPAND_INT and JIT_OP_EXPAND_UINT
rules were broken for local byte or short values. Fixed by removing
the local pattern altogether as the reg pattern produces the same
code but without the bug.
2006-10-18 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-reg-alloc.c (clobbers_register, bind_value): enable
coalescing of the destination value of a copy operation with the
source value in a single register.
* jit/jit-rules-x86.ins: tag COPY rules with the "copy" keyword
and change patterns of TRUNC rules to have a separate destination
register.
2006-10-16 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-interp.h, jit/jit-interp.c (_jit_run_function):
libjit/ChangeLog view on Meta::CPAN
2006-06-03 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-rules-x86.ins: remove _jit_regs_free_reg() call from
JIT_OP_RETURN_FLOAT32, JIT_OP_PUSH_FLOAT32, JIT_OP_RETURN_FLOAT64,
JIT_OP_RETURN_NFLOAT, JIT_OP_PUSH_FLOAT64, and JIT_OP_PUSH_NFLOAT
rules. With new ``gen-rules'' tool it frees wrong register and
the right register is anyway freed automatically by the new
allocator.
* jit/jit-reg-alloc.h, jit/jit-reg-alloc.c (_jit_regs_abort): add
function to unbind values from registers if the code generation
failed. This is required because new allocator may temporary bind
constants to registers and if neither _jit_regs_commit() nor
_jit_regs_abort() is called the constant value will be left in
inconsistent state. The problem shows up when the end of a cache
block has been reached and the compilation is restarted with a new
block.
* jit/jit-reg-alloc.c (_jit_regs_begin, _jit_regs_end): add
convenience functions.
* tools/gen-rules-parser.y (gensel_output_clauses): make generated
libjit/ChangeLog view on Meta::CPAN
* jit/jit-rules-interp.c: code generation for interpreter return's.
* include/jit/jit-except.h, include/jit/jit-function.h,
include/jit/jit-plus.h, jit/jit-except.cpp, jit/jit-function.c,
jit/jit-interp.cpp, jit/jit-interp.h, jit/jit-rules-interp.c,
jitplus/jit-plus-function.cpp: implement "jit_function_apply"
and "jit_function_apply_vararg" for the interpreter back end.
* jitplus/jit-plus-function.cpp: initialization errors in
the C++ binding.
* jit/jit-function.c, jit/jit-insn.c, jit/jit-interp.cpp,
jit/jit-rules-interp.c: work on code generation for function calls.
* doc/libjit.texi, include/jit/jit-insn.h, include/jit/jit-plus.h,
jit/jit-insn.c, jitplus/jit-plus-function.cpp, tutorial/t2.c:
add a "flags" parmeter to "jit_insn_call" and friends, so that
"nothrow", "noreturn", and "tail" options can be supplied.
* jit/jit-dump.c, jit/jit-interp.cpp, jit/jit-interp.h,
libjit/include/jit/jit-plus.h view on Meta::CPAN
/*
* jit-plus.h - C++ binding for the JIT library.
*
* Copyright (C) 2004 Southern Storm Software, Pty Ltd.
*
* 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.
*
* The libjit library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
libjit/jit/jit-elf-defs.h view on Meta::CPAN
/* Section group handling. */
#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */
/* Symbol table entry. */
typedef struct
{
Elf32_Word st_name; /* Symbol name (string tbl index) */
Elf32_Addr st_value; /* Symbol value */
Elf32_Word st_size; /* Symbol size */
unsigned char st_info; /* Symbol type and binding */
unsigned char st_other; /* Symbol visibility */
Elf32_Section st_shndx; /* Section index */
} Elf32_Sym;
typedef struct
{
Elf64_Word st_name; /* Symbol name (string tbl index) */
unsigned char st_info; /* Symbol type and binding */
unsigned char st_other; /* Symbol visibility */
Elf64_Section st_shndx; /* Section index */
Elf64_Addr st_value; /* Symbol value */
Elf64_Xword st_size; /* Symbol size */
} Elf64_Sym;
/* The syminfo section if available contains additional information about
every dynamic symbol. */
typedef struct
{
Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
Elf32_Half si_flags; /* Per symbol flags */
} Elf32_Syminfo;
typedef struct
{
Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
Elf64_Half si_flags; /* Per symbol flags */
} Elf64_Syminfo;
/* Possible values for si_boundto. */
#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
/* Possible bitmasks for si_flags. */
#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
libjit/jit/jit-elf-defs.h view on Meta::CPAN
/* Special section index. */
#define SHN_UNDEF 0 /* No section, undefined symbol. */
/* How to extract and insert information held in the st_info field. */
#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
#define ELF32_ST_TYPE(val) ((val) & 0xf)
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
/* Legal values for ST_BIND subfield of st_info (symbol binding). */
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* Weak symbol */
#define STB_NUM 3 /* Number of defined types. */
#define STB_LOOS 10 /* Start of OS-specific */
#define STB_HIOS 12 /* End of OS-specific */
#define STB_LOPROC 13 /* Start of processor-specific */
#define STB_HIPROC 15 /* End of processor-specific */
libjit/jit/jit-elf-defs.h view on Meta::CPAN
range. Be compatible. */
#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
#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. */
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
}
#endif
}
#endif
/*
* Associate a temporary with register.
*/
static void
bind_temporary(jit_gencode_t gen, int reg, int other_reg)
{
#ifdef JIT_REG_DEBUG
printf("bind_temporary(reg = %d, other_reg = %d)\n", reg, other_reg);
#endif
gen->contents[reg].num_values = 0;
gen->contents[reg].age = 0;
gen->contents[reg].used_for_temp = 1;
gen->contents[reg].is_long_end = 0;
gen->contents[reg].is_long_start = 0;
if(other_reg >= 0)
{
gen->contents[other_reg].num_values = 0;
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
gen->contents[other_reg].used_for_temp = 1;
gen->contents[other_reg].is_long_end = 0;
gen->contents[other_reg].is_long_start = 0;
}
}
/*
* Associate value with register.
*/
static void
bind_value(jit_gencode_t gen, jit_value_t value, int reg, int other_reg, int still_in_frame)
{
#ifdef JIT_REG_DEBUG
printf("bind_value(value = ");
jit_dump_value(stdout, jit_value_get_function(value), value, 0);
printf(", reg = %d, other_reg = %d, still_in_frame = %d)\n",
reg, other_reg, still_in_frame);
#endif
if(value->has_global_register && value->global_reg == reg)
{
value->in_register = 0;
value->in_global_register = 1;
return;
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
{
value->in_frame = still_in_frame;
}
value->reg = reg;
}
/*
* Disassociate value with register.
*/
static void
unbind_value(jit_gencode_t gen, jit_value_t value, int reg, int other_reg)
{
int index;
#ifdef JIT_REG_DEBUG
printf("unbind_value(value = ");
jit_dump_value(stdout, jit_value_get_function(value), value, 0);
printf(", reg = %d, other_reg = %d)\n", reg, other_reg);
#endif
if(!value->in_register || value->reg != reg)
{
return;
}
value->in_register = 0;
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
gen->contents[reg].num_values = gen->contents[top].num_values;
gen->contents[reg].used_for_temp = gen->contents[top].used_for_temp;
gen->contents[reg].age = gen->contents[top].age;
gen->contents[top].num_values = num_values;
gen->contents[top].used_for_temp = used_for_temp;
gen->contents[top].age = age;
}
#endif
/*
* Drop value from the register and optionally bind a temporary value in place of it.
*/
static void
free_value(jit_gencode_t gen, jit_value_t value, int reg, int other_reg, int temp)
{
#ifdef JIT_REG_DEBUG
printf("free_value(value = ");
jit_dump_value(stdout, jit_value_get_function(value), value, 0);
printf(", reg = %d, other_reg = %d, temp = %d)\n", reg, other_reg, temp);
#endif
/* Never free global registers. */
if(value->has_global_register && value->global_reg == reg)
{
return;
}
if(gen->contents[reg].num_values == 1)
{
if(temp)
{
unbind_value(gen, value, reg, other_reg);
bind_temporary(gen, reg, other_reg);
return;
}
#ifdef JIT_REG_STACK
if(IS_STACK_REG(reg))
{
/* Free stack register. */
exch_stack_top(gen, reg, 1);
return;
}
#endif
}
unbind_value(gen, value, reg, other_reg);
}
/*
* Save the value from the register into its frame position and optionally free it.
* If the value is already in the frame or is a constant then it is not saved but
* the free option still applies to them.
*/
static void
save_value(jit_gencode_t gen, jit_value_t value, int reg, int other_reg, int free)
{
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
return;
}
if(!value->in_global_register)
{
_jit_gen_spill_reg(gen, reg, other_reg, value);
value->in_global_register = 1;
}
if(free)
{
unbind_value(gen, value, reg, other_reg);
}
return;
}
/* Take care of constants and values that are already in frame. */
if(value->is_constant || value->in_frame)
{
if(free)
{
free_value(gen, value, reg, other_reg, 0);
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
{
if(gen->contents[top].num_values == 1)
{
_jit_gen_spill_top(gen, top, value, 1);
--(gen->reg_stack_top);
}
else
{
_jit_gen_spill_top(gen, top, value, 0);
}
unbind_value(gen, value, top, 0);
}
else
{
_jit_gen_spill_top(gen, top, value, 0);
}
}
else
#endif
{
_jit_gen_spill_reg(gen, reg, other_reg, value);
if(free)
{
unbind_value(gen, value, reg, other_reg);
}
}
value->in_frame = 1;
}
/*
* Spill a specific register.
*/
static void
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
}
value = gen->contents[reg].values[index];
usage = value_usage(regs, value);
if((usage & VALUE_INPUT) != 0)
{
continue;
}
if((usage & VALUE_DEAD) != 0 || value->in_frame)
{
unbind_value(gen, value, reg, -1);
}
}
for(index = gen->contents[reg].num_values - 1; index >= 0; --index)
{
int top;
value = gen->contents[reg].values[index];
usage = value_usage(regs, value);
if((usage & VALUE_INPUT) != 0)
{
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
desc->stack_reg = desc->reg;
}
return;
}
#ifdef JIT_REG_STACK
if(IS_STACK_REG(desc->reg))
{
_jit_gen_load_value(gen, gen->reg_stack_top, -1, desc->value);
desc->stack_reg = gen->reg_stack_top++;
bind_temporary(gen, desc->stack_reg, -1);
}
else
#endif
{
_jit_gen_load_value(gen, desc->reg, desc->other_reg, desc->value);
bind_temporary(gen, desc->reg, desc->other_reg);
}
}
else
{
#ifdef JIT_REG_STACK
if(IS_STACK_REG(desc->reg))
{
_jit_gen_load_value(gen, gen->reg_stack_top, -1, desc->value);
desc->stack_reg = gen->reg_stack_top++;
bind_value(gen, desc->value, desc->stack_reg, -1, 1);
}
else
#endif
{
_jit_gen_load_value(gen, desc->reg, desc->other_reg, desc->value);
bind_value(gen, desc->value, desc->reg, desc->other_reg, 1);
}
}
}
#ifdef JIT_REG_STACK
static void
move_input_value(jit_gencode_t gen, _jit_regs_t *regs, int index)
{
_jit_regdesc_t *desc;
int src_reg, dst_reg;
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
}
if(IS_STACK_REG(desc->reg))
{
if(desc->copy)
{
gen->contents[desc->reg].used_for_temp = 0;
}
else
{
unbind_value(gen, desc->value, desc->reg, 0);
}
--(gen->reg_stack_top);
}
}
#endif
static void
commit_input_value(jit_gencode_t gen, _jit_regs_t *regs, int index, int killed)
{
_jit_regdesc_t *desc;
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
{
return;
}
#ifdef JIT_REG_STACK
if(IS_STACK_REG(desc->reg) && push_stack_top)
{
++(gen->reg_stack_top);
}
#endif
bind_value(gen, desc->value, desc->reg, desc->other_reg, 0);
if(!desc->used)
{
if(desc->live)
{
save_value(gen, desc->value, desc->reg, desc->other_reg, 1);
}
else
{
free_value(gen, desc->value, desc->reg, desc->other_reg, 0);
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
}
#endif
/* Record that the value is in "reg", but not in the frame */
#ifdef JIT_REG_STACK
if(IS_STACK_REG(reg))
{
++(gen->reg_stack_top);
}
#endif
bind_value(gen, value, reg, other_reg, 0);
}
/*@
* @deftypefun void _jit_regs_set_outgoing (jit_gencode_t gen, int reg, jit_value_t value)
* Load the contents of @code{value} into pseudo register @code{reg},
* spilling out the current contents. This is used to set up outgoing
* parameters for a function call.
* @end deftypefun
@*/
void
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
spill_register(gen, suitable_reg);
if(suitable_other_reg >= 0)
{
spill_register(gen, suitable_other_reg);
}
_jit_gen_load_value(gen, suitable_reg, suitable_other_reg, value);
if(!destroy && !used_again)
{
bind_value(gen, value, suitable_reg, suitable_other_reg, 1);
}
else
{
bind_temporary(gen, suitable_reg, suitable_other_reg);
}
}
return suitable_reg;
}
void
_jit_regs_init(jit_gencode_t gen, _jit_regs_t *regs, int flags)
{
int index;
libjit/jit/jit-reg-alloc.c view on Meta::CPAN
}
}
if(IS_STACK_REG(regs->descs[0].reg))
{
temp = *regs->descs[0].value;
if(!regs->x87_arith && !regs->copy)
{
++(gen->reg_stack_top);
}
bind_value(gen, &temp, regs->descs[0].reg, -1, 0);
}
reg1 = ((regs->descs[1].value && regs->descs[1].value->in_register)
? regs->descs[1].value->reg : -1);
reg2 = ((regs->descs[2].value && regs->descs[2].value->in_register)
? regs->descs[2].value->reg : -1);
if(reg1 > reg2)
{
commit_input_value(gen, regs, 1, pop1);
commit_input_value(gen, regs, 2, pop2);
libjit/jitruby/setup.rb view on Meta::CPAN
def load_standard_entries
standard_entries(@rbconfig).each do |ent|
add ent
end
end
def standard_entries(rbconfig)
c = rbconfig
rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT'])
major = c['MAJOR'].to_i
minor = c['MINOR'].to_i
teeny = c['TEENY'].to_i
version = "#{major}.#{minor}"
# ruby ver. >= 1.4.4?
newpath_p = ((major >= 2) or
((major == 1) and
((minor >= 5) or
libjit/jitruby/setup.rb view on Meta::CPAN
table['sodir'] = '$siterubyverarch'
when 'home'
setup_rb_error '$HOME was not set' unless ENV['HOME']
table['prefix'] = ENV['HOME']
table['rbdir'] = '$libdir/ruby'
table['sodir'] = '$libdir/ruby'
end
},
PathItem.new('prefix', 'path', c['prefix'],
'path prefix of target environment'),
PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
'the directory for commands'),
PathItem.new('libdir', 'path', parameterize.call(c['libdir']),
'the directory for libraries'),
PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
'the directory for shared data'),
PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
'the directory for man pages'),
PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
'the directory for system configuration files'),
PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']),
libjit/jitruby/setup.rb view on Meta::CPAN
end
private :multipackage_entries
ALIASES = {
'std-ruby' => 'librubyver',
'stdruby' => 'librubyver',
'rubylibdir' => 'librubyver',
'archdir' => 'librubyverarch',
'site-ruby-common' => 'siteruby', # For backward compatibility
'site-ruby' => 'siterubyver', # For backward compatibility
'bin-dir' => 'bindir',
'bin-dir' => 'bindir',
'rb-dir' => 'rbdir',
'so-dir' => 'sodir',
'data-dir' => 'datadir',
'ruby-path' => 'rubypath',
'ruby-prog' => 'rubyprog',
'ruby' => 'rubyprog',
'make-prog' => 'makeprog',
'make' => 'makeprog'
}
libjit/jitruby/setup.rb view on Meta::CPAN
#
# TASK install
#
def exec_install
rm_f 'InstalledFiles'
exec_task_traverse 'install'
end
def install_dir_bin(rel)
install_files targetfiles(), "#{config('bindir')}/#{rel}", 0755, strip_ext?
end
def strip_ext?
/mswin|mingw/ !~ RUBY_PLATFORM
end
def install_dir_lib(rel)
install_files libfiles(), "#{config('rbdir')}/#{rel}", 0644
end